Merge "Allow leading slash in path argument for addURI() method." into jb-mr2-dev
diff --git a/Android.mk b/Android.mk
index 104293c..2ad7a725f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -195,10 +195,10 @@
 	core/java/com/android/internal/view/IInputContext.aidl \
 	core/java/com/android/internal/view/IInputContextCallback.aidl \
 	core/java/com/android/internal/view/IInputMethod.aidl \
-	core/java/com/android/internal/view/IInputMethodCallback.aidl \
 	core/java/com/android/internal/view/IInputMethodClient.aidl \
 	core/java/com/android/internal/view/IInputMethodManager.aidl \
 	core/java/com/android/internal/view/IInputMethodSession.aidl \
+	core/java/com/android/internal/view/IInputSessionCallback.aidl \
 	core/java/com/android/internal/widget/ILockSettings.aidl \
 	core/java/com/android/internal/widget/IRemoteViewsFactory.aidl \
 	core/java/com/android/internal/widget/IRemoteViewsAdapterConnection.aidl \
@@ -306,7 +306,6 @@
 	frameworks/base/core/java/com/android/internal/textservice/ITextServicesSessionListener.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputContext.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputMethod.aidl \
-	frameworks/base/core/java/com/android/internal/view/IInputMethodCallback.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputMethodClient.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputMethodManager.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputMethodSession.aidl \
diff --git a/CleanSpec.mk b/CleanSpec.mk
index b87fa48..fc63866 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -156,6 +156,9 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/librtp_jni.so)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/android/internal/telephony/SmsRawData.*)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/view/IInputMethodCallback.*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/view/IInputMethodSession.*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/view/IInputMethodCallback.*)
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/api/current.txt b/api/current.txt
index f2fcbd6..d0149aa 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -339,8 +339,10 @@
     field public static final int checkedTextViewStyle = 16843720; // 0x10103c8
     field public static final int childDivider = 16843025; // 0x1010111
     field public static final int childIndicator = 16843020; // 0x101010c
+    field public static final int childIndicatorEnd = 16843732; // 0x10103d4
     field public static final int childIndicatorLeft = 16843023; // 0x101010f
     field public static final int childIndicatorRight = 16843024; // 0x1010110
+    field public static final int childIndicatorStart = 16843731; // 0x10103d3
     field public static final int choiceMode = 16843051; // 0x101012b
     field public static final int clearTaskOnLaunch = 16842773; // 0x1010015
     field public static final int clickable = 16842981; // 0x10100e5
@@ -574,8 +576,10 @@
     field public static final int indeterminateDuration = 16843069; // 0x101013d
     field public static final int indeterminateOnly = 16843066; // 0x101013a
     field public static final int indeterminateProgressStyle = 16843544; // 0x1010318
+    field public static final int indicatorEnd = 16843730; // 0x10103d2
     field public static final int indicatorLeft = 16843021; // 0x101010d
     field public static final int indicatorRight = 16843022; // 0x101010e
+    field public static final int indicatorStart = 16843729; // 0x10103d1
     field public static final int inflatedId = 16842995; // 0x10100f3
     field public static final int initOrder = 16842778; // 0x101001a
     field public static final int initialKeyguardLayout = 16843714; // 0x10103c2
@@ -846,6 +850,7 @@
     field public static final int reqNavigation = 16843306; // 0x101022a
     field public static final int reqTouchScreen = 16843303; // 0x1010227
     field public static final int required = 16843406; // 0x101028e
+    field public static final int requiredForAllUsers = 16843728; // 0x10103d0
     field public static final int requiresFadingEdge = 16843685; // 0x10103a5
     field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
     field public static final int resizeMode = 16843619; // 0x1010363
@@ -2445,6 +2450,7 @@
     method public static android.animation.ObjectAnimator ofObject(java.lang.Object, java.lang.String, android.animation.TypeEvaluator, java.lang.Object...);
     method public static android.animation.ObjectAnimator ofObject(T, android.util.Property<T, V>, android.animation.TypeEvaluator<V>, V...);
     method public static android.animation.ObjectAnimator ofPropertyValuesHolder(java.lang.Object, android.animation.PropertyValuesHolder...);
+    method public void setAutoCancel(boolean);
     method public void setProperty(android.util.Property);
     method public void setPropertyName(java.lang.String);
   }
@@ -4331,6 +4337,7 @@
     method public boolean hasGrantedPolicy(android.content.ComponentName, int);
     method public boolean isActivePasswordSufficient();
     method public boolean isAdminActive(android.content.ComponentName);
+    method public boolean isDeviceOwner(java.lang.String);
     method public void lockNow();
     method public void removeActiveAdmin(android.content.ComponentName);
     method public boolean resetPassword(java.lang.String, int);
@@ -5404,6 +5411,7 @@
     method public abstract java.lang.String[] fileList();
     method public abstract android.content.Context getApplicationContext();
     method public abstract android.content.pm.ApplicationInfo getApplicationInfo();
+    method public java.util.List<android.content.RestrictionEntry> getApplicationRestrictions();
     method public abstract android.content.res.AssetManager getAssets();
     method public abstract java.io.File getCacheDir();
     method public abstract java.lang.ClassLoader getClassLoader();
@@ -5847,6 +5855,7 @@
     field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
     field public static final java.lang.String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
     field public static final java.lang.String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
+    field public static final java.lang.String ACTION_GET_RESTRICTION_ENTRIES = "android.intent.action.GET_RESTRICTION_ENTRIES";
     field public static final java.lang.String ACTION_GTALK_SERVICE_CONNECTED = "android.intent.action.GTALK_CONNECTED";
     field public static final java.lang.String ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED";
     field public static final java.lang.String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG";
@@ -5988,6 +5997,7 @@
     field public static final java.lang.String EXTRA_REFERRER = "android.intent.extra.REFERRER";
     field public static final java.lang.String EXTRA_REMOTE_INTENT_TOKEN = "android.intent.extra.remote_intent_token";
     field public static final java.lang.String EXTRA_REPLACING = "android.intent.extra.REPLACING";
+    field public static final java.lang.String EXTRA_RESTRICTIONS = "android.intent.extra.restrictions";
     field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT";
     field public static final java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
     field public static final java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
@@ -6230,6 +6240,33 @@
     ctor public ReceiverCallNotAllowedException(java.lang.String);
   }
 
+  public class RestrictionEntry implements android.os.Parcelable {
+    ctor public RestrictionEntry(java.lang.String, java.lang.String);
+    ctor public RestrictionEntry(java.lang.String, boolean);
+    ctor public RestrictionEntry(java.lang.String, java.lang.String[]);
+    ctor public RestrictionEntry(android.os.Parcel);
+    method public int describeContents();
+    method public boolean getBooleanValue();
+    method public java.lang.String[] getMultipleValues();
+    method public java.lang.String getStringValue();
+    method public void setMultipleValues(java.lang.String[]);
+    method public void setValue(java.lang.String);
+    method public void setValue(boolean);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator CREATOR;
+    field public static final int TYPE_BOOLEAN = 1; // 0x1
+    field public static final int TYPE_CHOICE = 2; // 0x2
+    field public static final int TYPE_CHOICE_LEVEL = 3; // 0x3
+    field public static final int TYPE_MULTI_SELECT = 4; // 0x4
+    field public static final int TYPE_NULL = 0; // 0x0
+    field public java.lang.String[] choices;
+    field public java.lang.String description;
+    field public java.lang.String key;
+    field public java.lang.String title;
+    field public int type;
+    field public java.lang.String[] values;
+  }
+
   public class SearchRecentSuggestionsProvider extends android.content.ContentProvider {
     ctor public SearchRecentSuggestionsProvider();
     method public int delete(android.net.Uri, java.lang.String, java.lang.String[]);
@@ -6694,6 +6731,7 @@
     field public static final int DONT_KILL_APP = 1; // 0x1
     field public static final java.lang.String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
     field public static final java.lang.String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT";
+    field public static final java.lang.String FEATURE_APP_WIDGETS = "android.software.app_widgets";
     field public static final java.lang.String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
     field public static final java.lang.String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
     field public static final java.lang.String FEATURE_CAMERA = "android.hardware.camera";
@@ -6704,6 +6742,8 @@
     field public static final java.lang.String FEATURE_FAKETOUCH = "android.hardware.faketouch";
     field public static final java.lang.String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
     field public static final java.lang.String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
+    field public static final java.lang.String FEATURE_HOME_SCREEN = "android.software.home_screen";
+    field public static final java.lang.String FEATURE_INPUT_METHODS = "android.software.input_methods";
     field public static final java.lang.String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
     field public static final java.lang.String FEATURE_LOCATION = "android.hardware.location";
     field public static final java.lang.String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
@@ -10924,6 +10964,7 @@
     method public void playSoundEffect(int);
     method public void playSoundEffect(int, float);
     method public void registerMediaButtonEventReceiver(android.content.ComponentName);
+    method public void registerMediaButtonEventReceiver(android.app.PendingIntent);
     method public void registerRemoteControlClient(android.media.RemoteControlClient);
     method public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int);
     method public deprecated void setBluetoothA2dpOn(boolean);
@@ -10944,6 +10985,7 @@
     method public void stopBluetoothSco();
     method public void unloadSoundEffects();
     method public void unregisterMediaButtonEventReceiver(android.content.ComponentName);
+    method public void unregisterMediaButtonEventReceiver(android.app.PendingIntent);
     method public void unregisterRemoteControlClient(android.media.RemoteControlClient);
     field public static final java.lang.String ACTION_AUDIO_BECOMING_NOISY = "android.media.AUDIO_BECOMING_NOISY";
     field public static final deprecated java.lang.String ACTION_SCO_AUDIO_STATE_CHANGED = "android.media.SCO_AUDIO_STATE_CHANGED";
@@ -11589,6 +11631,7 @@
     ctor public MediaMuxer(java.lang.String, int) throws java.io.IOException;
     method public int addTrack(android.media.MediaFormat);
     method public void release();
+    method public void setOrientationHint(int);
     method public void start();
     method public void stop();
     method public void writeSampleData(int, java.nio.ByteBuffer, android.media.MediaCodec.BufferInfo);
@@ -13582,6 +13625,7 @@
     method public deprecated android.net.DhcpInfo getDhcpInfo();
     method public java.util.List<android.net.wifi.ScanResult> getScanResults();
     method public int getWifiState();
+    method public boolean isScanningAlwaysAvailable();
     method public boolean isWifiEnabled();
     method public boolean pingSupplicant();
     method public boolean reassociate();
@@ -13592,6 +13636,7 @@
     method public boolean startScan();
     method public int updateNetwork(android.net.wifi.WifiConfiguration);
     field public static final java.lang.String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK";
+    field public static final java.lang.String ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE = "android.net.wifi.action.REQUEST_SCAN_ALWAYS_AVAILABLE";
     field public static final int ERROR_AUTHENTICATING = 1; // 0x1
     field public static final java.lang.String EXTRA_BSSID = "bssid";
     field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
@@ -16744,9 +16789,20 @@
     method public int getUserCount();
     method public android.os.UserHandle getUserForSerialNumber(long);
     method public java.lang.String getUserName();
+    method public android.os.Bundle getUserRestrictions();
+    method public android.os.Bundle getUserRestrictions(android.os.UserHandle);
     method public boolean isUserAGoat();
+    method public boolean isUserRestricted();
     method public boolean isUserRunning(android.os.UserHandle);
     method public boolean isUserRunningOrStopping(android.os.UserHandle);
+    method public void setUserRestriction(java.lang.String, boolean);
+    method public void setUserRestrictions(android.os.Bundle);
+    method public void setUserRestrictions(android.os.Bundle, android.os.UserHandle);
+    field public static final java.lang.String DISALLOW_CONFIG_WIFI = "no_config_wifi";
+    field public static final java.lang.String DISALLOW_INSTALL_APPS = "no_install_apps";
+    field public static final java.lang.String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
+    field public static final java.lang.String DISALLOW_SHARE_LOCATION = "no_share_location";
+    field public static final java.lang.String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
   }
 
   public abstract class Vibrator {
@@ -17879,6 +17935,13 @@
     field public static final java.lang.String TYPE = "data2";
   }
 
+  public static final class ContactsContract.CommonDataKinds.Contactables implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    ctor public ContactsContract.CommonDataKinds.Contactables();
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final java.lang.String VISIBLE_CONTACTS_ONLY = "visible_contacts_only";
+  }
+
   public static final class ContactsContract.CommonDataKinds.Email implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
     method public static final java.lang.CharSequence getTypeLabel(android.content.res.Resources, int, java.lang.CharSequence);
     method public static final int getTypeLabelResource(int);
@@ -18172,6 +18235,7 @@
     method public static android.net.Uri getContactLookupUri(android.content.ContentResolver, android.net.Uri);
     field public static final java.lang.String CONTENT_TYPE = "vnd.android.cursor.dir/data";
     field public static final android.net.Uri CONTENT_URI;
+    field public static final java.lang.String VISIBLE_CONTACTS_ONLY = "visible_contacts_only";
   }
 
   protected static abstract interface ContactsContract.DataColumns {
@@ -26097,6 +26161,8 @@
     method public void addOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener);
     method public void addOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener);
     method public void addOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener);
+    method public void addOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener);
+    method public void addOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener);
     method public final void dispatchOnDraw();
     method public final void dispatchOnGlobalLayout();
     method public final boolean dispatchOnPreDraw();
@@ -26108,6 +26174,8 @@
     method public void removeOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener);
     method public void removeOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener);
     method public void removeOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener);
+    method public void removeOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener);
+    method public void removeOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener);
   }
 
   public static abstract interface ViewTreeObserver.OnDrawListener {
@@ -26134,6 +26202,15 @@
     method public abstract void onTouchModeChanged(boolean);
   }
 
+  public static abstract interface ViewTreeObserver.OnWindowAttachListener {
+    method public abstract void onWindowAttached();
+    method public abstract void onWindowDetached();
+  }
+
+  public static abstract interface ViewTreeObserver.OnWindowFocusChangeListener {
+    method public abstract void onWindowFocusChanged(boolean);
+  }
+
   public abstract class Window {
     ctor public Window(android.content.Context);
     method public abstract void addContentView(android.view.View, android.view.ViewGroup.LayoutParams);
@@ -28563,8 +28640,10 @@
     method public void setChildDivider(android.graphics.drawable.Drawable);
     method public void setChildIndicator(android.graphics.drawable.Drawable);
     method public void setChildIndicatorBounds(int, int);
+    method public void setChildIndicatorBoundsRelative(int, int);
     method public void setGroupIndicator(android.graphics.drawable.Drawable);
     method public void setIndicatorBounds(int, int);
+    method public void setIndicatorBoundsRelative(int, int);
     method public void setOnChildClickListener(android.widget.ExpandableListView.OnChildClickListener);
     method public void setOnGroupClickListener(android.widget.ExpandableListView.OnGroupClickListener);
     method public void setOnGroupCollapseListener(android.widget.ExpandableListView.OnGroupCollapseListener);
@@ -29863,8 +29942,8 @@
     method public void setFormat12Hour(java.lang.CharSequence);
     method public void setFormat24Hour(java.lang.CharSequence);
     method public void setTimeZone(java.lang.String);
-    field public static final java.lang.CharSequence DEFAULT_FORMAT_12_HOUR;
-    field public static final java.lang.CharSequence DEFAULT_FORMAT_24_HOUR;
+    field public static final deprecated java.lang.CharSequence DEFAULT_FORMAT_12_HOUR;
+    field public static final deprecated java.lang.CharSequence DEFAULT_FORMAT_24_HOUR;
   }
 
   public class TextSwitcher extends android.widget.ViewSwitcher {
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp
index a1ea81a..be32355 100644
--- a/cmds/screencap/screencap.cpp
+++ b/cmds/screencap/screencap.cpp
@@ -23,10 +23,13 @@
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
-#include <binder/IMemory.h>
+#include <binder/ProcessState.h>
+
 #include <gui/SurfaceComposerClient.h>
 #include <gui/ISurfaceComposer.h>
 
+#include <ui/PixelFormat.h>
+
 #include <SkImageEncoder.h>
 #include <SkBitmap.h>
 #include <SkData.h>
@@ -89,6 +92,8 @@
 
 int main(int argc, char** argv)
 {
+    ProcessState::self()->startThreadPool();
+
     const char* pname = argv[0];
     bool png = false;
     int32_t displayId = DEFAULT_DISPLAY_ID;
@@ -135,7 +140,7 @@
     ssize_t mapsize = -1;
 
     void const* base = 0;
-    uint32_t w, h, f;
+    uint32_t w, s, h, f;
     size_t size = 0;
 
     ScreenshotClient screenshot;
@@ -144,6 +149,7 @@
         base = screenshot.getPixels();
         w = screenshot.getWidth();
         h = screenshot.getHeight();
+        s = screenshot.getStride();
         f = screenshot.getFormat();
         size = screenshot.getSize();
     } else {
@@ -157,6 +163,7 @@
                     size_t offset = (vinfo.xoffset + vinfo.yoffset*vinfo.xres) * bytespp;
                     w = vinfo.xres;
                     h = vinfo.yres;
+                    s = vinfo.xres;
                     size = w*h*bytespp;
                     mapsize = offset + size;
                     mapbase = mmap(0, mapsize, PROT_READ, MAP_PRIVATE, fb, 0);
@@ -172,7 +179,7 @@
     if (base) {
         if (png) {
             SkBitmap b;
-            b.setConfig(flinger2skia(f), w, h);
+            b.setConfig(flinger2skia(f), w, h, s*bytesPerPixel(f));
             b.setPixels((void*)base);
             SkDynamicMemoryWStream stream;
             SkImageEncoder::EncodeStream(&stream, b,
@@ -184,7 +191,11 @@
             write(fd, &w, 4);
             write(fd, &h, 4);
             write(fd, &f, 4);
-            write(fd, base, size);
+            size_t Bpp = bytesPerPixel(f);
+            for (size_t y=0 ; y<h ; y++) {
+                write(fd, base, w*Bpp);
+                base = (void *)((char *)base + s*Bpp);
+            }
         }
     }
     close(fd);
diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
index 58105fa..da8586c 100644
--- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
@@ -36,12 +36,18 @@
         return shortHelp() + "\n"
                 + "\n"
                 + "usage: svc power stayon [true|false|usb|ac|wireless]\n"
-                + "         Set the 'keep awake while plugged in' setting.\n";
+                + "         Set the 'keep awake while plugged in' setting.\n"
+                + "       svc power reboot [reason]\n"
+                + "         Perform a runtime shutdown and reboot device with specified reason.\n"
+                + "       svc power shutdown\n"
+                + "         Perform a runtime shutdown and power off the device.\n";
     }
 
     public void run(String[] args) {
         fail: {
             if (args.length >= 2) {
+                IPowerManager pm = IPowerManager.Stub.asInterface(
+                        ServiceManager.getService(Context.POWER_SERVICE));
                 if ("stayon".equals(args[1]) && args.length == 3) {
                     int val;
                     if ("true".equals(args[2])) {
@@ -60,8 +66,6 @@
                     } else {
                         break fail;
                     }
-                    IPowerManager pm
-                            = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
                     try {
                         if (val != 0) {
                             // if the request is not to set it to false, wake up the screen so that
@@ -74,6 +78,26 @@
                         System.err.println("Faild to set setting: " + e);
                     }
                     return;
+                } else if ("reboot".equals(args[1])) {
+                    String mode = null;
+                    if (args.length == 3) {
+                        mode = args[2];
+                    }
+                    try {
+                        // no confirm, wait till device is rebooted
+                        pm.reboot(false, mode, true);
+                    } catch (RemoteException e) {
+                        System.err.println("Failed to reboot.");
+                    }
+                    return;
+                } else if ("shutdown".equals(args[1])) {
+                    try {
+                        // no confirm, wait till device is off
+                        pm.shutdown(false, true);
+                    } catch (RemoteException e) {
+                        System.err.println("Failed to shutdown.");
+                    }
+                    return;
                 }
             }
         }
diff --git a/cmds/wm/src/com/android/commands/wm/Wm.java b/cmds/wm/src/com/android/commands/wm/Wm.java
index f48764f..31eba96 100644
--- a/cmds/wm/src/com/android/commands/wm/Wm.java
+++ b/cmds/wm/src/com/android/commands/wm/Wm.java
@@ -19,6 +19,7 @@
 package com.android.commands.wm;
 
 import android.content.Context;
+import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.RemoteException;
 import android.os.ServiceManager;
@@ -87,9 +88,22 @@
     }
 
     private void runDisplaySize() throws Exception {
-        String size = nextArgRequired();
+        String size = nextArg();
         int w, h;
-        if ("reset".equals(size)) {
+        if (size == null) {
+            Point initialSize = new Point();
+            Point baseSize = new Point();
+            try {
+                mWm.getInitialDisplaySize(Display.DEFAULT_DISPLAY, initialSize);
+                mWm.getBaseDisplaySize(Display.DEFAULT_DISPLAY, baseSize);
+                System.out.println("Physical size: " + initialSize.x + "x" + initialSize.y);
+                if (!initialSize.equals(baseSize)) {
+                    System.out.println("Override size: " + baseSize.x + "x" + baseSize.y);
+                }
+            } catch (RemoteException e) {
+            }
+            return;
+        } else if ("reset".equals(size)) {
             w = h = -1;
         } else {
             int div = size.indexOf('x');
@@ -120,9 +134,20 @@
     }
 
     private void runDisplayDensity() throws Exception {
-        String densityStr = nextArgRequired();
+        String densityStr = nextArg();
         int density;
-        if ("reset".equals(densityStr)) {
+        if (densityStr == null) {
+            try {
+                int initialDensity = mWm.getInitialDisplayDensity(Display.DEFAULT_DISPLAY);
+                int baseDensity = mWm.getBaseDisplayDensity(Display.DEFAULT_DISPLAY);
+                System.out.println("Physical density: " + initialDensity);
+                if (initialDensity != baseDensity) {
+                    System.out.println("Override density: " + baseDensity);
+                }
+            } catch (RemoteException e) {
+            }
+            return;
+        } else if ("reset".equals(densityStr)) {
             density = -1;
         } else {
             try {
@@ -231,7 +256,7 @@
                 "       wm density [reset|DENSITY]\n" +
                 "       wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]\n" +
                 "\n" +
-                "wm size: override display size.\n" +
+                "wm size: return or override display size.\n" +
                 "\n" +
                 "wm density: override display density.\n" +
                 "\n" +
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index f8b7a0c..313260f 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -152,6 +152,9 @@
     public static final int ERROR_CODE_BAD_ARGUMENTS = 7;
     public static final int ERROR_CODE_BAD_REQUEST = 8;
 
+    /** @hide */
+    public static final int ERROR_CODE_USER_RESTRICTED = 100;
+
     /**
      * Bundle key used for the {@link String} account name in results
      * from methods which return information about a particular account.
@@ -1526,7 +1529,7 @@
             }
 
             public void onError(int code, String message) {
-                if (code == ERROR_CODE_CANCELED) {
+                if (code == ERROR_CODE_CANCELED || code == ERROR_CODE_USER_RESTRICTED) {
                     // the authenticator indicated that this request was canceled, do so now
                     cancel(true /* mayInterruptIfRunning */);
                     return;
diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java
index 0372cb0..173ee73 100644
--- a/core/java/android/animation/ObjectAnimator.java
+++ b/core/java/android/animation/ObjectAnimator.java
@@ -19,7 +19,6 @@
 import android.util.Log;
 import android.util.Property;
 
-import java.lang.reflect.Method;
 import java.util.ArrayList;
 
 /**
@@ -49,6 +48,8 @@
 
     private Property mProperty;
 
+    private boolean mAutoCancel = false;
+
     /**
      * Sets the name of the property that will be animated. This name is used to derive
      * a setter function that will be called to set animated values.
@@ -346,17 +347,83 @@
             // No values yet - this animator is being constructed piecemeal. Init the values with
             // whatever the current propertyName is
             if (mProperty != null) {
-                setValues(PropertyValuesHolder.ofObject(mProperty, (TypeEvaluator)null, values));
+                setValues(PropertyValuesHolder.ofObject(mProperty, (TypeEvaluator) null, values));
             } else {
-                setValues(PropertyValuesHolder.ofObject(mPropertyName, (TypeEvaluator)null, values));
+                setValues(PropertyValuesHolder.ofObject(mPropertyName,
+                        (TypeEvaluator) null, values));
             }
         } else {
             super.setObjectValues(values);
         }
     }
 
+    /**
+     * autoCancel controls whether an ObjectAnimator will be canceled automatically
+     * when any other ObjectAnimator with the same target and properties is started.
+     * Setting this flag may make it easier to run different animators on the same target
+     * object without having to keep track of whether there are conflicting animators that
+     * need to be manually canceled. Canceling animators must have the same exact set of
+     * target properties, in the same order.
+     *
+     * @param cancel Whether future ObjectAnimators with the same target and properties
+     * as this ObjectAnimator will cause this ObjectAnimator to be canceled.
+     */
+    public void setAutoCancel(boolean cancel) {
+        mAutoCancel = cancel;
+    }
+
+    private boolean hasSameTargetAndProperties(Animator anim) {
+        if (anim instanceof ObjectAnimator) {
+            PropertyValuesHolder[] theirValues = ((ObjectAnimator) anim).getValues();
+            if (((ObjectAnimator) anim).getTarget() == mTarget &&
+                    mValues.length == theirValues.length) {
+                for (int i = 0; i < mValues.length; ++i) {
+                    PropertyValuesHolder pvhMine = mValues[i];
+                    PropertyValuesHolder pvhTheirs = theirValues[i];
+                    if (pvhMine.getPropertyName() == null ||
+                            !pvhMine.getPropertyName().equals(pvhTheirs.getPropertyName())) {
+                        return false;
+                    }
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
     @Override
     public void start() {
+        // See if any of the current active/pending animators need to be canceled
+        AnimationHandler handler = sAnimationHandler.get();
+        if (handler != null) {
+            int numAnims = handler.mAnimations.size();
+            for (int i = numAnims - 1; i >= 0; i--) {
+                if (handler.mAnimations.get(i) instanceof ObjectAnimator) {
+                    ObjectAnimator anim = (ObjectAnimator) handler.mAnimations.get(i);
+                    if (anim.mAutoCancel && hasSameTargetAndProperties(anim)) {
+                        anim.cancel();
+                    }
+                }
+            }
+            numAnims = handler.mPendingAnimations.size();
+            for (int i = numAnims - 1; i >= 0; i--) {
+                if (handler.mPendingAnimations.get(i) instanceof ObjectAnimator) {
+                    ObjectAnimator anim = (ObjectAnimator) handler.mPendingAnimations.get(i);
+                    if (anim.mAutoCancel && hasSameTargetAndProperties(anim)) {
+                        anim.cancel();
+                    }
+                }
+            }
+            numAnims = handler.mDelayedAnims.size();
+            for (int i = numAnims - 1; i >= 0; i--) {
+                if (handler.mDelayedAnims.get(i) instanceof ObjectAnimator) {
+                    ObjectAnimator anim = (ObjectAnimator) handler.mDelayedAnims.get(i);
+                    if (anim.mAutoCancel && hasSameTargetAndProperties(anim)) {
+                        anim.cancel();
+                    }
+                }
+            }
+        }
         if (DBG) {
             Log.d("ObjectAnimator", "Anim target, duration: " + mTarget + ", " + getDuration());
             for (int i = 0; i < mValues.length; ++i) {
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index 4a58072..ea605b9 100644
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -83,7 +83,10 @@
 
     // The static sAnimationHandler processes the internal timing loop on which all animations
     // are based
-    private static ThreadLocal<AnimationHandler> sAnimationHandler =
+    /**
+     * @hide
+     */
+    protected static ThreadLocal<AnimationHandler> sAnimationHandler =
             new ThreadLocal<AnimationHandler>();
 
     // The time interpolator to be used if none is set on the animation
@@ -531,22 +534,27 @@
      * animations possible.
      *
      * The handler uses the Choreographer for executing periodic callbacks.
+     *
+     * @hide
      */
-    private static class AnimationHandler implements Runnable {
+    protected static class AnimationHandler implements Runnable {
         // The per-thread list of all active animations
-        private final ArrayList<ValueAnimator> mAnimations = new ArrayList<ValueAnimator>();
+        /** @hide */
+        protected final ArrayList<ValueAnimator> mAnimations = new ArrayList<ValueAnimator>();
 
         // Used in doAnimationFrame() to avoid concurrent modifications of mAnimations
         private final ArrayList<ValueAnimator> mTmpAnimations = new ArrayList<ValueAnimator>();
 
         // The per-thread set of animations to be started on the next animation frame
-        private final ArrayList<ValueAnimator> mPendingAnimations = new ArrayList<ValueAnimator>();
+        /** @hide */
+        protected final ArrayList<ValueAnimator> mPendingAnimations = new ArrayList<ValueAnimator>();
 
         /**
          * Internal per-thread collections used to avoid set collisions as animations start and end
          * while being processed.
+         * @hide
          */
-        private final ArrayList<ValueAnimator> mDelayedAnims = new ArrayList<ValueAnimator>();
+        protected final ArrayList<ValueAnimator> mDelayedAnims = new ArrayList<ValueAnimator>();
         private final ArrayList<ValueAnimator> mEndingAnims = new ArrayList<ValueAnimator>();
         private final ArrayList<ValueAnimator> mReadyAnims = new ArrayList<ValueAnimator>();
 
diff --git a/core/java/android/app/Application.java b/core/java/android/app/Application.java
index 132388e..7b07438 100644
--- a/core/java/android/app/Application.java
+++ b/core/java/android/app/Application.java
@@ -17,14 +17,17 @@
 package android.app;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import android.content.ComponentCallbacks;
 import android.content.ComponentCallbacks2;
 import android.content.Context;
 import android.content.ContextWrapper;
 import android.content.Intent;
+import android.content.RestrictionEntry;
 import android.content.res.Configuration;
 import android.os.Bundle;
+import android.os.UserManager;
 
 /**
  * Base class for those who need to maintain global application state. You can
@@ -131,6 +134,11 @@
         }
     }
 
+    public List<RestrictionEntry> getApplicationRestrictions() {
+        return ((UserManager) getSystemService(USER_SERVICE))
+                .getApplicationRestrictions(getPackageName(), android.os.Process.myUserHandle());
+    }
+
     public void registerComponentCallbacks(ComponentCallbacks callback) {
         synchronized (mComponentCallbacks) {
             mComponentCallbacks.add(callback);
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index 26dc60d..165c3db 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -461,39 +461,63 @@
         }
 
         /**
-         * Set the local destination for the downloaded file to a path within the application's
-         * external files directory (as returned by {@link Context#getExternalFilesDir(String)}.
+         * Set the local destination for the downloaded file to a path within
+         * the application's external files directory (as returned by
+         * {@link Context#getExternalFilesDir(String)}.
          * <p>
-         * The downloaded file is not scanned by MediaScanner.
-         * But it can be made scannable by calling {@link #allowScanningByMediaScanner()}.
+         * The downloaded file is not scanned by MediaScanner. But it can be
+         * made scannable by calling {@link #allowScanningByMediaScanner()}.
          *
-         * @param context the {@link Context} to use in determining the external files directory
-         * @param dirType the directory type to pass to {@link Context#getExternalFilesDir(String)}
-         * @param subPath the path within the external directory, including the destination filename
+         * @param context the {@link Context} to use in determining the external
+         *            files directory
+         * @param dirType the directory type to pass to
+         *            {@link Context#getExternalFilesDir(String)}
+         * @param subPath the path within the external directory, including the
+         *            destination filename
          * @return this object
+         * @throws IllegalStateException If the external storage directory
+         *             cannot be found or created.
          */
         public Request setDestinationInExternalFilesDir(Context context, String dirType,
                 String subPath) {
-            setDestinationFromBase(context.getExternalFilesDir(dirType), subPath);
+            final File file = context.getExternalFilesDir(dirType);
+            if (file == null) {
+                throw new IllegalStateException("Failed to get external storage files directory");
+            } else if (file.exists()) {
+                if (!file.isDirectory()) {
+                    throw new IllegalStateException(file.getAbsolutePath() +
+                            " already exists and is not a directory");
+                }
+            } else {
+                if (!file.mkdirs()) {
+                    throw new IllegalStateException("Unable to create directory: "+
+                            file.getAbsolutePath());
+                }
+            }
+            setDestinationFromBase(file, subPath);
             return this;
         }
 
         /**
-         * Set the local destination for the downloaded file to a path within the public external
-         * storage directory (as returned by
-         * {@link Environment#getExternalStoragePublicDirectory(String)}.
-         *<p>
-         * The downloaded file is not scanned by MediaScanner.
-         * But it can be made scannable by calling {@link #allowScanningByMediaScanner()}.
+         * Set the local destination for the downloaded file to a path within
+         * the public external storage directory (as returned by
+         * {@link Environment#getExternalStoragePublicDirectory(String)}).
+         * <p>
+         * The downloaded file is not scanned by MediaScanner. But it can be
+         * made scannable by calling {@link #allowScanningByMediaScanner()}.
          *
-         * @param dirType the directory type to pass to
-         *        {@link Environment#getExternalStoragePublicDirectory(String)}
-         * @param subPath the path within the external directory, including the destination filename
+         * @param dirType the directory type to pass to {@link Environment#getExternalStoragePublicDirectory(String)}
+         * @param subPath the path within the external directory, including the
+         *            destination filename
          * @return this object
+         * @throws IllegalStateException If the external storage directory
+         *             cannot be found or created.
          */
         public Request setDestinationInExternalPublicDir(String dirType, String subPath) {
             File file = Environment.getExternalStoragePublicDirectory(dirType);
-            if (file.exists()) {
+            if (file == null) {
+                throw new IllegalStateException("Failed to get external storage public directory");
+            } else if (file.exists()) {
                 if (!file.isDirectory()) {
                     throw new IllegalStateException(file.getAbsolutePath() +
                             " already exists and is not a directory");
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 14bcc0d..3d9b2ae 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -41,7 +41,7 @@
     StatusBarNotification[] getActiveNotifications(String callingPkg);
     StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count);
 
-    void registerListener(in INotificationListener listener, int userid);
+    void registerListener(in INotificationListener listener, String pkg, int userid);
     void unregisterListener(in INotificationListener listener, int userid);
 }
 
diff --git a/core/java/android/app/NativeActivity.java b/core/java/android/app/NativeActivity.java
index 396f910..51867bc 100644
--- a/core/java/android/app/NativeActivity.java
+++ b/core/java/android/app/NativeActivity.java
@@ -353,8 +353,7 @@
     }
     
     void preDispatchKeyEvent(KeyEvent event, int seq) {
-        mIMM.dispatchKeyEvent(this, seq, event,
-                mInputMethodCallback);
+        mIMM.dispatchInputEvent(this, seq, event, mInputMethodCallback);
     }
 
     void setWindowFlags(int flags, int mask) {
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4c0eba0..8284b2c 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1513,4 +1513,57 @@
             }
         }
     }
+
+    /**
+     * @hide
+     * Sets the given package as the device owner. The package must already be installed and there
+     * shouldn't be an existing device owner registered, for this call to succeed. Also, this
+     * method must be called before the device is provisioned.
+     * @param packageName the package name of the application to be registered as the device owner.
+     * @return whether the package was successfully registered as the device owner.
+     * @throws IllegalArgumentException if the package name is null or invalid
+     * @throws IllegalStateException if a device owner is already registered or the device has
+     *         already been provisioned.
+     */
+    public boolean setDeviceOwner(String packageName) throws IllegalArgumentException,
+            IllegalStateException {
+        if (mService != null) {
+            try {
+                return mService.setDeviceOwner(packageName);
+            } catch (RemoteException re) {
+                Log.w(TAG, "Failed to set device owner");
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Used to determine if a particular package has been registered as a Device Owner admin.
+     * Device Owner admins cannot be deactivated by the user unless the Device Owner itself allows
+     * it. And Device Owner packages cannot be uninstalled, once registered.
+     * @param packageName the package name to check against the registered device owner.
+     * @return whether or not the package is registered as the Device Owner.
+     */
+    public boolean isDeviceOwner(String packageName) {
+        if (mService != null) {
+            try {
+                return mService.isDeviceOwner(packageName);
+            } catch (RemoteException re) {
+                Log.w(TAG, "Failed to check device owner");
+            }
+        }
+        return false;
+    }
+
+    /** @hide */
+    public String getDeviceOwner() {
+        if (mService != null) {
+            try {
+                return mService.getDeviceOwner();
+            } catch (RemoteException re) {
+                Log.w(TAG, "Failed to get device owner");
+            }
+        }
+        return null;
+    }
 }
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index e061ab3..b2a65bf 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -97,4 +97,8 @@
         int numbers, int symbols, int nonletter, int userHandle);
     void reportFailedPasswordAttempt(int userHandle);
     void reportSuccessfulPasswordAttempt(int userHandle);
+
+    boolean setDeviceOwner(String packageName);
+    boolean isDeviceOwner(String packageName);
+    String getDeviceOwner();
 }
diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java
index 3425765..37fddcb 100644
--- a/core/java/android/app/backup/BackupAgent.java
+++ b/core/java/android/app/backup/BackupAgent.java
@@ -477,21 +477,31 @@
             }
         } else {
             // Not a supported location
-            Log.i(TAG, "Data restored from non-app domain " + domain + ", ignoring");
+            Log.i(TAG, "Unrecognized domain " + domain);
         }
 
         // Now that we've figured out where the data goes, send it on its way
         if (basePath != null) {
+            // Canonicalize the nominal path and verify that it lies within the stated domain
             File outFile = new File(basePath, path);
-            if (DEBUG) Log.i(TAG, "[" + domain + " : " + path + "] mapped to " + outFile.getPath());
-            onRestoreFile(data, size, outFile, type, mode, mtime);
-        } else {
-            // Not a supported output location?  We need to consume the data
-            // anyway, so just use the default "copy the data out" implementation
-            // with a null destination.
-            if (DEBUG) Log.i(TAG, "[ skipping data from unsupported domain " + domain + "]");
-            FullBackup.restoreFile(data, size, type, mode, mtime, null);
+            String outPath = outFile.getCanonicalPath();
+            if (outPath.startsWith(basePath + File.separatorChar)) {
+                if (DEBUG) Log.i(TAG, "[" + domain + " : " + path + "] mapped to " + outPath);
+                onRestoreFile(data, size, outFile, type, mode, mtime);
+                return;
+            } else {
+                // Attempt to restore to a path outside the file's nominal domain.
+                if (DEBUG) {
+                    Log.e(TAG, "Cross-domain restore attempt: " + outPath);
+                }
+            }
         }
+
+        // Not a supported output location, or bad path:  we need to consume the data
+        // anyway, so just use the default "copy the data out" implementation
+        // with a null destination.
+        if (DEBUG) Log.i(TAG, "[ skipping file " + path + "]");
+        FullBackup.restoreFile(data, size, type, mode, mtime, null);
     }
 
     // ----- Core implementation -----
diff --git a/core/java/android/appwidget/AppWidgetHost.java b/core/java/android/appwidget/AppWidgetHost.java
index f7933d38..c62bf32 100644
--- a/core/java/android/appwidget/AppWidgetHost.java
+++ b/core/java/android/appwidget/AppWidgetHost.java
@@ -338,8 +338,8 @@
      */
     public final AppWidgetHostView createView(Context context, int appWidgetId,
             AppWidgetProviderInfo appWidget) {
-        final int userId = context.getUserId();
-        AppWidgetHostView view = onCreateView(context, appWidgetId, appWidget);
+        final int userId = mContext.getUserId();
+        AppWidgetHostView view = onCreateView(mContext, appWidgetId, appWidget);
         view.setUserId(userId);
         view.setOnClickHandler(mOnClickHandler);
         view.setAppWidget(appWidgetId, appWidget);
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java
index e68d23a..1166e4b 100644
--- a/core/java/android/appwidget/AppWidgetManager.java
+++ b/core/java/android/appwidget/AppWidgetManager.java
@@ -49,8 +49,8 @@
     static final String TAG = "AppWidgetManager";
 
     /**
-     * Send this from your {@link AppWidgetHost} activity when you want to pick an AppWidget to display.
-     * The AppWidget picker activity will be launched.
+     * Activity action to launch from your {@link AppWidgetHost} activity when you want to
+     * pick an AppWidget to display.  The AppWidget picker activity will be launched.
      * <p>
      * You must supply the following extras:
      * <table>
@@ -89,8 +89,8 @@
             ACTION_KEYGUARD_APPWIDGET_PICK = "android.appwidget.action.KEYGUARD_APPWIDGET_PICK";
 
     /**
-     * Send this from your {@link AppWidgetHost} activity when you want to bind an AppWidget to
-     * display and bindAppWidgetIdIfAllowed returns false.
+     * Activity action to launch from your {@link AppWidgetHost} activity when you want to bind
+     * an AppWidget to display and bindAppWidgetIdIfAllowed returns false.
      * <p>
      * You must supply the following extras:
      * <table>
@@ -269,6 +269,9 @@
     /**
      * Sent when the custom extras for an AppWidget change.
      *
+     * <p class="note">This is a protected intent that can only be sent
+     * by the system.
+     *
      * @see AppWidgetProvider#onAppWidgetOptionsChanged
      *      AppWidgetProvider.onAppWidgetOptionsChanged(Context context,
      *      AppWidgetManager appWidgetManager, int appWidgetId, Bundle newExtras)
@@ -278,6 +281,9 @@
     /**
      * Sent when an instance of an AppWidget is deleted from its host.
      *
+     * <p class="note">This is a protected intent that can only be sent
+     * by the system.
+     *
      * @see AppWidgetProvider#onDeleted AppWidgetProvider.onDeleted(Context context, int[] appWidgetIds)
      */
     public static final String ACTION_APPWIDGET_DELETED = "android.appwidget.action.APPWIDGET_DELETED";
@@ -285,6 +291,9 @@
     /**
      * Sent when an instance of an AppWidget is removed from the last host.
      *
+     * <p class="note">This is a protected intent that can only be sent
+     * by the system.
+     *
      * @see AppWidgetProvider#onEnabled AppWidgetProvider.onEnabled(Context context)
      */
     public static final String ACTION_APPWIDGET_DISABLED = "android.appwidget.action.APPWIDGET_DISABLED";
@@ -294,6 +303,9 @@
      * This broadcast is sent at boot time if there is a AppWidgetHost installed with
      * an instance for this provider.
      *
+     * <p class="note">This is a protected intent that can only be sent
+     * by the system.
+     *
      * @see AppWidgetProvider#onEnabled AppWidgetProvider.onEnabled(Context context)
      */
     public static final String ACTION_APPWIDGET_ENABLED = "android.appwidget.action.APPWIDGET_ENABLED";
diff --git a/core/java/android/content/ContentProvider.java b/core/java/android/content/ContentProvider.java
index 4968268..cf627d7 100644
--- a/core/java/android/content/ContentProvider.java
+++ b/core/java/android/content/ContentProvider.java
@@ -609,7 +609,7 @@
         // selection statement with a dummy one that will always be false.
         // This way we will get a cursor back that has the correct structure
         // but contains no rows.
-        if (selection == null) {
+        if (selection == null || selection.isEmpty()) {
             selection = "'A' = 'B'";
         } else {
             selection = "'A' = 'B' AND (" + selection + ")";
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 8a9eed2..7dd76cd 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -45,6 +45,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 
 /**
  * Interface to global information about an application environment.  This is
@@ -286,6 +287,15 @@
     public abstract Context getApplicationContext();
 
     /**
+     * Returns the list of restrictions for the application, or null if there are no
+     * restrictions.
+     * @return
+     */
+    public List<RestrictionEntry> getApplicationRestrictions() {
+        return getApplicationContext().getApplicationRestrictions();
+    }
+
+    /**
      * Add a new {@link ComponentCallbacks} to the base application of the
      * Context, which will be called at the same times as the ComponentCallbacks
      * methods of activities and other components are called.  Note that you
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 53c47d2..e1461e3 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2415,6 +2415,15 @@
             "android.intent.action.PRE_BOOT_COMPLETED";
 
     /**
+     * Broadcast to a specific application to query any supported restrictions to impose
+     * on restricted users. The response should contain an extra {@link #EXTRA_RESTRICTIONS}
+     * which is of type <code>ArrayList&lt;RestrictionEntry&gt;</code>.
+     * @see RestrictionEntry
+     */
+    public static final String ACTION_GET_RESTRICTION_ENTRIES =
+            "android.intent.action.GET_RESTRICTION_ENTRIES";
+
+    /**
      * Sent the first time a user is starting, to allow system apps to
      * perform one time initialization.  (This will not be seen by third
      * party applications because a newly initialized user does not have any
@@ -3146,6 +3155,12 @@
     public static final String EXTRA_USER_HANDLE =
             "android.intent.extra.user_handle";
 
+    /**
+     * Extra used in the response from a BroadcastReceiver that handles
+     * {@link #ACTION_GET_RESTRICTION_ENTRIES}.
+     */
+    public static final String EXTRA_RESTRICTIONS = "android.intent.extra.restrictions";
+
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     // Intent flags (see mFlags variable).
diff --git a/core/java/android/content/RestrictionEntry.aidl b/core/java/android/content/RestrictionEntry.aidl
new file mode 100644
index 0000000..b93eee3
--- /dev/null
+++ b/core/java/android/content/RestrictionEntry.aidl
@@ -0,0 +1,20 @@
+/*
+**
+** Copyright 2013, 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.content;
+
+parcelable RestrictionEntry;
diff --git a/core/java/android/content/RestrictionEntry.java b/core/java/android/content/RestrictionEntry.java
new file mode 100644
index 0000000..97c4cb8
--- /dev/null
+++ b/core/java/android/content/RestrictionEntry.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2013 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.content;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.lang.annotation.Inherited;
+
+/**
+ * Applications can expose restrictions for a restricted user on a
+ * multiuser device. The administrator can configure these restrictions that will then be
+ * applied to the restricted user. Each RestrictionsEntry is one configurable restriction.
+ * <p/>
+ * Any application that chooses to expose such restrictions does so by implementing a
+ * receiver that handles the {@link Intent#ACTION_GET_RESTRICTION_ENTRIES} action.
+ * The receiver then returns a result bundle that contains an entry called "restrictions", whose
+ * value is an ArrayList<RestrictionsEntry>.
+ */
+public class RestrictionEntry implements Parcelable {
+
+    /**
+     * A type of restriction. Use this one for information that needs to be transferred across
+     * but shouldn't be presented to the user in the UI.
+     */
+    public static final int TYPE_NULL         = 0;
+    /**
+     * A type of restriction. Use this for storing true/false values, typically presented as
+     * a checkbox in the UI.
+     */
+    public static final int TYPE_BOOLEAN      = 1;
+    /**
+     * A type of restriction. Use this for storing a string value, typically presented as
+     * a single-select list. The {@link #values} and {@link #choices} need to have the list of
+     * possible values and the corresponding localized strings, respectively, to present in the UI.
+     */
+    public static final int TYPE_CHOICE       = 2;
+    /**
+     * A type of restriction. Use this for storing a string value, typically presented as
+     * a single-select list. The {@link #values} and {@link #choices} need to have the list of
+     * possible values and the corresponding localized strings, respectively, to present in the UI.
+     * The presentation could imply that values in lower array indices are included when a
+     * particular value is chosen.
+     */
+    public static final int TYPE_CHOICE_LEVEL = 3;
+    /**
+     * A type of restriction. Use this for presenting a multi-select list where more than one
+     * entry can be selected, such as for choosing specific titles to white-list.
+     * The {@link #values} and {@link #choices} need to have the list of
+     * possible values and the corresponding localized strings, respectively, to present in the UI.
+     * Use {@link #getMultipleValues()} and {@link #setMultipleValues(String[])} to manipulate
+     * the selections.
+     */
+    public static final int TYPE_MULTI_SELECT = 4;
+
+    /** The type of restriction. */
+    public int type;
+
+    /** The unique key that identifies the restriction. */
+    public String key;
+
+    /** The user-visible title of the restriction. */
+    public String title;
+
+    /** The user-visible secondary description of the restriction. */
+    public String description;
+
+    /** The user-visible set of choices used for single-select and multi-select lists. */
+    public String [] choices;
+
+    /** The values corresponding to the user-visible choices. The value(s) of this entry will
+     * one or more of these, returned by {@link #getMultipleValues()} and
+     * {@link #getStringValue()}.
+     */
+    public String [] values;
+
+    /* The chosen value, whose content depends on the type of the restriction. */
+    private String currentValue;
+    /* List of selected choices in the multi-select case. */
+    private String[] currentValues;
+
+    /**
+     * Constructor for {@link #TYPE_CHOICE} and {@link #TYPE_CHOICE_LEVEL} types.
+     * @param key the unique key for this restriction
+     * @param value the current value
+     */
+    public RestrictionEntry(String key, String value) {
+        this.key = key;
+        this.currentValue = value;
+    }
+
+    /**
+     * Constructor for {@link #TYPE_BOOLEAN} type.
+     * @param key the unique key for this restriction
+     * @param value the current value
+     */
+    public RestrictionEntry(String key, boolean value) {
+        this.key = key;
+        setValue(value);
+    }
+
+    /**
+     * Constructor for {@link #TYPE_MULTI_SELECT} type.
+     * @param key the unique key for this restriction
+     * @param multipleValues the list of values that are currently selected
+     */
+    public RestrictionEntry(String key, String[] multipleValues) {
+        this.key = key;
+        this.currentValues = multipleValues;
+    }
+
+    /**
+     * Returns the current value. Null for {@link #TYPE_MULTI_SELECT} type.
+     * @return the current value
+     */
+    public String getStringValue() {
+        return currentValue;
+    }
+
+    /**
+     * Returns the list of current selections. Null if the type is not {@link #TYPE_MULTI_SELECT}.
+     * @return the list of current selections.
+     */
+    public String[] getMultipleValues() {
+        return currentValues;
+    }
+
+    /**
+     * Returns the current boolean value for entries of type {@link #TYPE_BOOLEAN}.
+     * @return the current value
+     */
+    public boolean getBooleanValue() {
+        return Boolean.parseBoolean(currentValue);
+    }
+
+    /**
+     * Set the current string value.
+     * @param s the current value
+     */
+    public void setValue(String s) {
+        currentValue = s;
+    }
+
+    /**
+     * Sets the current boolean value.
+     * @param b the current value
+     */
+    public void setValue(boolean b) {
+        currentValue = Boolean.toString(b);
+    }
+
+    /**
+     * Sets the current list of selected values.
+     * @param values the current list of selected values
+     */
+    public void setMultipleValues(String[] values) {
+        currentValues = values;
+    }
+
+    private boolean equalArrays(String[] one, String[] other) {
+        if (one.length != other.length) return false;
+        for (int i = 0; i < one.length; i++) {
+            if (!one[i].equals(other[i])) return false;
+        }
+        return true;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == this) return true;
+        if (!(o instanceof RestrictionEntry)) return false;
+        final RestrictionEntry other = (RestrictionEntry) o;
+        // Make sure that either currentValue matches or currentValues matches.
+        return type == other.type && key.equals(other.key)
+                &&
+                ((currentValues == null && other.currentValues == null
+                  && currentValue != null && currentValue.equals(other.currentValue))
+                 ||
+                 (currentValue == null && other.currentValue == null
+                  && currentValues != null && equalArrays(currentValues, other.currentValues)));
+    }
+
+    @Override
+    public int hashCode() {
+        int result = 17;
+        result = 31 * result + key.hashCode();
+        if (currentValue != null) {
+            result = 31 * result + currentValue.hashCode();
+        } else if (currentValues != null) {
+            for (String value : currentValues) {
+                if (value != null) {
+                    result = 31 * result + value.hashCode();
+                }
+            }
+        }
+        return result;
+    }
+
+    private String[] readArray(Parcel in) {
+        int count = in.readInt();
+        String[] values = new String[count];
+        for (int i = 0; i < count; i++) {
+            values[i] = in.readString();
+        }
+        return values;
+    }
+
+    public RestrictionEntry(Parcel in) {
+        type = in.readInt();
+        key = in.readString();
+        title = in.readString();
+        description = in.readString();
+        choices = readArray(in);
+        values = readArray(in);
+        currentValue = in.readString();
+        currentValues = readArray(in);
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    private void writeArray(Parcel dest, String[] values) {
+        if (values == null) {
+            dest.writeInt(0);
+        } else {
+            dest.writeInt(values.length);
+            for (int i = 0; i < values.length; i++) {
+                dest.writeString(values[i]);
+            }
+        }
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(type);
+        dest.writeString(key);
+        dest.writeString(title);
+        dest.writeString(description);
+        writeArray(dest, choices);
+        writeArray(dest, values);
+        dest.writeString(currentValue);
+        writeArray(dest, currentValues);
+    }
+
+    public static final Creator<RestrictionEntry> CREATOR = new Creator<RestrictionEntry>() {
+        public RestrictionEntry createFromParcel(Parcel source) {
+            return new RestrictionEntry(source);
+        }
+
+        public RestrictionEntry[] newArray(int size) {
+            return new RestrictionEntry[size];
+        }
+    };
+
+    @Override
+    public String toString() {
+        return "RestrictionsEntry {type=" + type + ", key=" + key + ", value=" + currentValue + "}";
+    }
+}
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 32cc7fd..02401dc 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -398,6 +398,15 @@
     public String[] resourceDirs;
 
     /**
+     * String retrieved from the seinfo tag found in selinux policy. This value
+     * is useful in setting an SELinux security context on the process as well
+     * as its data directory.
+     *
+     * {@hide}
+     */
+    public String seinfo;
+
+    /**
      * Paths to all shared libraries this application is linked against.  This
      * field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
      * PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
@@ -477,6 +486,9 @@
         if (resourceDirs != null) {
             pw.println(prefix + "resourceDirs=" + resourceDirs);
         }
+        if (seinfo != null) {
+            pw.println(prefix + "seinfo=" + seinfo);
+        }
         pw.println(prefix + "dataDir=" + dataDir);
         if (sharedLibraryFiles != null) {
             pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
@@ -544,6 +556,7 @@
         publicSourceDir = orig.publicSourceDir;
         nativeLibraryDir = orig.nativeLibraryDir;
         resourceDirs = orig.resourceDirs;
+        seinfo = orig.seinfo;
         sharedLibraryFiles = orig.sharedLibraryFiles;
         dataDir = orig.dataDir;
         uid = orig.uid;
@@ -583,6 +596,7 @@
         dest.writeString(publicSourceDir);
         dest.writeString(nativeLibraryDir);
         dest.writeStringArray(resourceDirs);
+        dest.writeString(seinfo);
         dest.writeStringArray(sharedLibraryFiles);
         dest.writeString(dataDir);
         dest.writeInt(uid);
@@ -621,6 +635,7 @@
         publicSourceDir = source.readString();
         nativeLibraryDir = source.readString();
         resourceDirs = source.readStringArray();
+        seinfo = source.readString();
         sharedLibraryFiles = source.readStringArray();
         dataDir = source.readString();
         uid = source.readInt();
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 85f7aa5..77ca7f6 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -217,7 +217,10 @@
      * @hide
      */
     public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY;
-    
+
+    /** @hide */
+    public boolean requiredForAllUsers;
+
     public PackageInfo() {
     }
 
@@ -258,6 +261,7 @@
         dest.writeTypedArray(configPreferences, parcelableFlags);
         dest.writeTypedArray(reqFeatures, parcelableFlags);
         dest.writeInt(installLocation);
+        dest.writeInt(requiredForAllUsers ? 1 : 0);
     }
 
     public static final Parcelable.Creator<PackageInfo> CREATOR
@@ -296,5 +300,6 @@
         configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR);
         reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
         installLocation = source.readInt();
+        requiredForAllUsers = source.readInt() != 0;
     }
 }
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 0d463ee..0bea138 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1145,6 +1145,29 @@
 
     /**
      * Feature for {@link #getSystemAvailableFeatures} and
+     * {@link #hasSystemFeature}: The device supports app widgets.
+     */
+    @SdkConstant(SdkConstantType.FEATURE)
+    public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
+
+    /**
+     * Feature for {@link #getSystemAvailableFeatures} and
+     * {@link #hasSystemFeature}: The device supports a home screen that is replaceable
+     * by third party applications.
+     */
+    @SdkConstant(SdkConstantType.FEATURE)
+    public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
+
+    /**
+     * Feature for {@link #getSystemAvailableFeatures} and
+     * {@link #hasSystemFeature}: The device supports adding new input methods implemented
+     * with the {@link android.inputmethodservice.InputMethodService} API.
+     */
+    @SdkConstant(SdkConstantType.FEATURE)
+    public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
+
+    /**
+     * Feature for {@link #getSystemAvailableFeatures} and
      * {@link #hasSystemFeature}: The device supports WiFi (802.11) networking.
      */
     @SdkConstant(SdkConstantType.FEATURE)
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 5eac903..149b8e5 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -289,6 +289,7 @@
         pi.sharedUserLabel = p.mSharedUserLabel;
         pi.applicationInfo = generateApplicationInfo(p, flags, state, userId);
         pi.installLocation = p.installLocation;
+        pi.requiredForAllUsers = p.mRequiredForAllUsers;
         pi.firstInstallTime = firstInstallTime;
         pi.lastUpdateTime = lastUpdateTime;
         if ((flags&PackageManager.GET_GIDS) != 0) {
@@ -1760,6 +1761,11 @@
                     false)) {
                 ai.flags |= ApplicationInfo.FLAG_PERSISTENT;
             }
+            if (sa.getBoolean(
+                    com.android.internal.R.styleable.AndroidManifestApplication_requiredForAllUsers,
+                    false)) {
+                owner.mRequiredForAllUsers = true;
+            }
         }
 
         if (sa.getBoolean(
@@ -3271,6 +3277,9 @@
 
         public int installLocation;
 
+        /* An app that's required for all users and cannot be uninstalled for a user */
+        public boolean mRequiredForAllUsers;
+
         /**
          * Digest suitable for comparing whether this package's manifest is the
          * same as another.
diff --git a/core/java/android/inputmethodservice/AbstractInputMethodService.java b/core/java/android/inputmethodservice/AbstractInputMethodService.java
index 3c3182a..3531926 100644
--- a/core/java/android/inputmethodservice/AbstractInputMethodService.java
+++ b/core/java/android/inputmethodservice/AbstractInputMethodService.java
@@ -126,11 +126,12 @@
             mRevoked = true;
             mEnabled = false;
         }
-        
+
         /**
          * Take care of dispatching incoming key events to the appropriate
          * callbacks on the service, and tell the client when this is done.
          */
+        @Override
         public void dispatchKeyEvent(int seq, KeyEvent event, EventCallback callback) {
             boolean handled = event.dispatch(AbstractInputMethodService.this,
                     mDispatcherState, this);
@@ -143,6 +144,7 @@
          * Take care of dispatching incoming trackball events to the appropriate
          * callbacks on the service, and tell the client when this is done.
          */
+        @Override
         public void dispatchTrackballEvent(int seq, MotionEvent event, EventCallback callback) {
             boolean handled = onTrackballEvent(event);
             if (callback != null) {
@@ -154,6 +156,7 @@
          * Take care of dispatching incoming generic motion events to the appropriate
          * callbacks on the service, and tell the client when this is done.
          */
+        @Override
         public void dispatchGenericMotionEvent(int seq, MotionEvent event, EventCallback callback) {
             boolean handled = onGenericMotionEvent(event);
             if (callback != null) {
diff --git a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
index d78262b6..726dcec 100644
--- a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
@@ -18,15 +18,20 @@
 
 import com.android.internal.os.HandlerCaller;
 import com.android.internal.os.SomeArgs;
-import com.android.internal.view.IInputMethodCallback;
 import com.android.internal.view.IInputMethodSession;
 
 import android.content.Context;
 import android.graphics.Rect;
 import android.os.Bundle;
+import android.os.Looper;
 import android.os.Message;
 import android.os.RemoteException;
 import android.util.Log;
+import android.util.SparseArray;
+import android.view.InputChannel;
+import android.view.InputDevice;
+import android.view.InputEvent;
+import android.view.InputEventReceiver;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.inputmethod.CompletionInfo;
@@ -36,14 +41,10 @@
 class IInputMethodSessionWrapper extends IInputMethodSession.Stub
         implements HandlerCaller.Callback {
     private static final String TAG = "InputMethodWrapper";
-    private static final boolean DEBUG = false;
     
     private static final int DO_FINISH_INPUT = 60;
     private static final int DO_DISPLAY_COMPLETIONS = 65;
     private static final int DO_UPDATE_EXTRACTED_TEXT = 67;
-    private static final int DO_DISPATCH_KEY_EVENT = 70;
-    private static final int DO_DISPATCH_TRACKBALL_EVENT = 80;
-    private static final int DO_DISPATCH_GENERIC_MOTION_EVENT = 85;
     private static final int DO_UPDATE_SELECTION = 90;
     private static final int DO_UPDATE_CURSOR = 95;
     private static final int DO_APP_PRIVATE_COMMAND = 100;
@@ -53,34 +54,30 @@
 
     HandlerCaller mCaller;
     InputMethodSession mInputMethodSession;
-    
-    // NOTE: we should have a cache of these.
-    static class InputMethodEventCallbackWrapper implements InputMethodSession.EventCallback {
-        final IInputMethodCallback mCb;
-        InputMethodEventCallbackWrapper(IInputMethodCallback cb) {
-            mCb = cb;
-        }
-        public void finishedEvent(int seq, boolean handled) {
-            try {
-                mCb.finishedEvent(seq, handled);
-            } catch (RemoteException e) {
-            }
-        }
-    }
-    
+    InputChannel mChannel;
+    ImeInputEventReceiver mReceiver;
+
     public IInputMethodSessionWrapper(Context context,
-            InputMethodSession inputMethodSession) {
+            InputMethodSession inputMethodSession, InputChannel channel) {
         mCaller = new HandlerCaller(context, null,
                 this, true /*asyncHandler*/);
         mInputMethodSession = inputMethodSession;
+        mChannel = channel;
+        if (channel != null) {
+            mReceiver = new ImeInputEventReceiver(channel, context.getMainLooper());
+        }
     }
 
     public InputMethodSession getInternalInputMethodSession() {
         return mInputMethodSession;
     }
 
+    @Override
     public void executeMessage(Message msg) {
-        if (mInputMethodSession == null) return;
+        if (mInputMethodSession == null) {
+            // The session has been finished.
+            return;
+        }
 
         switch (msg.what) {
             case DO_FINISH_INPUT:
@@ -93,33 +90,6 @@
                 mInputMethodSession.updateExtractedText(msg.arg1,
                         (ExtractedText)msg.obj);
                 return;
-            case DO_DISPATCH_KEY_EVENT: {
-                SomeArgs args = (SomeArgs)msg.obj;
-                mInputMethodSession.dispatchKeyEvent(msg.arg1,
-                        (KeyEvent)args.arg1,
-                        new InputMethodEventCallbackWrapper(
-                                (IInputMethodCallback)args.arg2));
-                args.recycle();
-                return;
-            }
-            case DO_DISPATCH_TRACKBALL_EVENT: {
-                SomeArgs args = (SomeArgs)msg.obj;
-                mInputMethodSession.dispatchTrackballEvent(msg.arg1,
-                        (MotionEvent)args.arg1,
-                        new InputMethodEventCallbackWrapper(
-                                (IInputMethodCallback)args.arg2));
-                args.recycle();
-                return;
-            }
-            case DO_DISPATCH_GENERIC_MOTION_EVENT: {
-                SomeArgs args = (SomeArgs)msg.obj;
-                mInputMethodSession.dispatchGenericMotionEvent(msg.arg1,
-                        (MotionEvent)args.arg1,
-                        new InputMethodEventCallbackWrapper(
-                                (IInputMethodCallback)args.arg2));
-                args.recycle();
-                return;
-            }
             case DO_UPDATE_SELECTION: {
                 SomeArgs args = (SomeArgs)msg.obj;
                 mInputMethodSession.updateSelection(args.argi1, args.argi2,
@@ -143,7 +113,7 @@
                 return;
             }
             case DO_FINISH_SESSION: {
-                mInputMethodSession = null;
+                doFinishSession();
                 return;
             }
             case DO_VIEW_CLICKED: {
@@ -153,37 +123,37 @@
         }
         Log.w(TAG, "Unhandled message code: " + msg.what);
     }
-    
+
+    private void doFinishSession() {
+        mInputMethodSession = null;
+        if (mReceiver != null) {
+            mReceiver.dispose();
+            mReceiver = null;
+        }
+        if (mChannel != null) {
+            mChannel.dispose();
+            mChannel = null;
+        }
+    }
+
+    @Override
     public void finishInput() {
         mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_INPUT));
     }
 
+    @Override
     public void displayCompletions(CompletionInfo[] completions) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(
                 DO_DISPLAY_COMPLETIONS, completions));
     }
-    
+
+    @Override
     public void updateExtractedText(int token, ExtractedText text) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageIO(
                 DO_UPDATE_EXTRACTED_TEXT, token, text));
     }
-    
-    public void dispatchKeyEvent(int seq, KeyEvent event, IInputMethodCallback callback) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_DISPATCH_KEY_EVENT, seq,
-                event, callback));
-    }
 
-    public void dispatchTrackballEvent(int seq, MotionEvent event, IInputMethodCallback callback) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_DISPATCH_TRACKBALL_EVENT, seq,
-                event, callback));
-    }
-
-    public void dispatchGenericMotionEvent(int seq, MotionEvent event,
-            IInputMethodCallback callback) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_DISPATCH_GENERIC_MOTION_EVENT, seq,
-                event, callback));
-    }
-
+    @Override
     public void updateSelection(int oldSelStart, int oldSelEnd,
             int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageIIIIII(DO_UPDATE_SELECTION,
@@ -191,24 +161,74 @@
                 candidatesStart, candidatesEnd));
     }
 
+    @Override
     public void viewClicked(boolean focusChanged) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageI(DO_VIEW_CLICKED, focusChanged ? 1 : 0));
+        mCaller.executeOrSendMessage(
+                mCaller.obtainMessageI(DO_VIEW_CLICKED, focusChanged ? 1 : 0));
     }
 
+    @Override
     public void updateCursor(Rect newCursor) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_UPDATE_CURSOR,
-                newCursor));
-    }
-    
-    public void appPrivateCommand(String action, Bundle data) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_APP_PRIVATE_COMMAND, action, data));
-    }
-    
-    public void toggleSoftInput(int showFlags, int hideFlags) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageII(DO_TOGGLE_SOFT_INPUT, showFlags, hideFlags));
+        mCaller.executeOrSendMessage(
+                mCaller.obtainMessageO(DO_UPDATE_CURSOR, newCursor));
     }
 
+    @Override
+    public void appPrivateCommand(String action, Bundle data) {
+        mCaller.executeOrSendMessage(
+                mCaller.obtainMessageOO(DO_APP_PRIVATE_COMMAND, action, data));
+    }
+
+    @Override
+    public void toggleSoftInput(int showFlags, int hideFlags) {
+        mCaller.executeOrSendMessage(
+                mCaller.obtainMessageII(DO_TOGGLE_SOFT_INPUT, showFlags, hideFlags));
+    }
+
+    @Override
     public void finishSession() {
         mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_FINISH_SESSION));
     }
+
+    private final class ImeInputEventReceiver extends InputEventReceiver
+            implements InputMethodSession.EventCallback {
+        private final SparseArray<InputEvent> mPendingEvents = new SparseArray<InputEvent>();
+
+        public ImeInputEventReceiver(InputChannel inputChannel, Looper looper) {
+            super(inputChannel, looper);
+        }
+
+        @Override
+        public void onInputEvent(InputEvent event) {
+            if (mInputMethodSession == null) {
+                // The session has been finished.
+                finishInputEvent(event, false);
+                return;
+            }
+
+            final int seq = event.getSequenceNumber();
+            mPendingEvents.put(seq, event);
+            if (event instanceof KeyEvent) {
+                KeyEvent keyEvent = (KeyEvent)event;
+                mInputMethodSession.dispatchKeyEvent(seq, keyEvent, this);
+            } else {
+                MotionEvent motionEvent = (MotionEvent)event;
+                if (motionEvent.isFromSource(InputDevice.SOURCE_CLASS_TRACKBALL)) {
+                    mInputMethodSession.dispatchTrackballEvent(seq, motionEvent, this);
+                } else {
+                    mInputMethodSession.dispatchGenericMotionEvent(seq, motionEvent, this);
+                }
+            }
+        }
+
+        @Override
+        public void finishedEvent(int seq, boolean handled) {
+            int index = mPendingEvents.indexOfKey(seq);
+            if (index >= 0) {
+                InputEvent event = mPendingEvents.valueAt(index);
+                mPendingEvents.removeAt(index);
+                finishInputEvent(event, handled);
+            }
+        }
+    }
 }
diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java
index 1128230..9306373 100644
--- a/core/java/android/inputmethodservice/IInputMethodWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java
@@ -20,8 +20,8 @@
 import com.android.internal.os.SomeArgs;
 import com.android.internal.view.IInputContext;
 import com.android.internal.view.IInputMethod;
-import com.android.internal.view.IInputMethodCallback;
 import com.android.internal.view.IInputMethodSession;
+import com.android.internal.view.IInputSessionCallback;
 import com.android.internal.view.InputConnectionWrapper;
 
 import android.content.Context;
@@ -32,6 +32,7 @@
 import android.os.RemoteException;
 import android.os.ResultReceiver;
 import android.util.Log;
+import android.view.InputChannel;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputBinding;
 import android.view.inputmethod.InputConnection;
@@ -53,7 +54,6 @@
 class IInputMethodWrapper extends IInputMethod.Stub
         implements HandlerCaller.Callback {
     private static final String TAG = "InputMethodWrapper";
-    private static final boolean DEBUG = false;
 
     private static final int DO_DUMP = 1;
     private static final int DO_ATTACH_TOKEN = 10;
@@ -78,20 +78,29 @@
     }
     
     // NOTE: we should have a cache of these.
-    static class InputMethodSessionCallbackWrapper implements InputMethod.SessionCallback {
+    static final class InputMethodSessionCallbackWrapper implements InputMethod.SessionCallback {
         final Context mContext;
-        final IInputMethodCallback mCb;
-        InputMethodSessionCallbackWrapper(Context context, IInputMethodCallback cb) {
+        final InputChannel mChannel;
+        final IInputSessionCallback mCb;
+
+        InputMethodSessionCallbackWrapper(Context context, InputChannel channel,
+                IInputSessionCallback cb) {
             mContext = context;
+            mChannel = channel;
             mCb = cb;
         }
+
+        @Override
         public void sessionCreated(InputMethodSession session) {
             try {
                 if (session != null) {
                     IInputMethodSessionWrapper wrap =
-                            new IInputMethodSessionWrapper(mContext, session);
+                            new IInputMethodSessionWrapper(mContext, session, mChannel);
                     mCb.sessionCreated(wrap);
                 } else {
+                    if (mChannel != null) {
+                        mChannel.dispose();
+                    }
                     mCb.sessionCreated(null);
                 }
             } catch (RemoteException e) {
@@ -112,6 +121,7 @@
         return mInputMethod.get();
     }
 
+    @Override
     public void executeMessage(Message msg) {
         InputMethod inputMethod = mInputMethod.get();
         // Need a valid reference to the inputMethod for everything except a dump.
@@ -174,8 +184,11 @@
                 return;
             }
             case DO_CREATE_SESSION: {
+                SomeArgs args = (SomeArgs)msg.obj;
                 inputMethod.createSession(new InputMethodSessionCallbackWrapper(
-                        mCaller.mContext, (IInputMethodCallback)msg.obj));
+                        mCaller.mContext, (InputChannel)args.arg1,
+                        (IInputSessionCallback)args.arg2));
+                args.recycle();
                 return;
             }
             case DO_SET_SESSION_ENABLED:
@@ -197,8 +210,9 @@
         }
         Log.w(TAG, "Unhandled message code: " + msg.what);
     }
-    
-    @Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+
+    @Override
+    protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
         AbstractInputMethodService target = mTarget.get();
         if (target == null) {
             return;
@@ -224,10 +238,12 @@
         }
     }
 
+    @Override
     public void attachToken(IBinder token) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token));
     }
-    
+
+    @Override
     public void bindInput(InputBinding binding) {
         InputConnection ic = new InputConnectionWrapper(
                 IInputContext.Stub.asInterface(binding.getConnectionToken()));
@@ -235,24 +251,30 @@
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SET_INPUT_CONTEXT, nu));
     }
 
+    @Override
     public void unbindInput() {
         mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_UNSET_INPUT_CONTEXT));
     }
 
+    @Override
     public void startInput(IInputContext inputContext, EditorInfo attribute) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_START_INPUT,
                 inputContext, attribute));
     }
 
+    @Override
     public void restartInput(IInputContext inputContext, EditorInfo attribute) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_RESTART_INPUT,
                 inputContext, attribute));
     }
 
-    public void createSession(IInputMethodCallback callback) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CREATE_SESSION, callback));
+    @Override
+    public void createSession(InputChannel channel, IInputSessionCallback callback) {
+        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_CREATE_SESSION,
+                channel, callback));
     }
 
+    @Override
     public void setSessionEnabled(IInputMethodSession session, boolean enabled) {
         try {
             InputMethodSession ls = ((IInputMethodSessionWrapper)
@@ -263,7 +285,8 @@
             Log.w(TAG, "Incoming session not of correct type: " + session, e);
         }
     }
-    
+
+    @Override
     public void revokeSession(IInputMethodSession session) {
         try {
             InputMethodSession ls = ((IInputMethodSessionWrapper)
@@ -273,17 +296,20 @@
             Log.w(TAG, "Incoming session not of correct type: " + session, e);
         }
     }
-    
+
+    @Override
     public void showSoftInput(int flags, ResultReceiver resultReceiver) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_SHOW_SOFT_INPUT,
                 flags, resultReceiver));
     }
-    
+
+    @Override
     public void hideSoftInput(int flags, ResultReceiver resultReceiver) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_HIDE_SOFT_INPUT,
                 flags, resultReceiver));
     }
 
+    @Override
     public void changeInputMethodSubtype(InputMethodSubtype subtype) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CHANGE_INPUTMETHOD_SUBTYPE,
                 subtype));
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 5a9cde1..2b15afd 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -427,6 +427,7 @@
                 } catch (BadTokenException e) {
                     if (DEBUG) Log.v(TAG, "BadTokenException: IME is done.");
                     mWindowVisible = false;
+                    mWindowAdded = false;
                 }
             }
             // If user uses hard keyboard, IME button should always be shown.
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 4457a22..eedc372 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -119,6 +119,15 @@
         return mIfaceName;
     }
 
+    public Collection<String> getAllInterfaceNames() {
+        Collection interfaceNames = new ArrayList<String>(mStackedLinks.size() + 1);
+        if (mIfaceName != null) interfaceNames.add(new String(mIfaceName));
+        for (LinkProperties stacked: mStackedLinks.values()) {
+            interfaceNames.addAll(stacked.getAllInterfaceNames());
+        }
+        return interfaceNames;
+    }
+
     public Collection<InetAddress> getAddresses() {
         Collection<InetAddress> addresses = new ArrayList<InetAddress>();
         for (LinkAddress linkAddress : mLinkAddresses) {
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java
index ce1276f..786439e5 100644
--- a/core/java/android/net/TrafficStats.java
+++ b/core/java/android/net/TrafficStats.java
@@ -119,6 +119,8 @@
      * Tags between {@code 0xFFFFFF00} and {@code 0xFFFFFFFF} are reserved and
      * used internally by system services like {@link DownloadManager} when
      * performing traffic on behalf of an application.
+     *
+     * @see #clearThreadStatsTag()
      */
     public static void setThreadStatsTag(int tag) {
         NetworkManagementSocketTagger.setThreadSocketStatsTag(tag);
@@ -128,11 +130,19 @@
      * Get the active tag used when accounting {@link Socket} traffic originating
      * from the current thread. Only one active tag per thread is supported.
      * {@link #tagSocket(Socket)}.
+     *
+     * @see #setThreadStatsTag(int)
      */
     public static int getThreadStatsTag() {
         return NetworkManagementSocketTagger.getThreadSocketStatsTag();
     }
 
+    /**
+     * Clear any active tag set to account {@link Socket} traffic originating
+     * from the current thread.
+     *
+     * @see #setThreadStatsTag(int)
+     */
     public static void clearThreadStatsTag() {
         NetworkManagementSocketTagger.setThreadSocketStatsTag(-1);
     }
@@ -148,7 +158,7 @@
      * To take effect, caller must hold
      * {@link android.Manifest.permission#UPDATE_DEVICE_STATS} permission.
      *
-     * {@hide}
+     * @hide
      */
     public static void setThreadStatsUid(int uid) {
         NetworkManagementSocketTagger.setThreadSocketStatsUid(uid);
@@ -260,10 +270,13 @@
     }
 
     /**
-     * Get the total number of packets transmitted through the mobile interface.
-     *
-     * @return number of packets.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of packets transmitted across mobile networks since device
+     * boot. Counts packets across all mobile network interfaces, and always
+     * increases monotonically since device boot. Statistics are measured at the
+     * network layer, so they include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getMobileTxPackets() {
         long total = 0;
@@ -274,10 +287,13 @@
     }
 
     /**
-     * Get the total number of packets received through the mobile interface.
-     *
-     * @return number of packets.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of packets received across mobile networks since device
+     * boot. Counts packets across all mobile network interfaces, and always
+     * increases monotonically since device boot. Statistics are measured at the
+     * network layer, so they include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getMobileRxPackets() {
         long total = 0;
@@ -288,10 +304,13 @@
     }
 
     /**
-     * Get the total number of bytes transmitted through the mobile interface.
-     *
-     * @return number of bytes.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of bytes transmitted across mobile networks since device
+     * boot. Counts packets across all mobile network interfaces, and always
+     * increases monotonically since device boot. Statistics are measured at the
+     * network layer, so they include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getMobileTxBytes() {
         long total = 0;
@@ -302,10 +321,13 @@
     }
 
     /**
-     * Get the total number of bytes received through the mobile interface.
-     *
-     * @return number of bytes.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of bytes received across mobile networks since device boot.
+     * Counts packets across all mobile network interfaces, and always increases
+     * monotonically since device boot. Statistics are measured at the network
+     * layer, so they include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getMobileRxBytes() {
         long total = 0;
@@ -339,85 +361,73 @@
         return total;
     }
 
-    /**
-     * Get the total number of packets transmitted through the specified interface.
-     *
-     * @return number of packets.  If the statistics are not supported by this interface,
-     * {@link #UNSUPPORTED} will be returned.
-     * @hide
-     */
+    /** {@hide} */
     public static long getTxPackets(String iface) {
         return nativeGetIfaceStat(iface, TYPE_TX_PACKETS);
     }
 
-    /**
-     * Get the total number of packets received through the specified interface.
-     *
-     * @return number of packets.  If the statistics are not supported by this interface,
-     * {@link #UNSUPPORTED} will be returned.
-     * @hide
-     */
+    /** {@hide} */
     public static long getRxPackets(String iface) {
         return nativeGetIfaceStat(iface, TYPE_RX_PACKETS);
     }
 
-    /**
-     * Get the total number of bytes transmitted through the specified interface.
-     *
-     * @return number of bytes.  If the statistics are not supported by this interface,
-     * {@link #UNSUPPORTED} will be returned.
-     * @hide
-     */
+    /** {@hide} */
     public static long getTxBytes(String iface) {
         return nativeGetIfaceStat(iface, TYPE_TX_BYTES);
     }
 
-    /**
-     * Get the total number of bytes received through the specified interface.
-     *
-     * @return number of bytes.  If the statistics are not supported by this interface,
-     * {@link #UNSUPPORTED} will be returned.
-     * @hide
-     */
+    /** {@hide} */
     public static long getRxBytes(String iface) {
         return nativeGetIfaceStat(iface, TYPE_RX_BYTES);
     }
 
     /**
-     * Get the total number of packets sent through all network interfaces.
-     *
-     * @return the number of packets.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of packets transmitted since device boot. Counts packets
+     * across all network interfaces, and always increases monotonically since
+     * device boot. Statistics are measured at the network layer, so they
+     * include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getTotalTxPackets() {
         return nativeGetTotalStat(TYPE_TX_PACKETS);
     }
 
     /**
-     * Get the total number of packets received through all network interfaces.
-     *
-     * @return number of packets.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of packets received since device boot. Counts packets
+     * across all network interfaces, and always increases monotonically since
+     * device boot. Statistics are measured at the network layer, so they
+     * include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getTotalRxPackets() {
         return nativeGetTotalStat(TYPE_RX_PACKETS);
     }
 
     /**
-     * Get the total number of bytes sent through all network interfaces.
-     *
-     * @return number of bytes.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of bytes transmitted since device boot. Counts packets
+     * across all network interfaces, and always increases monotonically since
+     * device boot. Statistics are measured at the network layer, so they
+     * include both TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getTotalTxBytes() {
         return nativeGetTotalStat(TYPE_TX_BYTES);
     }
 
     /**
-     * Get the total number of bytes received through all network interfaces.
-     *
-     * @return number of bytes.  If the statistics are not supported by this device,
-     * {@link #UNSUPPORTED} will be returned.
+     * Return number of bytes received since device boot. Counts packets across
+     * all network interfaces, and always increases monotonically since device
+     * boot. Statistics are measured at the network layer, so they include both
+     * TCP and UDP usage.
+     * <p>
+     * Before {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, this may
+     * return {@link #UNSUPPORTED} on devices where statistics aren't available.
      */
     public static long getTotalRxBytes() {
         return nativeGetTotalStat(TYPE_RX_BYTES);
@@ -580,6 +590,7 @@
      * special permission.
      */
     private static NetworkStats getDataLayerSnapshotForUid(Context context) {
+        // TODO: take snapshot locally, since proc file is now visible
         final int uid = android.os.Process.myUid();
         try {
             return getStatsService().getDataLayerSnapshotForUid(uid);
diff --git a/core/java/android/nfc/BeamShareData.aidl b/core/java/android/nfc/BeamShareData.aidl
new file mode 100644
index 0000000..a47e240
--- /dev/null
+++ b/core/java/android/nfc/BeamShareData.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2013 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.nfc;
+
+parcelable BeamShareData;
diff --git a/core/java/android/nfc/BeamShareData.java b/core/java/android/nfc/BeamShareData.java
new file mode 100644
index 0000000..c30ba14
--- /dev/null
+++ b/core/java/android/nfc/BeamShareData.java
@@ -0,0 +1,62 @@
+package android.nfc;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Class to IPC data to be shared over Android Beam.
+ * Allows bundling NdefMessage, Uris and flags in a single
+ * IPC call. This is important as we want to reduce the
+ * amount of IPC calls at "touch time".
+ * @hide
+ */
+public final class BeamShareData implements Parcelable {
+    public final NdefMessage ndefMessage;
+    public final Uri[] uris;
+    public final int flags;
+
+    public BeamShareData(NdefMessage msg, Uri[] uris, int flags) {
+        this.ndefMessage = msg;
+        this.uris = uris;
+        this.flags = flags;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        int urisLength = (uris != null) ? uris.length : 0;
+        dest.writeParcelable(ndefMessage, 0);
+        dest.writeInt(urisLength);
+        if (urisLength > 0) {
+            dest.writeTypedArray(uris, 0);
+        }
+        dest.writeInt(this.flags);
+    }
+
+    public static final Parcelable.Creator<BeamShareData> CREATOR =
+            new Parcelable.Creator<BeamShareData>() {
+        @Override
+        public BeamShareData createFromParcel(Parcel source) {
+            Uri[] uris = null;
+            NdefMessage msg = source.readParcelable(NdefMessage.class.getClassLoader());
+            int numUris = source.readInt();
+            if (numUris > 0) {
+                uris = new Uri[numUris];
+                source.readTypedArray(uris, Uri.CREATOR);
+            }
+            int flags = source.readInt();
+
+            return new BeamShareData(msg, uris, flags);
+        }
+
+        @Override
+        public BeamShareData[] newArray(int size) {
+            return new BeamShareData[size];
+        }
+    };
+}
diff --git a/core/java/android/nfc/INdefPushCallback.aidl b/core/java/android/nfc/INdefPushCallback.aidl
index 1c6d5d0..16771dc 100644
--- a/core/java/android/nfc/INdefPushCallback.aidl
+++ b/core/java/android/nfc/INdefPushCallback.aidl
@@ -16,15 +16,13 @@
 
 package android.nfc;
 
-import android.nfc.NdefMessage;
-import android.net.Uri;
+import android.nfc.BeamShareData;
 
 /**
  * @hide
  */
 interface INdefPushCallback
 {
-    NdefMessage createMessage();
-    Uri[] getUris();
+    BeamShareData createBeamShareData();
     void onNdefPushComplete();
 }
diff --git a/core/java/android/nfc/NfcActivityManager.java b/core/java/android/nfc/NfcActivityManager.java
index 7c3123f..10183c0 100644
--- a/core/java/android/nfc/NfcActivityManager.java
+++ b/core/java/android/nfc/NfcActivityManager.java
@@ -110,6 +110,7 @@
         NfcAdapter.OnNdefPushCompleteCallback onNdefPushCompleteCallback = null;
         NfcAdapter.CreateBeamUrisCallback uriCallback = null;
         Uri[] uris = null;
+        int flags = 0;
         public NfcActivityState(Activity activity) {
             if (activity.getWindow().isDestroyed()) {
                 throw new IllegalStateException("activity is already destroyed");
@@ -215,11 +216,12 @@
         }
     }
 
-    public void setNdefPushMessage(Activity activity, NdefMessage message) {
+    public void setNdefPushMessage(Activity activity, NdefMessage message, int flags) {
         boolean isResumed;
         synchronized (NfcActivityManager.this) {
             NfcActivityState state = getActivityState(activity);
             state.ndefMessage = message;
+            state.flags = flags;
             isResumed = state.resumed;
         }
         if (isResumed) {
@@ -228,11 +230,12 @@
     }
 
     public void setNdefPushMessageCallback(Activity activity,
-            NfcAdapter.CreateNdefMessageCallback callback) {
+            NfcAdapter.CreateNdefMessageCallback callback, int flags) {
         boolean isResumed;
         synchronized (NfcActivityManager.this) {
             NfcActivityState state = getActivityState(activity);
             state.ndefMessageCallback = callback;
+            state.flags = flags;
             isResumed = state.resumed;
         }
         if (isResumed) {
@@ -267,38 +270,29 @@
 
     /** Callback from NFC service, usually on binder thread */
     @Override
-    public NdefMessage createMessage() {
-        NfcAdapter.CreateNdefMessageCallback callback;
+    public BeamShareData createBeamShareData() {
+        NfcAdapter.CreateNdefMessageCallback ndefCallback;
+        NfcAdapter.CreateBeamUrisCallback urisCallback;
         NdefMessage message;
-        synchronized (NfcActivityManager.this) {
-            NfcActivityState state = findResumedActivityState();
-            if (state == null) return null;
-
-            callback = state.ndefMessageCallback;
-            message = state.ndefMessage;
-        }
-
-        // Make callback without lock
-        if (callback != null) {
-            return callback.createNdefMessage(mDefaultEvent);
-        } else {
-            return message;
-        }
-    }
-
-    /** Callback from NFC service, usually on binder thread */
-    @Override
-    public Uri[] getUris() {
         Uri[] uris;
-        NfcAdapter.CreateBeamUrisCallback callback;
+        int flags;
         synchronized (NfcActivityManager.this) {
             NfcActivityState state = findResumedActivityState();
             if (state == null) return null;
+
+            ndefCallback = state.ndefMessageCallback;
+            urisCallback = state.uriCallback;
+            message = state.ndefMessage;
             uris = state.uris;
-            callback = state.uriCallback;
+            flags = state.flags;
         }
-        if (callback != null) {
-            uris = callback.createBeamUris(mDefaultEvent);
+
+        // Make callbacks without lock
+        if (ndefCallback != null) {
+            message  = ndefCallback.createNdefMessage(mDefaultEvent);
+        }
+        if (urisCallback != null) {
+            uris = urisCallback.createBeamUris(mDefaultEvent);
             if (uris != null) {
                 for (Uri uri : uris) {
                     if (uri == null) {
@@ -314,10 +308,9 @@
                     }
                 }
             }
-            return uris;
-        } else {
-            return uris;
         }
+
+        return new BeamShareData(message, uris, flags);
     }
 
     /** Callback from NFC service, usually on binder thread */
diff --git a/core/java/android/nfc/NfcAdapter.java b/core/java/android/nfc/NfcAdapter.java
index 6ad382b..ca4a7d6 100644
--- a/core/java/android/nfc/NfcAdapter.java
+++ b/core/java/android/nfc/NfcAdapter.java
@@ -196,6 +196,9 @@
     public static final int STATE_TURNING_OFF = 4;
 
     /** @hide */
+    public static final int FLAG_NDEF_PUSH_NO_CONFIRM = 0x1;
+
+    /** @hide */
     public static final String ACTION_HANDOVER_TRANSFER_STARTED =
             "android.nfc.action.HANDOVER_TRANSFER_STARTED";
 
@@ -796,12 +799,12 @@
             if (activity == null) {
                 throw new NullPointerException("activity cannot be null");
             }
-            mNfcActivityManager.setNdefPushMessage(activity, message);
+            mNfcActivityManager.setNdefPushMessage(activity, message, 0);
             for (Activity a : activities) {
                 if (a == null) {
                     throw new NullPointerException("activities cannot contain null");
                 }
-                mNfcActivityManager.setNdefPushMessage(a, message);
+                mNfcActivityManager.setNdefPushMessage(a, message, 0);
             }
         } catch (IllegalStateException e) {
             if (targetSdkVersion < android.os.Build.VERSION_CODES.JELLY_BEAN) {
@@ -816,6 +819,16 @@
     }
 
     /**
+     * @hide
+     */
+    public void setNdefPushMessage(NdefMessage message, Activity activity, int flags) {
+        if (activity == null) {
+            throw new NullPointerException("activity cannot be null");
+        }
+        mNfcActivityManager.setNdefPushMessage(activity, message, flags);
+    }
+
+    /**
      * Set a callback that dynamically generates NDEF messages to send using Android Beam (TM).
      *
      * <p>This method may be called at any time before {@link Activity#onDestroy},
@@ -887,12 +900,12 @@
             if (activity == null) {
                 throw new NullPointerException("activity cannot be null");
             }
-            mNfcActivityManager.setNdefPushMessageCallback(activity, callback);
+            mNfcActivityManager.setNdefPushMessageCallback(activity, callback, 0);
             for (Activity a : activities) {
                 if (a == null) {
                     throw new NullPointerException("activities cannot contain null");
                 }
-                mNfcActivityManager.setNdefPushMessageCallback(a, callback);
+                mNfcActivityManager.setNdefPushMessageCallback(a, callback, 0);
             }
         } catch (IllegalStateException e) {
             if (targetSdkVersion < android.os.Build.VERSION_CODES.JELLY_BEAN) {
@@ -907,6 +920,17 @@
     }
 
     /**
+     * @hide
+     */
+    public void setNdefPushMessageCallback(CreateNdefMessageCallback callback, Activity activity,
+            int flags) {
+        if (activity == null) {
+            throw new NullPointerException("activity cannot be null");
+        }
+        mNfcActivityManager.setNdefPushMessageCallback(activity, callback, flags);
+    }
+
+    /**
      * Set a callback on successful Android Beam (TM).
      *
      * <p>This method may be called at any time before {@link Activity#onDestroy},
@@ -1095,7 +1119,7 @@
             throw new NullPointerException();
         }
         enforceResumed(activity);
-        mNfcActivityManager.setNdefPushMessage(activity, message);
+        mNfcActivityManager.setNdefPushMessage(activity, message, 0);
     }
 
     /**
@@ -1123,8 +1147,8 @@
             throw new NullPointerException();
         }
         enforceResumed(activity);
-        mNfcActivityManager.setNdefPushMessage(activity, null);
-        mNfcActivityManager.setNdefPushMessageCallback(activity, null);
+        mNfcActivityManager.setNdefPushMessage(activity, null, 0);
+        mNfcActivityManager.setNdefPushMessageCallback(activity, null, 0);
         mNfcActivityManager.setOnNdefPushCompleteCallback(activity, null);
     }
 
diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl
index 34c9740..2e8092a 100644
--- a/core/java/android/os/IUserManager.aidl
+++ b/core/java/android/os/IUserManager.aidl
@@ -20,6 +20,7 @@
 import android.os.Bundle;
 import android.os.ParcelFileDescriptor;
 import android.content.pm.UserInfo;
+import android.content.RestrictionEntry;
 import android.graphics.Bitmap;
 
 /**
@@ -33,6 +34,7 @@
     Bitmap getUserIcon(int userHandle);
     List<UserInfo> getUsers(boolean excludeDying);
     UserInfo getUserInfo(int userHandle);
+    boolean isRestricted();
     void setGuestEnabled(boolean enable);
     boolean isGuestEnabled();
     void wipeUser(int userHandle);
@@ -40,4 +42,7 @@
     int getUserHandle(int userSerialNumber);
     Bundle getUserRestrictions(int userHandle);
     void setUserRestrictions(in Bundle restrictions, int userHandle);
+    void setApplicationRestrictions(in String packageName, in List<RestrictionEntry> entries,
+            int userHandle);
+    List<RestrictionEntry> getApplicationRestrictions(in String packageName, int userHandle);
 }
diff --git a/core/java/android/os/SystemClock.java b/core/java/android/os/SystemClock.java
index c9adf45..729c64b 100644
--- a/core/java/android/os/SystemClock.java
+++ b/core/java/android/os/SystemClock.java
@@ -138,8 +138,6 @@
 
     /**
      * Returns milliseconds since boot, not counting time spent in deep sleep.
-     * <b>Note:</b> This value may get reset occasionally (before it would
-     * otherwise wrap around).
      *
      * @return milliseconds of non-sleep uptime since boot.
      */
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 51e3e7c..622308f 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -17,6 +17,7 @@
 
 import android.app.ActivityManagerNative;
 import android.content.Context;
+import android.content.RestrictionEntry;
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
@@ -36,48 +37,56 @@
     private final Context mContext;
 
     /**
-     * @hide
-     * Key for user restrictions. Specifies if a user is allowed to add or remove accounts.
+     * Key for user restrictions. Specifies if a user is disallowed from adding and removing
+     * accounts.
+     * The default value is <code>false</code>.
+     * <p/>
      * Type: Boolean
      * @see #setUserRestrictions(Bundle)
      * @see #getUserRestrictions()
      */
-    public static final String ALLOW_MODIFY_ACCOUNTS = "modify_accounts";
+    public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
 
     /**
-     * @hide
-     * Key for user restrictions. Specifies if a user is allowed to change Wi-Fi access points.
+     * Key for user restrictions. Specifies if a user is disallowed from changing Wi-Fi
+     * access points.
+     * The default value is <code>false</code>.
+     * <p/>
      * Type: Boolean
      * @see #setUserRestrictions(Bundle)
      * @see #getUserRestrictions()
      */
-    public static final String ALLOW_CONFIG_WIFI = "config_wifi";
+    public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi";
 
     /**
-     * @hide
-     * Key for user restrictions. Specifies if a user is allowed to install applications.
+     * Key for user restrictions. Specifies if a user is disallowed from installing applications.
+     * The default value is <code>false</code>.
+     * <p/>
      * Type: Boolean
      * @see #setUserRestrictions(Bundle)
      * @see #getUserRestrictions()
      */
-    public static final String ALLOW_INSTALL_APPS = "install_apps";
+    public static final String DISALLOW_INSTALL_APPS = "no_install_apps";
 
     /**
-     * @hide
-     * Key for user restrictions. Specifies if a user is allowed to uninstall applications.
+     * Key for user restrictions. Specifies if a user is disallowed from uninstalling applications.
+     * The default value is <code>false</code>.
+     * <p/>
      * Type: Boolean
      * @see #setUserRestrictions(Bundle)
      * @see #getUserRestrictions()
      */
-    public static final String ALLOW_UNINSTALL_APPS = "uninstall_apps";
+    public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
 
-    /** @hide *
-     * Key for user restrictions. Specifies if a user is allowed to toggle location sharing.
+    /**
+     * Key for user restrictions. Specifies if a user is disallowed from toggling location sharing.
+     * The default value is <code>false</code>.
+     * <p/>
      * Type: Boolean
      * @see #setUserRestrictions(Bundle)
      * @see #getUserRestrictions()
      */
-    public static final String ALLOW_CONFIG_LOCATION_ACCESS = "config_location_access";
+    public static final String DISALLOW_SHARE_LOCATION = "no_share_location";
 
     /** @hide */
     public UserManager(Context context, IUserManager service) {
@@ -126,7 +135,22 @@
     public boolean isUserAGoat() {
         return false;
     }
- 
+
+    /**
+     * Used to check if the user making this call is a restricted user. Restricted users may have
+     * application restrictions imposed on them. All apps should default to the most restrictive
+     * version, unless they have specific restrictions available through a call to
+     * {@link Context#getApplicationRestrictions()}.
+     */
+    public boolean isUserRestricted() {
+        try {
+            return mService.isRestricted();
+        } catch (RemoteException re) {
+            Log.w(TAG, "Could not check if user restricted ", re);
+            return false;
+        }
+    }
+
     /**
      * Return whether the given user is actively running.  This means that
      * the user is in the "started" state, not "stopped" -- it is currently
@@ -176,12 +200,19 @@
         }
     }
 
-    /** @hide */
+    /**
+     * Returns the user-wide restrictions imposed on this user.
+     * @return a Bundle containing all the restrictions.
+     */
     public Bundle getUserRestrictions() {
         return getUserRestrictions(Process.myUserHandle());
     }
 
-    /** @hide */
+    /**
+     * Returns the user-wide restrictions imposed on the user specified by <code>userHandle</code>.
+     * @param userHandle the UserHandle of the user for whom to retrieve the restrictions.
+     * @return a Bundle containing all the restrictions.
+     */
     public Bundle getUserRestrictions(UserHandle userHandle) {
         try {
             return mService.getUserRestrictions(userHandle.getIdentifier());
@@ -191,12 +222,21 @@
         }
     }
 
-    /** @hide */
+    /**
+     * Sets all the user-wide restrictions for this user.
+     * Requires the MANAGE_USERS permission.
+     * @param restrictions the Bundle containing all the restrictions.
+     */
     public void setUserRestrictions(Bundle restrictions) {
         setUserRestrictions(restrictions, Process.myUserHandle());
     }
 
-    /** @hide */
+    /**
+     * Sets all the user-wide restrictions for the specified user.
+     * Requires the MANAGE_USERS permission.
+     * @param restrictions the Bundle containing all the restrictions.
+     * @param userHandle the UserHandle of the user for whom to set the restrictions.
+     */
     public void setUserRestrictions(Bundle restrictions, UserHandle userHandle) {
         try {
             mService.setUserRestrictions(restrictions, userHandle.getIdentifier());
@@ -205,7 +245,26 @@
         }
     }
 
-    /** @hide */
+    /**
+     * Sets the value of a specific restriction.
+     * Requires the MANAGE_USERS permission.
+     * @param key the key of the restriction
+     * @param value the value for the restriction
+     */
+    public void setUserRestriction(String key, boolean value) {
+        Bundle bundle = getUserRestrictions();
+        bundle.putBoolean(key, value);
+        setUserRestrictions(bundle);
+    }
+
+    /**
+     * @hide
+     * Sets the value of a specific restriction on a specific user.
+     * Requires the {@link android.Manifest.permission#MANAGE_USERS} permission.
+     * @param key the key of the restriction
+     * @param value the value for the restriction
+     * @param userHandle the user whose restriction is to be changed.
+     */
     public void setUserRestriction(String key, boolean value, UserHandle userHandle) {
         Bundle bundle = getUserRestrictions(userHandle);
         bundle.putBoolean(key, value);
@@ -450,10 +509,34 @@
     }
 
     /**
-     * Returns whether the current user is allow to toggle location sharing settings.
+     * Returns whether the current user is allowed to toggle location sharing settings.
      * @hide
      */
     public boolean isLocationSharingToggleAllowed() {
-        return getUserRestrictions().getBoolean(ALLOW_CONFIG_LOCATION_ACCESS);
+        return !getUserRestrictions().getBoolean(DISALLOW_SHARE_LOCATION, false);
+    }
+
+    /**
+     * @hide
+     */
+    public List<RestrictionEntry> getApplicationRestrictions(String packageName, UserHandle user) {
+        try {
+            return mService.getApplicationRestrictions(packageName, user.getIdentifier());
+        } catch (RemoteException re) {
+            Log.w(TAG, "Could not get application restrictions for user " + user.getIdentifier());
+        }
+        return null;
+    }
+
+    /**
+     * @hide
+     */
+    public void setApplicationRestrictions(String packageName, List<RestrictionEntry> entries,
+            UserHandle user) {
+        try {
+            mService.setApplicationRestrictions(packageName, entries, user.getIdentifier());
+        } catch (RemoteException re) {
+            Log.w(TAG, "Could not set application restrictions for user " + user.getIdentifier());
+        }
     }
 }
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 8f54a38..a4c4411 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -4325,6 +4325,13 @@
         public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "data");
 
         /**
+         * A boolean parameter for {@link Data#CONTENT_URI}.
+         * This specifies whether or not the returned data items should be filtered to show
+         * data items belonging to visible contacts only.
+         */
+        public static final String VISIBLE_CONTACTS_ONLY = "visible_contacts_only";
+
+        /**
          * The MIME type of the results from {@link #CONTENT_URI}.
          */
         public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
@@ -6833,6 +6840,38 @@
             public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(CONTENT_URI,
                     "filter");
         }
+
+        /**
+         * A special class of data items, used to refer to types of data that can be used to attempt
+         * to start communicating with a person ({@link Phone} and {@link Email}). Note that this
+         * is NOT a separate data kind.
+         *
+         * This URI allows the ContactsProvider to return a unified result for data items that users
+         * can use to initiate communications with another contact. {@link Phone} and {@link Email}
+         * are the current data types in this category.
+         */
+        public static final class Contactables implements DataColumnsWithJoins, CommonColumns {
+            /**
+             * The content:// style URI for these data items, which requests a directory of data
+             * rows matching the selection criteria.
+             */
+            public static final Uri CONTENT_URI = Uri.withAppendedPath(Data.CONTENT_URI,
+                    "contactables");
+
+            /**
+             * The content:// style URI for these data items, which allows for a query parameter to
+             * be appended onto the end to filter for data items matching the query.
+             */
+            public static final Uri CONTENT_FILTER_URI = Uri.withAppendedPath(
+                    Contactables.CONTENT_URI, "filter");
+
+            /**
+             * A boolean parameter for {@link Data#CONTENT_URI}.
+             * This specifies whether or not the returned data items should be filtered to show
+             * data items belonging to visible contacts only.
+             */
+            public static final String VISIBLE_CONTACTS_ONLY = "visible_contacts_only";
+        }
     }
 
     /**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index d251ca2..f9ad8c0 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -4039,6 +4039,14 @@
         public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
 
         /**
+         * Name of a package that the current user has explicitly allowed to see all of that
+         * user's notifications.
+         *
+         * @hide
+         */
+        public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
+
+        /**
          * This are the settings to be backed up.
          *
          * NOTE: Settings are backed up and restored in the order they appear
@@ -4403,6 +4411,14 @@
        public static final String DATA_ROAMING = "data_roaming";
 
        /**
+        * The value passed to a Mobile DataConnection via bringUp which defines the
+        * number of retries to preform when setting up the initial connection. The default
+        * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
+        * @hide
+        */
+       public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
+
+       /**
         * Whether user has enabled development settings.
         */
        public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
@@ -4791,6 +4807,14 @@
                 "wifi_scan_always_enabled";
 
        /**
+        * Setting to indicate whether the user should be notified that scans are still
+        * available when Wi-Fi is turned off
+        * @hide
+        */
+       public static final String WIFI_NOTIFY_SCAN_ALWAYS_AVAILABLE =
+                "wifi_notify_scan_always_enabled";
+
+       /**
         * Used to save the Wifi_ON state prior to tethering.
         * This state will be checked to restore Wifi after
         * the user turns off tethering.
diff --git a/core/java/android/security/IKeystoreService.java b/core/java/android/security/IKeystoreService.java
index 651693a..a890d9b 100644
--- a/core/java/android/security/IKeystoreService.java
+++ b/core/java/android/security/IKeystoreService.java
@@ -148,6 +148,10 @@
                     for (int i = 0; i < size; i++) {
                         _result[i] = _reply.readString();
                     }
+                    int _ret = _reply.readInt();
+                    if (_ret != 1) {
+                        return null;
+                    }
                 } finally {
                     _reply.recycle();
                     _data.recycle();
@@ -401,6 +405,28 @@
                 }
                 return _result;
             }
+
+            @Override
+            public int duplicate(String srcKey, int srcUid, String destKey, int destUid)
+                    throws RemoteException {
+                Parcel _data = Parcel.obtain();
+                Parcel _reply = Parcel.obtain();
+                int _result;
+                try {
+                    _data.writeInterfaceToken(DESCRIPTOR);
+                    _data.writeString(srcKey);
+                    _data.writeInt(srcUid);
+                    _data.writeString(destKey);
+                    _data.writeInt(destUid);
+                    mRemote.transact(Stub.TRANSACTION_duplicate, _data, _reply, 0);
+                    _reply.readException();
+                    _result = _reply.readInt();
+                } finally {
+                    _reply.recycle();
+                    _data.recycle();
+                }
+                return _result;
+            }
         }
 
         private static final String DESCRIPTOR = "android.security.keystore";
@@ -425,6 +451,7 @@
         static final int TRANSACTION_grant = IBinder.FIRST_CALL_TRANSACTION + 17;
         static final int TRANSACTION_ungrant = IBinder.FIRST_CALL_TRANSACTION + 18;
         static final int TRANSACTION_getmtime = IBinder.FIRST_CALL_TRANSACTION + 19;
+        static final int TRANSACTION_duplicate = IBinder.FIRST_CALL_TRANSACTION + 20;
 
         /**
          * Cast an IBinder object into an IKeystoreService interface, generating
@@ -509,4 +536,7 @@
     public int ungrant(String name, int granteeUid) throws RemoteException;
 
     public long getmtime(String name) throws RemoteException;
+
+    public int duplicate(String srcKey, int srcUid, String destKey, int destUid)
+            throws RemoteException;
 }
diff --git a/core/java/android/text/GraphicsOperations.java b/core/java/android/text/GraphicsOperations.java
index 831ccc5..d426d124 100644
--- a/core/java/android/text/GraphicsOperations.java
+++ b/core/java/android/text/GraphicsOperations.java
@@ -58,13 +58,6 @@
             int flags, float[] advances, int advancesIndex, Paint paint);
 
     /**
-     * Just like {@link Paint#getTextRunAdvances}.
-     * @hide
-     */
-    float getTextRunAdvances(int start, int end, int contextStart, int contextEnd,
-            int flags, float[] advances, int advancesIndex, Paint paint, int reserved);
-
-    /**
      * Just like {@link Paint#getTextRunCursor}.
      * @hide
      */
diff --git a/core/java/android/text/SpannableStringBuilder.java b/core/java/android/text/SpannableStringBuilder.java
index 0f30d25..8929930 100644
--- a/core/java/android/text/SpannableStringBuilder.java
+++ b/core/java/android/text/SpannableStringBuilder.java
@@ -1226,35 +1226,6 @@
     }
 
     /**
-     * Don't call this yourself -- exists for Paint to use internally.
-     * {@hide}
-     */
-    public float getTextRunAdvances(int start, int end, int contextStart, int contextEnd, int flags,
-            float[] advances, int advancesPos, Paint p, int reserved) {
-
-        float ret;
-
-        int contextLen = contextEnd - contextStart;
-        int len = end - start;
-
-        if (end <= mGapStart) {
-            ret = p.getTextRunAdvances(mText, start, len, contextStart, contextLen,
-                    flags, advances, advancesPos, reserved);
-        } else if (start >= mGapStart) {
-            ret = p.getTextRunAdvances(mText, start + mGapLength, len,
-                    contextStart + mGapLength, contextLen, flags, advances, advancesPos, reserved);
-        } else {
-            char[] buf = TextUtils.obtain(contextLen);
-            getChars(contextStart, contextEnd, buf, 0);
-            ret = p.getTextRunAdvances(buf, start - contextStart, len,
-                    0, contextLen, flags, advances, advancesPos, reserved);
-            TextUtils.recycle(buf);
-        }
-
-        return ret;
-    }
-
-    /**
      * Returns the next cursor position in the run.  This avoids placing the cursor between
      * surrogates, between characters that form conjuncts, between base characters and combining
      * marks, or within a reordering cluster.
diff --git a/core/java/android/text/format/DateFormat.java b/core/java/android/text/format/DateFormat.java
index be4663d..f813df3 100644
--- a/core/java/android/text/format/DateFormat.java
+++ b/core/java/android/text/format/DateFormat.java
@@ -43,11 +43,17 @@
  * for both formatting and parsing dates. For the canonical documentation
  * of format strings, see {@link java.text.SimpleDateFormat}.
  *
- * <p>The format methods in this class implement a subset of Unicode
+ * <p>The {@code format} methods in this class implement a subset of Unicode
  * <a href="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">UTS #35</a> patterns.
- * The subset supported by this class includes the following format characters:
- * {@code acdEHhLKkLMmsyz}. See {@link java.text.SimpleDateFormat} for more documentation
- * about patterns, or if you need a more compete implementation.
+ * The subset currently supported by this class includes the following format characters:
+ * {@code acdEHhLKkLMmsyz}. Up to API level 17, only {@code adEhkMmszy} were supported.
+ * Note that this class incorrectly implements {@code k} as if it were {@code H} for backwards
+ * compatibility.
+ *
+ * <p>See {@link java.text.SimpleDateFormat} for more documentation
+ * about patterns, or if you need a more complete or correct implementation.
+ * Note that the non-{@code format} methods in this class are implemented by
+ * {@code SimpleDateFormat}.
  */
 public class DateFormat {
     /** @deprecated Use a literal {@code '} instead. */
@@ -74,7 +80,11 @@
     @Deprecated
     public  static final char    HOUR                   =    'h';
 
-    /** @deprecated Use a literal {@code 'k'} instead. */
+    /**
+     * @deprecated Use a literal {@code 'H'} (for compatibility with {@link SimpleDateFormat}
+     * and Unicode) or {@code 'k'} (for compatibility with Android releases up to and including
+     * Jelly Bean MR-1) instead. Note that the two are incompatible.
+     */
     @Deprecated
     public  static final char    HOUR_OF_DAY            =    'k';
 
@@ -160,9 +170,18 @@
      * @return the {@link java.text.DateFormat} object that properly formats the time.
      */
     public static java.text.DateFormat getTimeFormat(Context context) {
+        return new java.text.SimpleDateFormat(getTimeFormatString(context));
+    }
+
+    /**
+     * Returns a String pattern that can be used to format the time according
+     * to the current locale and the user's 12-/24-hour clock preference.
+     * @param context the application context
+     * @hide
+     */
+    public static String getTimeFormatString(Context context) {
         LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale);
-        boolean is24 = is24HourFormat(context);
-        return new java.text.SimpleDateFormat(is24 ? d.timeFormat24 : d.timeFormat12);
+        return is24HourFormat(context) ? d.timeFormat24 : d.timeFormat12;
     }
 
     /**
@@ -451,10 +470,13 @@
                     }
                     break;
                 case 'H': // hour in day (0-23)
-                case 'k': // hour in day (1-24)
+                case 'k': // hour in day (1-24) [but see note below]
                     {
                         int hour = inDate.get(Calendar.HOUR_OF_DAY);
-                        if (c == 'k' && hour == 0) {
+                        // Historically on Android 'k' was interpreted as 'H', which wasn't
+                        // implemented, so pretty much all callers that want to format 24-hour
+                        // times are abusing 'k'. http://b/8359981.
+                        if (false && c == 'k' && hour == 0) {
                             hour = 24;
                         }
                         replacement = zeroPad(hour, count);
diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java
index 6c8a737..5a88cf6 100644
--- a/core/java/android/text/format/DateUtils.java
+++ b/core/java/android/text/format/DateUtils.java
@@ -39,7 +39,6 @@
 {
     private static final Object sLock = new Object();
     private static Configuration sLastConfig;
-    private static java.text.DateFormat sStatusTimeFormat;
     private static String sElapsedFormatMMSS;
     private static String sElapsedFormatHMMSS;
 
@@ -95,14 +94,14 @@
     // translated.
     /**
      * This is not actually the preferred 24-hour date format in all locales.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final String HOUR_MINUTE_24 = "%H:%M";
     public static final String MONTH_FORMAT = "%B";
     /**
      * This is not actually a useful month name in all locales.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final String ABBREV_MONTH_FORMAT = "%b";
@@ -118,7 +117,7 @@
     // The index is constructed from a bit-wise OR of the boolean values:
     // {showTime, showYear, showWeekDay}.  For example, if showYear and
     // showWeekDay are both true, then the index would be 3.
-    /** @deprecated do not use. */
+    /** @deprecated Do not use. */
     public static final int sameYearTable[] = {
         com.android.internal.R.string.same_year_md1_md2,
         com.android.internal.R.string.same_year_wday1_md1_wday2_md2,
@@ -145,7 +144,7 @@
     // The index is constructed from a bit-wise OR of the boolean values:
     // {showTime, showYear, showWeekDay}.  For example, if showYear and
     // showWeekDay are both true, then the index would be 3.
-    /** @deprecated do not use. */
+    /** @deprecated Do not use. */
     public static final int sameMonthTable[] = {
         com.android.internal.R.string.same_month_md1_md2,
         com.android.internal.R.string.same_month_wday1_md1_wday2_md2,
@@ -172,7 +171,7 @@
      *
      * @more <p>
      *       e.g. "Sunday" or "January"
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final int LENGTH_LONG = 10;
@@ -183,7 +182,7 @@
      *
      * @more <p>
      *       e.g. "Sun" or "Jan"
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final int LENGTH_MEDIUM = 20;
@@ -195,7 +194,7 @@
      * <p>e.g. "Su" or "Jan"
      * <p>In most languages, the results returned for LENGTH_SHORT will be the same as
      * the results returned for {@link #LENGTH_MEDIUM}.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final int LENGTH_SHORT = 30;
@@ -204,7 +203,7 @@
      * Request an even shorter abbreviated version of the name.
      * Do not use this.  Currently this will always return the same result
      * as {@link #LENGTH_SHORT}.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final int LENGTH_SHORTER = 40;
@@ -216,7 +215,7 @@
      * <p>e.g. "S", "T", "T" or "J"
      * <p>In some languages, the results returned for LENGTH_SHORTEST will be the same as
      * the results returned for {@link #LENGTH_SHORT}.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static final int LENGTH_SHORTEST = 50;
@@ -232,7 +231,7 @@
      *               Undefined lengths will return {@link #LENGTH_MEDIUM}
      *               but may return something different in the future.
      * @throws IndexOutOfBoundsException if the dayOfWeek is out of bounds.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static String getDayOfWeekString(int dayOfWeek, int abbrev) {
@@ -254,7 +253,7 @@
      * @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}.
      * @throws IndexOutOfBoundsException if the ampm is out of bounds.
      * @return Localized version of "AM" or "PM".
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static String getAMPMString(int ampm) {
@@ -270,7 +269,7 @@
      *               Undefined lengths will return {@link #LENGTH_MEDIUM}
      *               but may return something different in the future.
      * @return Localized month of the year.
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
+     * @deprecated Use {@link java.text.SimpleDateFormat} instead.
      */
     @Deprecated
     public static String getMonthString(int month, int abbrev) {
@@ -288,36 +287,6 @@
     }
 
     /**
-     * Return a localized string for the month of the year, for
-     * contexts where the month is not formatted together with
-     * a day of the month.
-     *
-     * @param month One of {@link Calendar#JANUARY Calendar.JANUARY},
-     *               {@link Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
-     * @param abbrev One of {@link #LENGTH_LONG}, {@link #LENGTH_MEDIUM},
-     *               or {@link #LENGTH_SHORTEST}.
-     *               Undefined lengths will return {@link #LENGTH_MEDIUM}
-     *               but may return something different in the future.
-     * @return Localized month of the year.
-     * @hide Pending API council approval
-     * @deprecated use {@link java.text.SimpleDateFormat} instead.
-     */
-    @Deprecated
-    public static String getStandaloneMonthString(int month, int abbrev) {
-        LocaleData d = LocaleData.get(Locale.getDefault());
-        String[] names;
-        switch (abbrev) {
-            case LENGTH_LONG:       names = d.longStandAloneMonthNames; break;
-            case LENGTH_MEDIUM:     names = d.shortMonthNames; break;
-            case LENGTH_SHORT:      names = d.shortMonthNames; break;
-            case LENGTH_SHORTER:    names = d.shortMonthNames; break;
-            case LENGTH_SHORTEST:   names = d.tinyStandAloneMonthNames; break;
-            default:                names = d.shortMonthNames; break;
-        }
-        return names[month];
-    }
-
-    /**
      * Returns a string describing the elapsed time since startTime.
      * @param startTime some time in the past.
      * @return a String object containing the elapsed time.
@@ -544,25 +513,12 @@
         Configuration cfg = r.getConfiguration();
         if (sLastConfig == null || !sLastConfig.equals(cfg)) {
             sLastConfig = cfg;
-            sStatusTimeFormat = java.text.DateFormat.getTimeInstance(java.text.DateFormat.SHORT);
             sElapsedFormatMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_mm_ss);
             sElapsedFormatHMMSS = r.getString(com.android.internal.R.string.elapsed_time_short_format_h_mm_ss);
         }
     }
 
     /**
-     * Format a time so it appears like it would in the status bar clock.
-     * @deprecated use {@link #DateFormat.getTimeFormat(Context)} instead.
-     * @hide
-     */
-    public static final CharSequence timeString(long millis) {
-        synchronized (sLock) {
-            initFormatStringsLocked();
-            return sStatusTimeFormat.format(millis);
-        }
-    }
-
-    /**
      * Return given duration in a human-friendly format. For example, "4
      * minutes" or "1 second". Returns only largest meaningful unit of time,
      * from seconds up to hours.
@@ -676,18 +632,6 @@
     }
 
     /**
-     * @hide
-     * @deprecated use {@link android.text.format.Time}
-     */
-    public static Calendar newCalendar(boolean zulu)
-    {
-        if (zulu)
-            return Calendar.getInstance(TimeZone.getTimeZone("GMT"));
-
-        return Calendar.getInstance();
-    }
-
-    /**
      * @return true if the supplied when is today else false
      */
     public static boolean isToday(long when) {
@@ -705,127 +649,6 @@
     }
 
     /**
-     * @hide
-     * @deprecated use {@link android.text.format.Time}
-     * Return true if this date string is local time
-     */
-    public static boolean isUTC(String s)
-    {
-        if (s.length() == 16 && s.charAt(15) == 'Z') {
-            return true;
-        }
-        if (s.length() == 9 && s.charAt(8) == 'Z') {
-            // XXX not sure if this case possible/valid
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Return a string containing the date and time in RFC2445 format.
-     * Ensures that the time is written in UTC.  The Calendar class doesn't
-     * really help out with this, so this is slower than it ought to be.
-     *
-     * @param cal the date and time to write
-     * @hide
-     * @deprecated use {@link android.text.format.Time}
-     */
-    public static String writeDateTime(Calendar cal)
-    {
-        TimeZone tz = TimeZone.getTimeZone("GMT");
-        GregorianCalendar c = new GregorianCalendar(tz);
-        c.setTimeInMillis(cal.getTimeInMillis());
-        return writeDateTime(c, true);
-    }
-
-    /**
-     * Return a string containing the date and time in RFC2445 format.
-     *
-     * @param cal the date and time to write
-     * @param zulu If the calendar is in UTC, pass true, and a Z will
-     * be written at the end as per RFC2445.  Otherwise, the time is
-     * considered in localtime.
-     * @hide
-     * @deprecated use {@link android.text.format.Time}
-     */
-    public static String writeDateTime(Calendar cal, boolean zulu)
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.ensureCapacity(16);
-        if (zulu) {
-            sb.setLength(16);
-            sb.setCharAt(15, 'Z');
-        } else {
-            sb.setLength(15);
-        }
-        return writeDateTime(cal, sb);
-    }
-
-    /**
-     * Return a string containing the date and time in RFC2445 format.
-     *
-     * @param cal the date and time to write
-     * @param sb a StringBuilder to use.  It is assumed that setLength
-     *           has already been called on sb to the appropriate length
-     *           which is sb.setLength(zulu ? 16 : 15)
-     * @hide
-     * @deprecated use {@link android.text.format.Time}
-     */
-    public static String writeDateTime(Calendar cal, StringBuilder sb)
-    {
-        int n;
-
-        n = cal.get(Calendar.YEAR);
-        sb.setCharAt(3, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(2, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(1, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(0, (char)('0'+n%10));
-
-        n = cal.get(Calendar.MONTH) + 1;
-        sb.setCharAt(5, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(4, (char)('0'+n%10));
-
-        n = cal.get(Calendar.DAY_OF_MONTH);
-        sb.setCharAt(7, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(6, (char)('0'+n%10));
-
-        sb.setCharAt(8, 'T');
-
-        n = cal.get(Calendar.HOUR_OF_DAY);
-        sb.setCharAt(10, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(9, (char)('0'+n%10));
-
-        n = cal.get(Calendar.MINUTE);
-        sb.setCharAt(12, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(11, (char)('0'+n%10));
-
-        n = cal.get(Calendar.SECOND);
-        sb.setCharAt(14, (char)('0'+n%10));
-        n /= 10;
-        sb.setCharAt(13, (char)('0'+n%10));
-
-        return sb.toString();
-    }
-
-    /**
-     * @hide
-     * @deprecated use {@link android.text.format.Time}
-     */
-    public static void assign(Calendar lval, Calendar rval)
-    {
-        // there should be a faster way.
-        lval.clear();
-        lval.setTimeInMillis(rval.getTimeInMillis());
-    }
-
-    /**
      * Formats a date or a time range according to the local conventions.
      * <p>
      * Note that this is a convenience method. Using it involves creating an
diff --git a/core/java/android/text/format/Formatter.java b/core/java/android/text/format/Formatter.java
index 121c6f2..9c98b98 100644
--- a/core/java/android/text/format/Formatter.java
+++ b/core/java/android/text/format/Formatter.java
@@ -95,16 +95,12 @@
     }
 
     /**
-     * Returns a string in the canonical IP format ###.###.###.### from a packed integer containing
-     * the IP address.  The IP address is expected to be in little-endian format (LSB first). That
-     * is, 0x01020304 will return "4.3.2.1".
+     * Returns a string in the canonical IPv4 format ###.###.###.### from a packed integer
+     * containing the IP address. The IPv4 address is expected to be in little-endian
+     * format (LSB first). That is, 0x01020304 will return "4.3.2.1".
      *
-     * @param ipv4Address the IP address as a packed integer with LSB first.
-     * @return string with canonical IP address format.
-     *
-     * @deprecated this method doesn't support IPv6 addresses. Prefer {@link
-     *     java.net.InetAddress#getHostAddress()}, which supports both IPv4 and
-     *     IPv6 addresses.
+     * @deprecated Use {@link java.net.InetAddress#getHostAddress()}, which supports both IPv4 and
+     *     IPv6 addresses. This method does not support IPv6 addresses.
      */
     @Deprecated
     public static String formatIpAddress(int ipv4Address) {
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index c369ebe..2ec9a7d 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -399,12 +399,13 @@
     ///////////////////////////////////////////////////////////////////////////
     
     void drawHardwareLayer(HardwareLayer layer, float x, float y, Paint paint) {
+        layer.setLayerPaint(paint);
+
         final GLES20Layer glLayer = (GLES20Layer) layer;
-        final int nativePaint = paint == null ? 0 : paint.mNativePaint;
-        nDrawLayer(mRenderer, glLayer.getLayer(), x, y, nativePaint);
+        nDrawLayer(mRenderer, glLayer.getLayer(), x, y);
     }
 
-    private static native void nDrawLayer(int renderer, int layer, float x, float y, int paint);
+    private static native void nDrawLayer(int renderer, int layer, float x, float y);
 
     void interrupt() {
         nInterrupt(mRenderer);
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index e086f5a..7918823 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -428,6 +428,8 @@
     interface HardwareDrawCallbacks {
         /**
          * Invoked before a view is drawn by a hardware renderer.
+         * This method can be used to apply transformations to the
+         * canvas but no drawing command should be issued.
          * 
          * @param canvas The Canvas used to render the view.
          */
@@ -435,6 +437,7 @@
 
         /**
          * Invoked after a view is drawn by a hardware renderer.
+         * It is safe to invoke drawing commands from this method.
          * 
          * @param canvas The Canvas used to render the view.
          */
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index f0c6241..a85a558 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -60,8 +60,12 @@
             in IInputContext inputContext);
     boolean inputMethodClientHasFocus(IInputMethodClient client);
 
+    void getInitialDisplaySize(int displayId, out Point size);
+    void getBaseDisplaySize(int displayId, out Point size);
     void setForcedDisplaySize(int displayId, int width, int height);
     void clearForcedDisplaySize(int displayId);
+    int getInitialDisplayDensity(int displayId);
+    int getBaseDisplayDensity(int displayId);
     void setForcedDisplayDensity(int displayId, int density);
     void clearForcedDisplayDensity(int displayId);
 
diff --git a/core/java/android/view/InputChannel.java b/core/java/android/view/InputChannel.java
index 523af04..a797176 100644
--- a/core/java/android/view/InputChannel.java
+++ b/core/java/android/view/InputChannel.java
@@ -78,7 +78,9 @@
      * Creates a new input channel pair.  One channel should be provided to the input
      * dispatcher and the other to the application's input queue.
      * @param name The descriptive (non-unique) name of the channel pair.
-     * @return A pair of input channels.  They are symmetric and indistinguishable.
+     * @return A pair of input channels.  The first channel is designated as the
+     * server channel and should be used to publish input events.  The second channel
+     * is designated as the client channel and should be used to consume input events.
      */
     public static InputChannel[] openInputChannelPair(String name) {
         if (name == null) {
@@ -123,10 +125,11 @@
         nativeTransferTo(outParameter);
     }
 
+    @Override
     public int describeContents() {
         return Parcelable.CONTENTS_FILE_DESCRIPTOR;
     }
-    
+
     public void readFromParcel(Parcel in) {
         if (in == null) {
             throw new IllegalArgumentException("in must not be null");
@@ -134,7 +137,8 @@
         
         nativeReadFromParcel(in);
     }
-    
+
+    @Override
     public void writeToParcel(Parcel out, int flags) {
         if (out == null) {
             throw new IllegalArgumentException("out must not be null");
diff --git a/core/java/android/view/InputEventSender.java b/core/java/android/view/InputEventSender.java
new file mode 100644
index 0000000..adf63fe
--- /dev/null
+++ b/core/java/android/view/InputEventSender.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2013 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.view;
+
+import dalvik.system.CloseGuard;
+
+import android.os.Looper;
+import android.os.MessageQueue;
+import android.util.Log;
+
+/**
+ * Provides a low-level mechanism for an application to send input events.
+ * @hide
+ */
+public abstract class InputEventSender {
+    private static final String TAG = "InputEventSender";
+
+    private final CloseGuard mCloseGuard = CloseGuard.get();
+
+    private int mSenderPtr;
+
+    // We keep references to the input channel and message queue objects here so that
+    // they are not GC'd while the native peer of the receiver is using them.
+    private InputChannel mInputChannel;
+    private MessageQueue mMessageQueue;
+
+    private static native int nativeInit(InputEventSender sender,
+            InputChannel inputChannel, MessageQueue messageQueue);
+    private static native void nativeDispose(int senderPtr);
+    private static native boolean nativeSendKeyEvent(int senderPtr, int seq, KeyEvent event);
+    private static native boolean nativeSendMotionEvent(int senderPtr, int seq, MotionEvent event);
+
+    /**
+     * Creates an input event sender bound to the specified input channel.
+     *
+     * @param inputChannel The input channel.
+     * @param looper The looper to use when invoking callbacks.
+     */
+    public InputEventSender(InputChannel inputChannel, Looper looper) {
+        if (inputChannel == null) {
+            throw new IllegalArgumentException("inputChannel must not be null");
+        }
+        if (looper == null) {
+            throw new IllegalArgumentException("looper must not be null");
+        }
+
+        mInputChannel = inputChannel;
+        mMessageQueue = looper.getQueue();
+        mSenderPtr = nativeInit(this, inputChannel, mMessageQueue);
+
+        mCloseGuard.open("dispose");
+    }
+
+    @Override
+    protected void finalize() throws Throwable {
+        try {
+            dispose(true);
+        } finally {
+            super.finalize();
+        }
+    }
+
+    /**
+     * Disposes the receiver.
+     */
+    public void dispose() {
+        dispose(false);
+    }
+
+    private void dispose(boolean finalized) {
+        if (mCloseGuard != null) {
+            if (finalized) {
+                mCloseGuard.warnIfOpen();
+            }
+            mCloseGuard.close();
+        }
+
+        if (mSenderPtr != 0) {
+            nativeDispose(mSenderPtr);
+            mSenderPtr = 0;
+        }
+        mInputChannel = null;
+        mMessageQueue = null;
+    }
+
+    /**
+     * Called when an input event is finished.
+     *
+     * @param seq The input event sequence number.
+     * @param handled True if the input event was handled.
+     */
+    public void onInputEventFinished(int seq, boolean handled) {
+    }
+
+    /**
+     * Sends an input event.
+     * Must be called on the same Looper thread to which the sender is attached.
+     *
+     * @param seq The input event sequence number.
+     * @param event The input event to send.
+     * @return True if the entire event was sent successfully.  May return false
+     * if the input channel buffer filled before all samples were dispatched.
+     */
+    public final boolean sendInputEvent(int seq, InputEvent event) {
+        if (event == null) {
+            throw new IllegalArgumentException("event must not be null");
+        }
+        if (mSenderPtr == 0) {
+            Log.w(TAG, "Attempted to send an input event but the input event "
+                    + "sender has already been disposed.");
+            return false;
+        }
+
+        if (event instanceof KeyEvent) {
+            return nativeSendKeyEvent(mSenderPtr, seq, (KeyEvent)event);
+        } else {
+            return nativeSendMotionEvent(mSenderPtr, seq, (MotionEvent)event);
+        }
+    }
+
+    // Called from native code.
+    @SuppressWarnings("unused")
+    private void dispatchInputEventFinished(int seq, boolean handled) {
+        onInputEventFinished(seq, handled);
+    }
+}
diff --git a/core/java/android/view/Overlay.java b/core/java/android/view/Overlay.java
index f15d4d2..6630752 100644
--- a/core/java/android/view/Overlay.java
+++ b/core/java/android/view/Overlay.java
@@ -18,13 +18,10 @@
 import android.graphics.drawable.Drawable;
 
 /**
- * An overlay is an extra layer that sits on top of a View (the "host view") which is drawn after
- * all other content in that view (including children, if the view is a ViewGroup). Interaction
- * with the overlay layer is done in terms of adding/removing views and drawables. Invalidation and
- * redrawing of the overlay layer (and its host view) is handled differently for views versus
- * drawables in the overlay. Views invalidate themselves as usual, causing appropriate redrawing
- * to occur automatically. Drawables, on the other hand, do not manage invalidation, so changes to
- * drawable objects should be accompanied by appropriate calls to invalidate() on the host view.
+ * An overlay is an extra layer that sits on top of a View (the "host view")
+ * which is drawn after all other content in that view (including children,
+ * if the view is a ViewGroup). Interaction with the overlay layer is done in
+ * terms of adding/removing views and drawables.
  *
  * @see android.view.View#getOverlay()
  */
@@ -33,9 +30,7 @@
     /**
      * Adds a Drawable to the overlay. The bounds of the drawable should be relative to
      * the host view. Any drawable added to the overlay should be removed when it is no longer
-     * needed or no longer visible. There is no automatic invalidation of the host view; changes to
-     * the drawable should be accompanied by appropriate invalidation calls to the host view
-     * to cause the proper area of the view, and the overlay, to be redrawn.
+     * needed or no longer visible.
      *
      * @param drawable The Drawable to be added to the overlay. This drawable will be
      * drawn when the view redraws its overlay.
@@ -53,10 +48,16 @@
     void remove(Drawable drawable);
 
     /**
-     * Adds a View to the overlay. The bounds of the added view should be relative to
-     * the host view. Any view added to the overlay should be removed when it is no longer
-     * needed or no longer visible. The view must not be parented elsewhere when it is added
-     * to the overlay.
+     * Adds a View to the overlay. The bounds of the added view should be
+     * relative to the host view. Any view added to the overlay should be
+     * removed when it is no longer needed or no longer visible.
+     *
+     * <p>If the view has a parent, the view will be removed from that parent
+     * before being added to the overlay. Also, the view will be repositioned
+     * such that it is in the same relative location inside the activity. For
+     * example, if the view's current parent lies 100 pixels to the right
+     * and 200 pixels down from the origin of the overlay's
+     * host view, then the view will be offset by (100, 200).</p>
      *
      * @param view The View to be added to the overlay. The added view will be
      * drawn when the overlay is drawn.
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 0492d29..edfef56 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -72,6 +72,9 @@
     // mNativeSurface.
     int mNativeObject; // package scope only for SurfaceControl access
 
+    // protects the native state
+    private final Object mNativeObjectLock = new Object();
+
     private int mGenerationId; // incremented each time mNativeSurface changes
     @SuppressWarnings("UnusedDeclaration")
     private final Canvas mCanvas = new CompatibleCanvas();
@@ -157,12 +160,14 @@
      * This will make the surface invalid.
      */
     public void release() {
-        if (mNativeObject != 0) {
-            nativeRelease(mNativeObject);
-            mNativeObject = 0;
-            mGenerationId++;
+        synchronized (mNativeObjectLock) {
+            if (mNativeObject != 0) {
+                nativeRelease(mNativeObject);
+                mNativeObject = 0;
+                mGenerationId++;
+            }
+            mCloseGuard.close();
         }
-        mCloseGuard.close();
     }
 
     /**
@@ -182,8 +187,10 @@
      * Otherwise returns false.
      */
     public boolean isValid() {
-        if (mNativeObject == 0) return false;
-        return nativeIsValid(mNativeObject);
+        synchronized (mNativeObjectLock) {
+            if (mNativeObject == 0) return false;
+            return nativeIsValid(mNativeObject);
+        }
     }
 
     /**
@@ -204,8 +211,10 @@
      * @hide
      */
     public boolean isConsumerRunningBehind() {
-        checkNotReleased();
-        return nativeIsConsumerRunningBehind(mNativeObject);
+        synchronized (mNativeObjectLock) {
+            checkNotReleasedLocked();
+            return nativeIsConsumerRunningBehind(mNativeObject);
+        }
     }
 
     /**
@@ -225,8 +234,10 @@
      */
     public Canvas lockCanvas(Rect inOutDirty)
             throws OutOfResourcesException, IllegalArgumentException {
-        checkNotReleased();
-        return nativeLockCanvas(mNativeObject, inOutDirty);
+        synchronized (mNativeObjectLock) {
+            checkNotReleasedLocked();
+            return nativeLockCanvas(mNativeObject, inOutDirty);
+        }
     }
 
     /**
@@ -236,8 +247,10 @@
      * @param canvas The canvas previously obtained from {@link #lockCanvas}.
      */
     public void unlockCanvasAndPost(Canvas canvas) {
-        checkNotReleased();
-        nativeUnlockCanvasAndPost(mNativeObject, canvas);
+        synchronized (mNativeObjectLock) {
+            checkNotReleasedLocked();
+            nativeUnlockCanvasAndPost(mNativeObject, canvas);
+        }
     }
 
     /** 
@@ -278,38 +291,40 @@
             throw new NullPointerException(
                     "SurfaceControl native object is null. Are you using a released SurfaceControl?");
         }
-        mNativeObject = nativeCopyFrom(mNativeObject, other.mNativeObject);
-        if (mNativeObject == 0) {
-            // nativeCopyFrom released our reference
-            mCloseGuard.close();
+        synchronized (mNativeObjectLock) {
+            mNativeObject = nativeCopyFrom(mNativeObject, other.mNativeObject);
+            if (mNativeObject == 0) {
+                // nativeCopyFrom released our reference
+                mCloseGuard.close();
+            }
+            mGenerationId++;
         }
-        mGenerationId++;
     }
 
     /**
-     * Transfer the native state from 'other' to this surface, releasing it
-     * from 'other'.  This is for use in the client side for drawing into a
-     * surface; not guaranteed to work on the window manager side.
-     * This is for use by the client to move the underlying surface from
-     * one Surface object to another, in particular in SurfaceFlinger.
-     * @hide.
+     * This is intended to be used by {@link SurfaceView.updateWindow} only.
+     * @param other access is not thread safe
+     * @hide
+     * @deprecated
      */
+    @Deprecated
     public void transferFrom(Surface other) {
         if (other == null) {
             throw new IllegalArgumentException("other must not be null");
         }
         if (other != this) {
-            if (mNativeObject != 0) {
-                // release our reference to our native object
-                nativeRelease(mNativeObject);
+            synchronized (mNativeObjectLock) {
+                if (mNativeObject != 0) {
+                    // release our reference to our native object
+                    nativeRelease(mNativeObject);
+                }
+                // transfer the reference from other to us
+                if (other.mNativeObject != 0 && mNativeObject == 0) {
+                    mCloseGuard.open("release");
+                }
+                mNativeObject = other.mNativeObject;
+                mGenerationId++;
             }
-            // transfer the reference from other to us
-            if (other.mNativeObject != 0 && mNativeObject == 0) {
-                mCloseGuard.open("release");
-            }
-            mNativeObject = other.mNativeObject;
-            mGenerationId++;
-
             other.mNativeObject = 0;
             other.mGenerationId++;
             other.mCloseGuard.close();
@@ -325,13 +340,15 @@
         if (source == null) {
             throw new IllegalArgumentException("source must not be null");
         }
-        mName = source.readString();
-        int nativeObject = nativeReadFromParcel(mNativeObject, source);
-        if (nativeObject !=0 && mNativeObject == 0) {
-            mCloseGuard.open("release");
+        synchronized (mNativeObjectLock) {
+            mName = source.readString();
+            int nativeObject = nativeReadFromParcel(mNativeObject, source);
+            if (nativeObject !=0 && mNativeObject == 0) {
+                mCloseGuard.open("release");
+            }
+            mNativeObject = nativeObject;
+            mGenerationId++;
         }
-        mNativeObject = nativeObject;
-        mGenerationId++;
     }
 
     @Override
@@ -339,8 +356,10 @@
         if (dest == null) {
             throw new IllegalArgumentException("dest must not be null");
         }
-        dest.writeString(mName);
-        nativeWriteToParcel(mNativeObject, dest);
+        synchronized (mNativeObjectLock) {
+            dest.writeString(mName);
+            nativeWriteToParcel(mNativeObject, dest);
+        }
         if ((flags & Parcelable.PARCELABLE_WRITE_RETURN_VALUE) != 0) {
             release();
         }
@@ -433,7 +452,7 @@
         }
     }
 
-    private void checkNotReleased() {
+    private void checkNotReleasedLocked() {
         if (mNativeObject == 0) throw new NullPointerException(
                 "mNativeObject is null. Have you called release() already?");
     }
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index df07dcd..e869d09 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -574,7 +574,8 @@
      * @param maxLayer The highest (top-most Z order) surface layer to
      * include in the screenshot.
      * @return Returns a Bitmap containing the screen contents, or null
-     * if an error occurs.
+     * if an error occurs. Make sure to call Bitmap.recycle() as soon as
+     * possible, once its content is not needed anymore.
      */
     public static Bitmap screenshot(int width, int height, int minLayer, int maxLayer) {
         // TODO: should take the display as a parameter
@@ -586,6 +587,14 @@
     /**
      * Like {@link SurfaceControl#screenshot(int, int, int, int)} but includes all
      * Surfaces in the screenshot.
+     *
+     * @param width The desired width of the returned bitmap; the raw
+     * screen will be scaled down to this size.
+     * @param height The desired height of the returned bitmap; the raw
+     * screen will be scaled down to this size.
+     * @return Returns a Bitmap containing the screen contents, or null
+     * if an error occurs. Make sure to call Bitmap.recycle() as soon as
+     * possible, once its content is not needed anymore.
      */
     public static Bitmap screenshot(int width, int height) {
         // TODO: should take the display as a parameter
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 2fa9484..a5b3c8f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12098,7 +12098,7 @@
         //System.out.println("Attached! " + this);
         mAttachInfo = info;
         if (mOverlay != null) {
-            mOverlay.mAttachInfo = info;
+            mOverlay.dispatchAttachedToWindow(info, visibility);
         }
         mWindowAttachCount++;
         // We will need to evaluate the drawable state at least once.
@@ -12169,7 +12169,7 @@
 
         mAttachInfo = null;
         if (mOverlay != null) {
-            mOverlay.mAttachInfo = null;
+            mOverlay.dispatchDetachedFromWindow();
         }
     }
 
@@ -16990,6 +16990,14 @@
      *
      * @attr ref android.R.styleable#View_textDirection
      */
+    @ViewDebug.ExportedProperty(category = "text", mapping = {
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_INHERIT, to = "INHERIT"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_FIRST_STRONG, to = "FIRST_STRONG"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_ANY_RTL, to = "ANY_RTL"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_LTR, to = "LTR"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_RTL, to = "RTL"),
+            @ViewDebug.IntToString(from = TEXT_DIRECTION_LOCALE, to = "LOCALE")
+    })
     public int getTextDirection() {
         return (mPrivateFlags2 & PFLAG2_TEXT_DIRECTION_RESOLVED_MASK) >> PFLAG2_TEXT_DIRECTION_RESOLVED_MASK_SHIFT;
     }
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index d63f7bc..98edeae 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -51,6 +51,8 @@
 import java.util.Collections;
 import java.util.HashSet;
 
+import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
+
 /**
  * <p>
  * A <code>ViewGroup</code> is a special view that can contain other views
@@ -1868,13 +1870,37 @@
                     // have become out of sync.
                     removePointersFromTouchTargets(idBitsToAssign);
 
+                    final float x = ev.getX(actionIndex);
+                    final float y = ev.getY(actionIndex);
+
+                    if (mOverlay != null) {
+                        ViewOverlay overlay = (ViewOverlay) mOverlay;
+                        // Check to see whether the overlay can handle the event
+                        final View child = mOverlay;
+                        if (canViewReceivePointerEvents(child) &&
+                                isTransformedTouchPointInView(x, y, child, null)) {
+                            newTouchTarget = getTouchTarget(child);
+                            if (newTouchTarget != null) {
+                                newTouchTarget.pointerIdBits |= idBitsToAssign;
+                            } else {
+                                resetCancelNextUpFlag(child);
+                                if (dispatchTransformedTouchEvent(ev, false, child,
+                                        idBitsToAssign)) {
+                                    mLastTouchDownTime = ev.getDownTime();
+                                    mLastTouchDownX = ev.getX();
+                                    mLastTouchDownY = ev.getY();
+                                    newTouchTarget = addTouchTarget(child, idBitsToAssign);
+                                    alreadyDispatchedToNewTouchTarget = true;
+                                }
+                            }
+                        }
+                    }
+
                     final int childrenCount = mChildrenCount;
-                    if (childrenCount != 0 || mOverlay != null) {
+                    if (newTouchTarget == null && childrenCount != 0) {
                         // Find a child that can receive the event.
                         // Scan children from front to back.
                         final View[] children = mChildren;
-                        final float x = ev.getX(actionIndex);
-                        final float y = ev.getY(actionIndex);
 
                         final boolean customOrder = isChildrenDrawingOrderEnabled();
                         for (int i = childrenCount - 1; i >= 0; i--) {
@@ -1906,27 +1932,6 @@
                                 break;
                             }
                         }
-                        if (mOverlay != null && newTouchTarget == null) {
-                            // Check to see whether the overlay can handle the event
-                            final View child = mOverlay;
-                            if (canViewReceivePointerEvents(child) &&
-                                    isTransformedTouchPointInView(x, y, child, null)) {
-                                newTouchTarget = getTouchTarget(child);
-                                if (newTouchTarget != null) {
-                                    newTouchTarget.pointerIdBits |= idBitsToAssign;
-                                } else {
-                                    resetCancelNextUpFlag(child);
-                                    if (dispatchTransformedTouchEvent(ev, false, child,
-                                            idBitsToAssign)) {
-                                        mLastTouchDownTime = ev.getDownTime();
-                                        mLastTouchDownX = ev.getX();
-                                        mLastTouchDownY = ev.getY();
-                                        newTouchTarget = addTouchTarget(child, idBitsToAssign);
-                                        alreadyDispatchedToNewTouchTarget = true;
-                                    }
-                                }
-                            }
-                        }
                     }
 
                     if (newTouchTarget == null && mFirstTouchTarget != null) {
@@ -1957,7 +1962,7 @@
                         handled = true;
                     } else {
                         final boolean cancelChild = resetCancelNextUpFlag(target.child)
-                        || intercepted;
+                                || intercepted;
                         if (dispatchTransformedTouchEvent(ev, cancelChild,
                                 target.child, target.pointerIdBits)) {
                             handled = true;
@@ -5861,7 +5866,7 @@
          * to this field.
          */
         @ViewDebug.ExportedProperty(category = "layout")
-        private int startMargin = DEFAULT_RELATIVE;
+        private int startMargin = DEFAULT_MARGIN_RELATIVE;
 
         /**
          * The end margin in pixels of the child.
@@ -5869,21 +5874,21 @@
          * to this field.
          */
         @ViewDebug.ExportedProperty(category = "layout")
-        private int endMargin = DEFAULT_RELATIVE;
+        private int endMargin = DEFAULT_MARGIN_RELATIVE;
 
         /**
          * The default start and end margin.
          * @hide
          */
-        public static final int DEFAULT_RELATIVE = Integer.MIN_VALUE;
+        public static final int DEFAULT_MARGIN_RELATIVE = Integer.MIN_VALUE;
 
-        private int initialLeftMargin;
-        private int initialRightMargin;
+        // Layout direction is LTR by default
+        private int mLayoutDirection = LAYOUT_DIRECTION_LTR;
 
-        private static int LAYOUT_DIRECTION_UNDEFINED = -1;
+        private static int DEFAULT_MARGIN_RESOLVED = 0;
 
-        // Layout direction undefined by default
-        private int layoutDirection = LAYOUT_DIRECTION_UNDEFINED;
+        private boolean mNeedResolution = false;
+        private boolean mIsRtlCompatibilityMode = true;
 
         /**
          * Creates a new set of layout parameters. The values are extracted from
@@ -5910,21 +5915,30 @@
                 bottomMargin = margin;
             } else {
                 leftMargin = a.getDimensionPixelSize(
-                        R.styleable.ViewGroup_MarginLayout_layout_marginLeft, 0);
+                        R.styleable.ViewGroup_MarginLayout_layout_marginLeft,
+                        DEFAULT_MARGIN_RESOLVED);
                 topMargin = a.getDimensionPixelSize(
-                        R.styleable.ViewGroup_MarginLayout_layout_marginTop, 0);
+                        R.styleable.ViewGroup_MarginLayout_layout_marginTop,
+                        DEFAULT_MARGIN_RESOLVED);
                 rightMargin = a.getDimensionPixelSize(
-                        R.styleable.ViewGroup_MarginLayout_layout_marginRight, 0);
+                        R.styleable.ViewGroup_MarginLayout_layout_marginRight,
+                        DEFAULT_MARGIN_RESOLVED);
                 bottomMargin = a.getDimensionPixelSize(
-                        R.styleable.ViewGroup_MarginLayout_layout_marginBottom, 0);
+                        R.styleable.ViewGroup_MarginLayout_layout_marginBottom,
+                        DEFAULT_MARGIN_RESOLVED);
                 startMargin = a.getDimensionPixelSize(
-                        R.styleable.ViewGroup_MarginLayout_layout_marginStart, DEFAULT_RELATIVE);
+                        R.styleable.ViewGroup_MarginLayout_layout_marginStart,
+                        DEFAULT_MARGIN_RELATIVE);
                 endMargin = a.getDimensionPixelSize(
-                        R.styleable.ViewGroup_MarginLayout_layout_marginEnd, DEFAULT_RELATIVE);
+                        R.styleable.ViewGroup_MarginLayout_layout_marginEnd,
+                        DEFAULT_MARGIN_RELATIVE);
+
+                mNeedResolution = isMarginRelative();
             }
 
-            initialLeftMargin = leftMargin;
-            initialRightMargin = rightMargin;
+            final boolean hasRtlSupport = c.getApplicationInfo().hasRtlSupport();
+            final int targetSdkVersion = c.getApplicationInfo().targetSdkVersion;
+            mIsRtlCompatibilityMode = targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport;
 
             a.recycle();
         }
@@ -5934,6 +5948,9 @@
          */
         public MarginLayoutParams(int width, int height) {
             super(width, height);
+
+            mNeedResolution = false;
+            mIsRtlCompatibilityMode = false;
         }
 
         /**
@@ -5952,10 +5969,10 @@
             this.startMargin = source.startMargin;
             this.endMargin = source.endMargin;
 
-            this.initialLeftMargin = source.leftMargin;
-            this.initialRightMargin = source.rightMargin;
+            this.mNeedResolution = source.mNeedResolution;
+            this.mIsRtlCompatibilityMode = source.mIsRtlCompatibilityMode;
 
-            setLayoutDirection(source.layoutDirection);
+            setLayoutDirection(source.mLayoutDirection);
         }
 
         /**
@@ -5963,6 +5980,9 @@
          */
         public MarginLayoutParams(LayoutParams source) {
             super(source);
+
+            mNeedResolution = false;
+            mIsRtlCompatibilityMode = false;
         }
 
         /**
@@ -5985,8 +6005,7 @@
             topMargin = top;
             rightMargin = right;
             bottomMargin = bottom;
-            initialLeftMargin = left;
-            initialRightMargin = right;
+            mNeedResolution = isMarginRelative();
         }
 
         /**
@@ -6012,8 +6031,7 @@
             topMargin = top;
             endMargin = end;
             bottomMargin = bottom;
-            initialLeftMargin = 0;
-            initialRightMargin = 0;
+            mNeedResolution = true;
         }
 
         /**
@@ -6025,6 +6043,7 @@
          */
         public void setMarginStart(int start) {
             startMargin = start;
+            mNeedResolution = true;
         }
 
         /**
@@ -6035,8 +6054,11 @@
          * @return the start margin in pixels.
          */
         public int getMarginStart() {
-            if (startMargin != DEFAULT_RELATIVE) return startMargin;
-            switch(layoutDirection) {
+            if (startMargin != DEFAULT_MARGIN_RELATIVE) return startMargin;
+            if (mNeedResolution) {
+                doResolveMargins();
+            }
+            switch(mLayoutDirection) {
                 case View.LAYOUT_DIRECTION_RTL:
                     return rightMargin;
                 case View.LAYOUT_DIRECTION_LTR:
@@ -6054,6 +6076,7 @@
          */
         public void setMarginEnd(int end) {
             endMargin = end;
+            mNeedResolution = true;
         }
 
         /**
@@ -6064,8 +6087,11 @@
          * @return the end margin in pixels.
          */
         public int getMarginEnd() {
-            if (endMargin != DEFAULT_RELATIVE) return endMargin;
-            switch(layoutDirection) {
+            if (endMargin != DEFAULT_MARGIN_RELATIVE) return endMargin;
+            if (mNeedResolution) {
+                doResolveMargins();
+            }
+            switch(mLayoutDirection) {
                 case View.LAYOUT_DIRECTION_RTL:
                     return leftMargin;
                 case View.LAYOUT_DIRECTION_LTR:
@@ -6083,7 +6109,7 @@
          * @return true if either marginStart or marginEnd has been set.
          */
         public boolean isMarginRelative() {
-            return (startMargin != DEFAULT_RELATIVE) || (endMargin != DEFAULT_RELATIVE);
+            return (startMargin != DEFAULT_MARGIN_RELATIVE || endMargin != DEFAULT_MARGIN_RELATIVE);
         }
 
         /**
@@ -6095,7 +6121,10 @@
         public void setLayoutDirection(int layoutDirection) {
             if (layoutDirection != View.LAYOUT_DIRECTION_LTR &&
                     layoutDirection != View.LAYOUT_DIRECTION_RTL) return;
-            this.layoutDirection = layoutDirection;
+            if (layoutDirection != this.mLayoutDirection) {
+                this.mLayoutDirection = layoutDirection;
+                this.mNeedResolution = isMarginRelative();
+            }
         }
 
         /**
@@ -6105,7 +6134,7 @@
          * @return the layout direction.
          */
         public int getLayoutDirection() {
-            return layoutDirection;
+            return mLayoutDirection;
         }
 
         /**
@@ -6116,26 +6145,41 @@
         public void resolveLayoutDirection(int layoutDirection) {
             setLayoutDirection(layoutDirection);
 
-            if (!isMarginRelative()) return;
+            // No relative margin or pre JB-MR1 case or no need to resolve, just dont do anything
+            // Will use the left and right margins if no relative margin is defined.
+            if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode) return;
 
-            switch(layoutDirection) {
+            // Proceed with resolution
+            doResolveMargins();
+        }
+
+        private void doResolveMargins() {
+            // We have some relative margins (either the start one or the end one or both). So use
+            // them and override what has been defined for left and right margins. If either start
+            // or end margin is not defined, just set it to default "0".
+            switch(mLayoutDirection) {
                 case View.LAYOUT_DIRECTION_RTL:
-                    leftMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : initialLeftMargin;
-                    rightMargin = (startMargin > DEFAULT_RELATIVE) ? startMargin : initialRightMargin;
+                    leftMargin = (endMargin > DEFAULT_MARGIN_RELATIVE) ?
+                            endMargin : DEFAULT_MARGIN_RESOLVED;
+                    rightMargin = (startMargin > DEFAULT_MARGIN_RELATIVE) ?
+                            startMargin : DEFAULT_MARGIN_RESOLVED;
                     break;
                 case View.LAYOUT_DIRECTION_LTR:
                 default:
-                    leftMargin = (startMargin > DEFAULT_RELATIVE) ? startMargin : initialLeftMargin;
-                    rightMargin = (endMargin > DEFAULT_RELATIVE) ? endMargin : initialRightMargin;
+                    leftMargin = (startMargin > DEFAULT_MARGIN_RELATIVE) ?
+                            startMargin : DEFAULT_MARGIN_RESOLVED;
+                    rightMargin = (endMargin > DEFAULT_MARGIN_RELATIVE) ?
+                            endMargin : DEFAULT_MARGIN_RESOLVED;
                     break;
             }
+            mNeedResolution = false;
         }
 
         /**
          * @hide
          */
         public boolean isLayoutRtl() {
-            return (layoutDirection == View.LAYOUT_DIRECTION_RTL);
+            return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
         }
 
         /**
diff --git a/core/java/android/view/ViewOverlay.java b/core/java/android/view/ViewOverlay.java
index 8c2ab9d..8b18d53 100644
--- a/core/java/android/view/ViewOverlay.java
+++ b/core/java/android/view/ViewOverlay.java
@@ -23,17 +23,21 @@
 import java.util.ArrayList;
 
 /**
- * ViewOverlay is a container that View uses to host all objects (views and drawables) that
- * are added to its "overlay", gotten through {@link View#getOverlay()}. Views and drawables are
- * added to the overlay via the add/remove methods in this class. These views and drawables are
- * then drawn whenever the view itself is drawn, after which it will draw its overlay (if it
- * exists).
+ * ViewOverlay is a container that View uses to host all objects (views and
+ * drawables) that are added to its "overlay", gotten through
+ * {@link View#getOverlay()}. Views and drawables are added to the overlay
+ * via the add/remove methods in this class. These views and drawables are
+ * drawn whenever the view itself is drawn; first the view draws its own
+ * content (and children, if it is a ViewGroup), then it draws its overlay
+ * (if it has one).
  *
- * Besides managing and drawing the list of drawables, this class serves two purposes:
+ * Besides managing and drawing the list of drawables, this class serves
+ * two purposes:
  * (1) it noops layout calls because children are absolutely positioned and
- * (2) it forwards all invalidation calls to its host view. The invalidation redirect is
- * necessary because the overlay is not a child of the host view and invalidation cannot
- * therefore follow the normal path up through the parent hierarchy.
+ * (2) it forwards all invalidation calls to its host view. The invalidation
+ * redirect is necessary because the overlay is not a child of the host view
+ * and invalidation cannot therefore follow the normal path up through the
+ * parent hierarchy.
  *
  * @hide
  */
@@ -65,6 +69,7 @@
             // Make each drawable unique in the overlay; can't add it more than once
             mDrawables.add(drawable);
             invalidate(drawable.getBounds());
+            drawable.setCallback(this);
         }
     }
 
@@ -73,11 +78,33 @@
         if (mDrawables != null) {
             mDrawables.remove(drawable);
             invalidate(drawable.getBounds());
+            drawable.setCallback(null);
         }
     }
 
     @Override
+    public void invalidateDrawable(Drawable drawable) {
+        invalidate(drawable.getBounds());
+    }
+
+    @Override
     public void add(View child) {
+        int deltaX = 0;
+        int deltaY = 0;
+        if (child.getParent() instanceof ViewGroup) {
+            ViewGroup parent = (ViewGroup) child.getParent();
+            if (parent != mHostView) {
+                // Moving to different container; figure out how to position child such that
+                // it is in the same location on the screen
+                int[] parentLocation = new int[2];
+                int[] hostViewLocation = new int[2];
+                parent.getLocationOnScreen(parentLocation);
+                mHostView.getLocationOnScreen(hostViewLocation);
+                child.offsetLeftAndRight(parentLocation[0] - hostViewLocation[0]);
+                child.offsetTopAndBottom(parentLocation[1] - hostViewLocation[1]);
+            }
+            parent.removeView(child);
+        }
         super.addView(child);
     }
 
@@ -126,7 +153,6 @@
     public void invalidate(Rect dirty) {
         super.invalidate(dirty);
         if (mHostView != null) {
-            dirty.offset(getLeft(), getTop());
             mHostView.invalidate(dirty);
         }
     }
@@ -196,7 +222,15 @@
     @Override
     public ViewParent invalidateChildInParent(int[] location, Rect dirty) {
         if (mHostView != null) {
-            mHostView.invalidate(dirty);
+            dirty.offset(location[0], location[1]);
+            if (mHostView instanceof ViewGroup) {
+                location[0] = 0;
+                location[1] = 0;
+                super.invalidateChildInParent(location, dirty);
+                return ((ViewGroup) mHostView).invalidateChildInParent(location, dirty);
+            } else {
+                invalidate(dirty);
+            }
         }
         return null;
     }
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 8808af0..7b34ce1 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -107,6 +107,7 @@
     private static final boolean DEBUG_IMF = false || LOCAL_LOGV;
     private static final boolean DEBUG_CONFIGURATION = false || LOCAL_LOGV;
     private static final boolean DEBUG_FPS = false;
+    private static final boolean DEBUG_INPUT_PROCESSING = false || LOCAL_LOGV;
 
     private static final boolean USE_RENDER_THREAD = false;
 
@@ -231,22 +232,38 @@
     int mClientWindowLayoutFlags;
     boolean mLastOverscanRequested;
 
-    /** @hide */
+     /** Event was not handled and is finished.
+      * @hide */
     public static final int EVENT_NOT_HANDLED = 0;
-    /** @hide */
+     /** Event was handled and is finished.
+      * @hide */
     public static final int EVENT_HANDLED = 1;
-    /** @hide */
-    public static final int EVENT_IN_PROGRESS = 2;
+    /** Event is waiting on the IME.
+     * @hide */
+    public static final int EVENT_PENDING_IME = 2;
+    /** Event requires post-IME dispatch.
+     * @hide */
+    public static final int EVENT_POST_IME = 3;
 
     // Pool of queued input events.
     private static final int MAX_QUEUED_INPUT_EVENT_POOL_SIZE = 10;
     private QueuedInputEvent mQueuedInputEventPool;
     private int mQueuedInputEventPoolSize;
 
-    // Input event queue.
-    QueuedInputEvent mFirstPendingInputEvent;
-    QueuedInputEvent mCurrentInputEvent;
+    /* Input event queue.
+     * Pending input events are input events waiting to be handled by the application. Current
+     * input events are input events which are being handled but are waiting on some action by the
+     * IME, even if they themselves may not need to be handled by the IME.
+     */
+    QueuedInputEvent mPendingInputEventHead;
+    QueuedInputEvent mPendingInputEventTail;
+    int mPendingInputEventCount;
+    QueuedInputEvent mCurrentInputEventHead;
+    QueuedInputEvent mCurrentInputEventTail;
+    int mCurrentInputEventCount;
     boolean mProcessInputEventsScheduled;
+    String mPendingInputEventQueueLengthCounterName = "pq";
+    String mCurrentInputEventQueueLengthCounterName = "cq";
 
     boolean mWindowAttributesChanged = false;
     int mWindowAttributesChangesFlag = 0;
@@ -642,6 +659,9 @@
                 if (view.getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
                     view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
                 }
+
+                mPendingInputEventQueueLengthCounterName = "pq:" + attrs.getTitle();
+                mCurrentInputEventQueueLengthCounterName = "cq:" + attrs.getTitle();
             }
         }
     }
@@ -1213,6 +1233,7 @@
                 host.setLayoutDirection(mLastConfiguration.getLayoutDirection());
             }
             host.dispatchAttachedToWindow(attachInfo, 0);
+            attachInfo.mTreeObserver.dispatchOnWindowAttachedChange(true);
             mFitSystemWindowsInsets.set(mAttachInfo.mContentInsets);
             host.fitSystemWindows(mFitSystemWindowsInsets);
             //Log.i(TAG, "Screen on initialized: " + attachInfo.mKeepScreenOn);
@@ -2807,6 +2828,7 @@
                     mAttachInfo.mHardwareRenderer.isEnabled()) {
                 mAttachInfo.mHardwareRenderer.validate();
             }
+            mAttachInfo.mTreeObserver.dispatchOnWindowAttachedChange(false);
             mView.dispatchDetachedFromWindow();
         }
 
@@ -2915,7 +2937,6 @@
     private final static int MSG_DISPATCH_KEY = 7;
     private final static int MSG_DISPATCH_APP_VISIBILITY = 8;
     private final static int MSG_DISPATCH_GET_NEW_SURFACE = 9;
-    private final static int MSG_IME_FINISHED_EVENT = 10;
     private final static int MSG_DISPATCH_KEY_FROM_IME = 11;
     private final static int MSG_FINISH_INPUT_CONNECTION = 12;
     private final static int MSG_CHECK_FOCUS = 13;
@@ -2930,6 +2951,8 @@
     private final static int MSG_DISPATCH_DONE_ANIMATING = 22;
     private final static int MSG_INVALIDATE_WORLD = 23;
     private final static int MSG_WINDOW_MOVED = 24;
+    private final static int MSG_ENQUEUE_X_AXIS_KEY_REPEAT = 25;
+    private final static int MSG_ENQUEUE_Y_AXIS_KEY_REPEAT = 26;
 
     final class ViewRootHandler extends Handler {
         @Override
@@ -2953,8 +2976,6 @@
                     return "MSG_DISPATCH_APP_VISIBILITY";
                 case MSG_DISPATCH_GET_NEW_SURFACE:
                     return "MSG_DISPATCH_GET_NEW_SURFACE";
-                case MSG_IME_FINISHED_EVENT:
-                    return "MSG_IME_FINISHED_EVENT";
                 case MSG_DISPATCH_KEY_FROM_IME:
                     return "MSG_DISPATCH_KEY_FROM_IME";
                 case MSG_FINISH_INPUT_CONNECTION:
@@ -2981,6 +3002,10 @@
                     return "MSG_DISPATCH_DONE_ANIMATING";
                 case MSG_WINDOW_MOVED:
                     return "MSG_WINDOW_MOVED";
+                case MSG_ENQUEUE_X_AXIS_KEY_REPEAT:
+                    return "MSG_ENQUEUE_X_AXIS_KEY_REPEAT";
+                case MSG_ENQUEUE_Y_AXIS_KEY_REPEAT:
+                    return "MSG_ENQUEUE_Y_AXIS_KEY_REPEAT";
             }
             return super.getMessageName(message);
         }
@@ -2996,9 +3021,6 @@
                 info.target.invalidate(info.left, info.top, info.right, info.bottom);
                 info.recycle();
                 break;
-            case MSG_IME_FINISHED_EVENT:
-                handleImeFinishedEvent(msg.arg1, msg.arg2 != 0);
-                break;
             case MSG_PROCESS_INPUT_EVENTS:
                 mProcessInputEventsScheduled = false;
                 doProcessInputEvents();
@@ -3107,6 +3129,7 @@
                         }
                         mAttachInfo.mKeyDispatchState.reset();
                         mView.dispatchWindowFocusChanged(hasWindowFocus);
+                        mAttachInfo.mTreeObserver.dispatchOnWindowFocusChange(hasWindowFocus);
                     }
 
                     // Note: must be done after the focus change callbacks,
@@ -3206,6 +3229,18 @@
                     invalidateWorld(mView);
                 }
             } break;
+            case MSG_ENQUEUE_X_AXIS_KEY_REPEAT:
+            case MSG_ENQUEUE_Y_AXIS_KEY_REPEAT: {
+                KeyEvent oldEvent = (KeyEvent)msg.obj;
+                KeyEvent e = KeyEvent.changeTimeRepeat(oldEvent, SystemClock.uptimeMillis(),
+                        oldEvent.getRepeatCount() + 1);
+                if (mAttachInfo.mHasWindowFocus) {
+                    enqueueInputEvent(e);
+                    Message m = obtainMessage(msg.what, e);
+                    m.setAsynchronous(true);
+                    sendMessageDelayed(m, mViewConfiguration.getKeyRepeatDelay());
+                }
+            } break;
             }
         }
     }
@@ -3421,30 +3456,15 @@
             mInputEventConsistencyVerifier.onTrackballEvent(event, 0);
         }
 
+        int result = EVENT_POST_IME;
         if (mView != null && mAdded && (q.mFlags & QueuedInputEvent.FLAG_DELIVER_POST_IME) == 0) {
             if (LOCAL_LOGV)
                 Log.v(TAG, "Dispatching trackball " + event + " to " + mView);
 
             // Dispatch to the IME before propagating down the view hierarchy.
-            // The IME will eventually call back into handleImeFinishedEvent.
-            if (mLastWasImTarget) {
-                InputMethodManager imm = InputMethodManager.peekInstance();
-                if (imm != null) {
-                    final int seq = event.getSequenceNumber();
-                    if (DEBUG_IMF)
-                        Log.v(TAG, "Sending trackball event to IME: seq="
-                                + seq + " event=" + event);
-                    int result = imm.dispatchTrackballEvent(mView.getContext(), seq, event,
-                            mInputMethodCallback);
-                    if (result != EVENT_NOT_HANDLED) {
-                        return result;
-                    }
-                }
-            }
+            result = dispatchImeInputEvent(q);
         }
-
-        // Not dispatching to IME, continue with post IME actions.
-        return deliverTrackballEventPostIme(q);
+        return result;
     }
 
     private int deliverTrackballEventPostIme(QueuedInputEvent q) {
@@ -3543,7 +3563,7 @@
                     + " accelMovement=" + accelMovement
                     + " accel=" + accel);
             if (accelMovement > movement) {
-                if (DEBUG_TRACKBALL) Log.v("foo", "Delivering fake DPAD: "
+                if (DEBUG_TRACKBALL) Log.v(TAG, "Delivering fake DPAD: "
                         + keycode);
                 movement--;
                 int repeatCount = accelMovement - movement;
@@ -3553,7 +3573,7 @@
                         InputDevice.SOURCE_KEYBOARD));
             }
             while (movement > 0) {
-                if (DEBUG_TRACKBALL) Log.v("foo", "Delivering fake DPAD: "
+                if (DEBUG_TRACKBALL) Log.v(TAG, "Delivering fake DPAD: "
                         + keycode);
                 movement--;
                 curTime = SystemClock.uptimeMillis();
@@ -3579,30 +3599,16 @@
         if (mInputEventConsistencyVerifier != null) {
             mInputEventConsistencyVerifier.onGenericMotionEvent(event, 0);
         }
+
+        int result = EVENT_POST_IME;
         if (mView != null && mAdded && (q.mFlags & QueuedInputEvent.FLAG_DELIVER_POST_IME) == 0) {
             if (LOCAL_LOGV)
                 Log.v(TAG, "Dispatching generic motion " + event + " to " + mView);
 
             // Dispatch to the IME before propagating down the view hierarchy.
-            // The IME will eventually call back into handleImeFinishedEvent.
-            if (mLastWasImTarget) {
-                InputMethodManager imm = InputMethodManager.peekInstance();
-                if (imm != null) {
-                    final int seq = event.getSequenceNumber();
-                    if (DEBUG_IMF)
-                        Log.v(TAG, "Sending generic motion event to IME: seq="
-                                + seq + " event=" + event);
-                    int result = imm.dispatchGenericMotionEvent(mView.getContext(), seq, event,
-                            mInputMethodCallback);
-                    if (result != EVENT_NOT_HANDLED) {
-                        return result;
-                    }
-                }
-            }
+            result = dispatchImeInputEvent(q);
         }
-
-        // Not dispatching to IME, continue with post IME actions.
-        return deliverGenericMotionEventPostIme(q);
+        return result;
     }
 
     private int deliverGenericMotionEventPostIme(QueuedInputEvent q) {
@@ -3662,6 +3668,7 @@
 
         if (xDirection != mLastJoystickXDirection) {
             if (mLastJoystickXKeyCode != 0) {
+                mHandler.removeMessages(MSG_ENQUEUE_X_AXIS_KEY_REPEAT);
                 enqueueInputEvent(new KeyEvent(time, time,
                         KeyEvent.ACTION_UP, mLastJoystickXKeyCode, 0, metaState,
                         deviceId, 0, KeyEvent.FLAG_FALLBACK, source));
@@ -3673,14 +3680,19 @@
             if (xDirection != 0 && synthesizeNewKeys) {
                 mLastJoystickXKeyCode = xDirection > 0
                         ? KeyEvent.KEYCODE_DPAD_RIGHT : KeyEvent.KEYCODE_DPAD_LEFT;
-                enqueueInputEvent(new KeyEvent(time, time,
+                final KeyEvent e = new KeyEvent(time, time,
                         KeyEvent.ACTION_DOWN, mLastJoystickXKeyCode, 0, metaState,
-                        deviceId, 0, KeyEvent.FLAG_FALLBACK, source));
+                        deviceId, 0, KeyEvent.FLAG_FALLBACK, source);
+                enqueueInputEvent(e);
+                Message m = mHandler.obtainMessage(MSG_ENQUEUE_X_AXIS_KEY_REPEAT, e);
+                m.setAsynchronous(true);
+                mHandler.sendMessageDelayed(m, mViewConfiguration.getKeyRepeatTimeout());
             }
         }
 
         if (yDirection != mLastJoystickYDirection) {
             if (mLastJoystickYKeyCode != 0) {
+                mHandler.removeMessages(MSG_ENQUEUE_Y_AXIS_KEY_REPEAT);
                 enqueueInputEvent(new KeyEvent(time, time,
                         KeyEvent.ACTION_UP, mLastJoystickYKeyCode, 0, metaState,
                         deviceId, 0, KeyEvent.FLAG_FALLBACK, source));
@@ -3692,9 +3704,13 @@
             if (yDirection != 0 && synthesizeNewKeys) {
                 mLastJoystickYKeyCode = yDirection > 0
                         ? KeyEvent.KEYCODE_DPAD_DOWN : KeyEvent.KEYCODE_DPAD_UP;
-                enqueueInputEvent(new KeyEvent(time, time,
+                final KeyEvent e = new KeyEvent(time, time,
                         KeyEvent.ACTION_DOWN, mLastJoystickYKeyCode, 0, metaState,
-                        deviceId, 0, KeyEvent.FLAG_FALLBACK, source));
+                        deviceId, 0, KeyEvent.FLAG_FALLBACK, source);
+                enqueueInputEvent(e);
+                Message m = mHandler.obtainMessage(MSG_ENQUEUE_Y_AXIS_KEY_REPEAT, e);
+                m.setAsynchronous(true);
+                mHandler.sendMessageDelayed(m, mViewConfiguration.getKeyRepeatTimeout());
             }
         }
     }
@@ -3791,6 +3807,7 @@
             mInputEventConsistencyVerifier.onKeyEvent(event, 0);
         }
 
+        int result = EVENT_POST_IME;
         if (mView != null && mAdded && (q.mFlags & QueuedInputEvent.FLAG_DELIVER_POST_IME) == 0) {
             if (LOCAL_LOGV) Log.v(TAG, "Dispatching key " + event + " to " + mView);
 
@@ -3800,24 +3817,9 @@
             }
 
             // Dispatch to the IME before propagating down the view hierarchy.
-            // The IME will eventually call back into handleImeFinishedEvent.
-            if (mLastWasImTarget) {
-                InputMethodManager imm = InputMethodManager.peekInstance();
-                if (imm != null) {
-                    final int seq = event.getSequenceNumber();
-                    if (DEBUG_IMF) Log.v(TAG, "Sending key event to IME: seq="
-                            + seq + " event=" + event);
-                    int result = imm.dispatchKeyEvent(mView.getContext(), seq, event,
-                            mInputMethodCallback);
-                    if (result != EVENT_NOT_HANDLED) {
-                        return result;
-                    }
-                }
-            }
+            result = dispatchImeInputEvent(q);
         }
-
-        // Not dispatching to IME, continue with post IME actions.
-        return deliverKeyEventPostIme(q);
+        return result;
     }
 
     private int deliverKeyEventPostIme(QueuedInputEvent q) {
@@ -4306,14 +4308,6 @@
         }
     }
 
-    void dispatchImeFinishedEvent(int seq, boolean handled) {
-        Message msg = mHandler.obtainMessage(MSG_IME_FINISHED_EVENT);
-        msg.arg1 = seq;
-        msg.arg2 = handled ? 1 : 0;
-        msg.setAsynchronous(true);
-        mHandler.sendMessage(msg);
-    }
-
     public void dispatchFinishInputConnection(InputConnection connection) {
         Message msg = mHandler.obtainMessage(MSG_FINISH_INPUT_CONNECTION, connection);
         mHandler.sendMessage(msg);
@@ -4418,15 +4412,17 @@
         // in response to touch events and we want to ensure that the injected keys
         // are processed in the order they were received and we cannot trust that
         // the time stamp of injected events are monotonic.
-        QueuedInputEvent last = mFirstPendingInputEvent;
+        QueuedInputEvent last = mPendingInputEventTail;
         if (last == null) {
-            mFirstPendingInputEvent = q;
+            mPendingInputEventHead = q;
+            mPendingInputEventTail = q;
         } else {
-            while (last.mNext != null) {
-                last = last.mNext;
-            }
             last.mNext = q;
+            mPendingInputEventTail = q;
         }
+        mPendingInputEventCount += 1;
+        Trace.traceCounter(Trace.TRACE_TAG_INPUT, mPendingInputEventQueueLengthCounterName,
+                mPendingInputEventCount);
 
         if (processImmediately) {
             doProcessInputEvents();
@@ -4445,15 +4441,44 @@
     }
 
     void doProcessInputEvents() {
-        while (mCurrentInputEvent == null && mFirstPendingInputEvent != null) {
-            QueuedInputEvent q = mFirstPendingInputEvent;
-            mFirstPendingInputEvent = q.mNext;
+        // Handle all of the available pending input events. Currently this will immediately
+        // process all of the events it can until it encounters one that must go through the IME.
+        // After that it will continue adding events to the current input queue but will wait for a
+        // response from the IME, regardless of whether that particular event needs it or not, in
+        // order to guarantee ordering consistency. This could be slightly improved by only
+        // queueing events whose source has previously encountered something that needs to be
+        // handled by the IME, and otherwise handling them immediately since we only need to
+        // guarantee ordering within a given source.
+        while (mPendingInputEventHead != null) {
+            QueuedInputEvent q = mPendingInputEventHead;
+            mPendingInputEventHead = q.mNext;
+            if (mPendingInputEventHead == null) {
+                mPendingInputEventTail = null;
+            }
             q.mNext = null;
-            mCurrentInputEvent = q;
 
-            final int result = deliverInputEvent(q);
-            if (result != EVENT_IN_PROGRESS) {
-                finishCurrentInputEvent(result == EVENT_HANDLED);
+            mPendingInputEventCount -= 1;
+            Trace.traceCounter(Trace.TRACE_TAG_INPUT, mPendingInputEventQueueLengthCounterName,
+                    mPendingInputEventCount);
+
+            int result = deliverInputEvent(q);
+
+            if (result == EVENT_HANDLED || result == EVENT_NOT_HANDLED) {
+                finishInputEvent(q, result == EVENT_HANDLED);
+            } else if (result == EVENT_PENDING_IME) {
+                enqueueCurrentInputEvent(q);
+            } else {
+                q.mFlags |= QueuedInputEvent.FLAG_DELIVER_POST_IME;
+                // If the IME decided not to handle this event, and we have no events already being
+                // handled by the IME, go ahead and handle this one and then continue to the next
+                // input event. Otherwise, queue it up and handle it after whatever in front of it
+                // in the queue has been handled.
+                if (mCurrentInputEventHead == null) {
+                    result = deliverInputEventPostIme(q);
+                    finishInputEvent(q, result == EVENT_HANDLED);
+                } else {
+                    enqueueCurrentInputEvent(q);
+                }
             }
         }
 
@@ -4465,9 +4490,51 @@
         }
     }
 
+    private void enqueueCurrentInputEvent(QueuedInputEvent q) {
+        if (mCurrentInputEventHead == null) {
+            mCurrentInputEventHead = q;
+            mCurrentInputEventTail = q;
+        } else {
+            mCurrentInputEventTail.mNext = q;
+            mCurrentInputEventTail = q;
+        }
+        mCurrentInputEventCount += 1;
+        Trace.traceCounter(Trace.TRACE_TAG_INPUT, mCurrentInputEventQueueLengthCounterName,
+                mCurrentInputEventCount);
+    }
+
+    private QueuedInputEvent dequeueCurrentInputEvent() {
+        QueuedInputEvent q = mCurrentInputEventHead;
+        mCurrentInputEventHead = q.mNext;
+        if (mCurrentInputEventHead == null) {
+            mCurrentInputEventTail = null;
+        }
+        q.mNext = null;
+        mCurrentInputEventCount -= 1;
+        Trace.traceCounter(Trace.TRACE_TAG_INPUT, mCurrentInputEventQueueLengthCounterName,
+                mCurrentInputEventCount);
+        return q;
+    }
+
+    int dispatchImeInputEvent(QueuedInputEvent q) {
+        if (mLastWasImTarget) {
+            InputMethodManager imm = InputMethodManager.peekInstance();
+            if (imm != null) {
+                final InputEvent event = q.mEvent;
+                final int seq = event.getSequenceNumber();
+                if (DEBUG_IMF)
+                    Log.v(TAG, "Sending input event to IME: seq=" + seq + " event=" + event);
+                return imm.dispatchInputEvent(mView.getContext(), seq, event,
+                        mInputMethodCallback);
+            }
+        }
+        return EVENT_POST_IME;
+    }
+
     void handleImeFinishedEvent(int seq, boolean handled) {
-        final QueuedInputEvent q = mCurrentInputEvent;
+        QueuedInputEvent q = mCurrentInputEventHead;
         if (q != null && q.mEvent.getSequenceNumber() == seq) {
+            dequeueCurrentInputEvent();
             if (DEBUG_IMF) {
                 Log.v(TAG, "IME finished event: seq=" + seq
                         + " handled=" + handled + " event=" + q);
@@ -4486,22 +4553,26 @@
                     }
                 }
             }
-            finishCurrentInputEvent(handled);
 
-            // Immediately start processing the next input event.
-            doProcessInputEvents();
+            finishInputEvent(q, handled);
+
+            // Flush all of the input events that are no longer waiting on the IME
+            while (mCurrentInputEventHead != null && (mCurrentInputEventHead.mFlags &
+                        QueuedInputEvent.FLAG_DELIVER_POST_IME) != 0) {
+                q = dequeueCurrentInputEvent();
+                final int result = deliverInputEventPostIme(q);
+                finishInputEvent(q, result == EVENT_HANDLED);
+            }
         } else {
             if (DEBUG_IMF) {
                 Log.v(TAG, "IME finished event: seq=" + seq
                         + " handled=" + handled + ", event not found!");
             }
         }
+
     }
 
-    private void finishCurrentInputEvent(boolean handled) {
-        final QueuedInputEvent q = mCurrentInputEvent;
-        mCurrentInputEvent = null;
-
+    private void finishInputEvent(QueuedInputEvent q, boolean handled) {
         if (q.mReceiver != null) {
             q.mReceiver.finishInputEvent(q.mEvent, handled);
         } else {
@@ -5059,7 +5130,7 @@
         public void finishedEvent(int seq, boolean handled) {
             final ViewRootImpl viewAncestor = mViewAncestor.get();
             if (viewAncestor != null) {
-                viewAncestor.dispatchImeFinishedEvent(seq, handled);
+                viewAncestor.handleImeFinishedEvent(seq, handled);
             }
         }
     }
diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java
index cfcf3c0..072c95f 100644
--- a/core/java/android/view/ViewTreeObserver.java
+++ b/core/java/android/view/ViewTreeObserver.java
@@ -33,6 +33,8 @@
  */
 public final class ViewTreeObserver {
     // Recursive listeners use CopyOnWriteArrayList
+    private CopyOnWriteArrayList<OnWindowFocusChangeListener> mOnWindowFocusListeners;
+    private CopyOnWriteArrayList<OnWindowAttachListener> mOnWindowAttachListeners;
     private CopyOnWriteArrayList<OnGlobalFocusChangeListener> mOnGlobalFocusListeners;
     private CopyOnWriteArrayList<OnTouchModeChangeListener> mOnTouchModeChangeListeners;
 
@@ -49,6 +51,36 @@
     private boolean mAlive = true;
 
     /**
+     * Interface definition for a callback to be invoked when the view hierarchy is
+     * attached to and detached from its window.
+     */
+    public interface OnWindowAttachListener {
+        /**
+         * Callback method to be invoked when the view hierarchy is attached to a window
+         */
+        public void onWindowAttached();
+
+        /**
+         * Callback method to be invoked when the view hierarchy is detached from a window
+         */
+        public void onWindowDetached();
+    }
+
+    /**
+     * Interface definition for a callback to be invoked when the view hierarchy's window
+     * focus state changes.
+     */
+    public interface OnWindowFocusChangeListener {
+        /**
+         * Callback method to be invoked when the window focus changes in the view tree.
+         *
+         * @param hasFocus Set to true if the window is gaining focus, false if it is
+         * losing focus.
+         */
+        public void onWindowFocusChanged(boolean hasFocus);
+    }
+
+    /**
      * Interface definition for a callback to be invoked when the focus state within
      * the view tree changes.
      */
@@ -272,6 +304,22 @@
      * @param observer The ViewTreeObserver whose listeners must be added to this observer
      */
     void merge(ViewTreeObserver observer) {
+        if (observer.mOnWindowAttachListeners != null) {
+            if (mOnWindowAttachListeners != null) {
+                mOnWindowAttachListeners.addAll(observer.mOnWindowAttachListeners);
+            } else {
+                mOnWindowAttachListeners = observer.mOnWindowAttachListeners;
+            }
+        }
+
+        if (observer.mOnWindowFocusListeners != null) {
+            if (mOnWindowFocusListeners != null) {
+                mOnWindowFocusListeners.addAll(observer.mOnWindowFocusListeners);
+            } else {
+                mOnWindowFocusListeners = observer.mOnWindowFocusListeners;
+            }
+        }
+
         if (observer.mOnGlobalFocusListeners != null) {
             if (mOnGlobalFocusListeners != null) {
                 mOnGlobalFocusListeners.addAll(observer.mOnGlobalFocusListeners);
@@ -324,6 +372,76 @@
     }
 
     /**
+     * Register a callback to be invoked when the view hierarchy is attached to a window.
+     *
+     * @param listener The callback to add
+     *
+     * @throws IllegalStateException If {@link #isAlive()} returns false
+     */
+    public void addOnWindowAttachListener(OnWindowAttachListener listener) {
+        checkIsAlive();
+
+        if (mOnWindowAttachListeners == null) {
+            mOnWindowAttachListeners
+                    = new CopyOnWriteArrayList<OnWindowAttachListener>();
+        }
+
+        mOnWindowAttachListeners.add(listener);
+    }
+
+    /**
+     * Remove a previously installed window attach callback.
+     *
+     * @param victim The callback to remove
+     *
+     * @throws IllegalStateException If {@link #isAlive()} returns false
+     *
+     * @see #addOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener)
+     */
+    public void removeOnWindowAttachListener(OnWindowAttachListener victim) {
+        checkIsAlive();
+        if (mOnWindowAttachListeners == null) {
+            return;
+        }
+        mOnWindowAttachListeners.remove(victim);
+    }
+
+    /**
+     * Register a callback to be invoked when the window focus state within the view tree changes.
+     *
+     * @param listener The callback to add
+     *
+     * @throws IllegalStateException If {@link #isAlive()} returns false
+     */
+    public void addOnWindowFocusChangeListener(OnWindowFocusChangeListener listener) {
+        checkIsAlive();
+
+        if (mOnWindowFocusListeners == null) {
+            mOnWindowFocusListeners
+                    = new CopyOnWriteArrayList<OnWindowFocusChangeListener>();
+        }
+
+        mOnWindowFocusListeners.add(listener);
+    }
+
+    /**
+     * Remove a previously installed window focus change callback.
+     *
+     * @param victim The callback to remove
+     *
+     * @throws IllegalStateException If {@link #isAlive()} returns false
+     *
+     * @see #addOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener)
+     */
+    public void removeOnWindowFocusChangeListener(OnWindowFocusChangeListener victim) {
+        checkIsAlive();
+        if (mOnWindowFocusListeners == null) {
+            return;
+        }
+        mOnWindowFocusListeners.remove(victim);
+    }
+
+    /**
      * Register a callback to be invoked when the focus state within the view tree changes.
      *
      * @param listener The callback to add
@@ -621,6 +739,41 @@
     }
 
     /**
+     * Notifies registered listeners that window has been attached/detached.
+     */
+    final void dispatchOnWindowAttachedChange(boolean attached) {
+        // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to
+        // perform the dispatching. The iterator is a safe guard against listeners that
+        // could mutate the list by calling the various add/remove methods. This prevents
+        // the array from being modified while we iterate it.
+        final CopyOnWriteArrayList<OnWindowAttachListener> listeners
+                = mOnWindowAttachListeners;
+        if (listeners != null && listeners.size() > 0) {
+            for (OnWindowAttachListener listener : listeners) {
+                if (attached) listener.onWindowAttached();
+                else listener.onWindowDetached();
+            }
+        }
+    }
+
+    /**
+     * Notifies registered listeners that window focus has changed.
+     */
+    final void dispatchOnWindowFocusChange(boolean hasFocus) {
+        // NOTE: because of the use of CopyOnWriteArrayList, we *must* use an iterator to
+        // perform the dispatching. The iterator is a safe guard against listeners that
+        // could mutate the list by calling the various add/remove methods. This prevents
+        // the array from being modified while we iterate it.
+        final CopyOnWriteArrayList<OnWindowFocusChangeListener> listeners
+                = mOnWindowFocusListeners;
+        if (listeners != null && listeners.size() > 0) {
+            for (OnWindowFocusChangeListener listener : listeners) {
+                listener.onWindowFocusChanged(hasFocus);
+            }
+        }
+    }
+
+    /**
      * Notifies registered listeners that focus has changed.
      */
     final void dispatchOnGlobalFocusChange(View oldFocus, View newFocus) {
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index d258f4d..4207832 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -19,7 +19,6 @@
 import com.android.internal.os.SomeArgs;
 import com.android.internal.view.IInputConnectionWrapper;
 import com.android.internal.view.IInputContext;
-import com.android.internal.view.IInputMethodCallback;
 import com.android.internal.view.IInputMethodClient;
 import com.android.internal.view.IInputMethodManager;
 import com.android.internal.view.IInputMethodSession;
@@ -40,8 +39,10 @@
 import android.util.Log;
 import android.util.PrintWriterPrinter;
 import android.util.Printer;
+import android.view.InputChannel;
+import android.view.InputEvent;
+import android.view.InputEventSender;
 import android.view.KeyEvent;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewRootImpl;
 
@@ -319,6 +320,8 @@
      * The actual instance of the method to make calls on it.
      */
     IInputMethodSession mCurMethod;
+    InputChannel mCurChannel;
+    ImeInputEventSender mCurSender;
 
     PendingEvent mPendingEventPool;
     int mPendingEventPoolSize;
@@ -363,10 +366,17 @@
                         if (mBindSequence < 0 || mBindSequence != res.sequence) {
                             Log.w(TAG, "Ignoring onBind: cur seq=" + mBindSequence
                                     + ", given seq=" + res.sequence);
+                            if (res.channel != null) {
+                                res.channel.dispose();
+                            }
                             return;
                         }
                         
                         mCurMethod = res.method;
+                        if (mCurChannel != null) {
+                            mCurChannel.dispose();
+                        }
+                        mCurChannel = res.channel;
                         mCurId = res.id;
                         mBindSequence = res.sequence;
                     }
@@ -482,10 +492,10 @@
     }
     
     final IInputMethodClient.Stub mClient = new IInputMethodClient.Stub() {
-        @Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+        @Override
+        protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
             // No need to check for dump permission, since we only give this
             // interface to the system.
-            
             CountDownLatch latch = new CountDownLatch(1);
             SomeArgs sargs = SomeArgs.obtain();
             sargs.arg1 = fd;
@@ -501,37 +511,29 @@
                 fout.println("Interrupted waiting for dump");
             }
         }
-        
+
+        @Override
         public void setUsingInputMethod(boolean state) {
         }
-        
+
+        @Override
         public void onBindMethod(InputBindResult res) {
             mH.sendMessage(mH.obtainMessage(MSG_BIND, res));
         }
-        
+
+        @Override
         public void onUnbindMethod(int sequence) {
             mH.sendMessage(mH.obtainMessage(MSG_UNBIND, sequence, 0));
         }
-        
+
+        @Override
         public void setActive(boolean active) {
             mH.sendMessage(mH.obtainMessage(MSG_SET_ACTIVE, active ? 1 : 0, 0));
         }
-    };    
-    
+    };
+
     final InputConnection mDummyInputConnection = new BaseInputConnection(this, false);
 
-    final IInputMethodCallback mInputMethodCallback = new IInputMethodCallback.Stub() {
-        @Override
-        public void finishedEvent(int seq, boolean handled) {
-            InputMethodManager.this.finishedEvent(seq, handled);
-        }
-
-        @Override
-        public void sessionCreated(IInputMethodSession session) {
-            // Stub -- not for use in the client.
-        }
-    };
-    
     InputMethodManager(IInputMethodManager service, Looper looper) {
         mService = service;
         mMainLooper = looper;
@@ -719,6 +721,14 @@
         mBindSequence = -1;
         mCurId = null;
         mCurMethod = null;
+        if (mCurSender != null) {
+            mCurSender.dispose();
+            mCurSender = null;
+        }
+        if (mCurChannel != null) {
+            mCurChannel.dispose();
+            mCurChannel = null;
+        }
     }
     
     /**
@@ -1090,6 +1100,7 @@
             // we need to reschedule our work for over there.
             if (DEBUG) Log.v(TAG, "Starting input: reschedule to view thread");
             vh.post(new Runnable() {
+                @Override
                 public void run() {
                     startInputInner(null, 0, 0, 0);
                 }
@@ -1163,11 +1174,20 @@
                     if (res.id != null) {
                         mBindSequence = res.sequence;
                         mCurMethod = res.method;
+                        if (mCurChannel != null) {
+                            mCurChannel.dispose();
+                        }
+                        mCurChannel = res.channel;
                         mCurId = res.id;
-                    } else if (mCurMethod == null) {
-                        // This means there is no input method available.
-                        if (DEBUG) Log.v(TAG, "ABORT input: no input method!");
-                        return true;
+                    } else {
+                        if (res.channel != null) {
+                            res.channel.dispose();
+                        }
+                        if (mCurMethod == null) {
+                            // This means there is no input method available.
+                            if (DEBUG) Log.v(TAG, "ABORT input: no input method!");
+                            return true;
+                        }
                     }
                 }
                 if (mCurMethod != null && mCompletions != null) {
@@ -1561,80 +1581,43 @@
             throw new RuntimeException(e);
         }
     }
-    
+
     /**
      * @hide
      */
-    public int dispatchKeyEvent(Context context, int seq, KeyEvent key,
+    public int dispatchInputEvent(Context context, int seq, InputEvent event,
             FinishedEventCallback callback) {
         synchronized (mH) {
-            if (DEBUG) Log.d(TAG, "dispatchKeyEvent");
+            if (DEBUG) Log.d(TAG, "dispatchInputEvent");
 
             if (mCurMethod != null) {
-                if (key.getAction() == KeyEvent.ACTION_DOWN
-                        && key.getKeyCode() == KeyEvent.KEYCODE_SYM
-                        && key.getRepeatCount() == 0) {
-                    showInputMethodPickerLocked();
-                    return ViewRootImpl.EVENT_HANDLED;
+                if (event instanceof KeyEvent) {
+                    KeyEvent keyEvent = (KeyEvent)event;
+                    if (keyEvent.getAction() == KeyEvent.ACTION_DOWN
+                            && keyEvent.getKeyCode() == KeyEvent.KEYCODE_SYM
+                            && keyEvent.getRepeatCount() == 0) {
+                        showInputMethodPickerLocked();
+                        return ViewRootImpl.EVENT_HANDLED;
+                    }
                 }
-                try {
-                    if (DEBUG) Log.v(TAG, "DISPATCH KEY: " + mCurMethod);
-                    final long startTime = SystemClock.uptimeMillis();
-                    enqueuePendingEventLocked(startTime, seq, mCurId, callback);
-                    mCurMethod.dispatchKeyEvent(seq, key, mInputMethodCallback);
-                    return ViewRootImpl.EVENT_IN_PROGRESS;
-                } catch (RemoteException e) {
-                    Log.w(TAG, "IME died: " + mCurId + " dropping: " + key, e);
+
+                if (DEBUG) Log.v(TAG, "DISPATCH INPUT EVENT: " + mCurMethod);
+                final long startTime = SystemClock.uptimeMillis();
+                if (mCurChannel != null) {
+                    if (mCurSender == null) {
+                        mCurSender = new ImeInputEventSender(mCurChannel, mH.getLooper());
+                    }
+                    if (mCurSender.sendInputEvent(seq, event)) {
+                        enqueuePendingEventLocked(startTime, seq, mCurId, callback);
+                        return ViewRootImpl.EVENT_PENDING_IME;
+                    } else {
+                        Log.w(TAG, "Unable to send input event to IME: "
+                                + mCurId + " dropping: " + event);
+                    }
                 }
             }
         }
-        return ViewRootImpl.EVENT_NOT_HANDLED;
-    }
-
-    /**
-     * @hide
-     */
-    public int dispatchTrackballEvent(Context context, int seq, MotionEvent motion,
-            FinishedEventCallback callback) {
-        synchronized (mH) {
-            if (DEBUG) Log.d(TAG, "dispatchTrackballEvent");
-
-            if (mCurMethod != null && mCurrentTextBoxAttribute != null) {
-                try {
-                    if (DEBUG) Log.v(TAG, "DISPATCH TRACKBALL: " + mCurMethod);
-                    final long startTime = SystemClock.uptimeMillis();
-                    enqueuePendingEventLocked(startTime, seq, mCurId, callback);
-                    mCurMethod.dispatchTrackballEvent(seq, motion, mInputMethodCallback);
-                    return ViewRootImpl.EVENT_IN_PROGRESS;
-                } catch (RemoteException e) {
-                    Log.w(TAG, "IME died: " + mCurId + " dropping trackball: " + motion, e);
-                }
-            }
-        }
-        return ViewRootImpl.EVENT_NOT_HANDLED;
-    }
-
-    /**
-     * @hide
-     */
-    public int dispatchGenericMotionEvent(Context context, int seq, MotionEvent motion,
-            FinishedEventCallback callback) {
-        synchronized (mH) {
-            if (DEBUG) Log.d(TAG, "dispatchGenericMotionEvent");
-
-            if (mCurMethod != null && mCurrentTextBoxAttribute != null) {
-                try {
-                    if (DEBUG) Log.v(TAG, "DISPATCH GENERIC MOTION: " + mCurMethod);
-                    final long startTime = SystemClock.uptimeMillis();
-                    enqueuePendingEventLocked(startTime, seq, mCurId, callback);
-                    mCurMethod.dispatchGenericMotionEvent(seq, motion, mInputMethodCallback);
-                    return ViewRootImpl.EVENT_IN_PROGRESS;
-                } catch (RemoteException e) {
-                    Log.w(TAG, "IME died: " + mCurId + " dropping generic motion: " + motion, e);
-                }
-            }
-        }
-        return ViewRootImpl.EVENT_NOT_HANDLED;
+        return ViewRootImpl.EVENT_POST_IME;
     }
 
     void finishedEvent(int seq, boolean handled) {
@@ -1942,6 +1925,17 @@
         public void finishedEvent(int seq, boolean handled);
     }
 
+    private final class ImeInputEventSender extends InputEventSender {
+        public ImeInputEventSender(InputChannel inputChannel, Looper looper) {
+            super(inputChannel, looper);
+        }
+
+        @Override
+        public void onInputEventFinished(int seq, boolean handled) {
+            finishedEvent(seq, handled);
+        }
+    }
+
     private static final class PendingEvent {
         public PendingEvent mNext;
 
diff --git a/core/java/android/webkit/AccessibilityInjectorFallback.java b/core/java/android/webkit/AccessibilityInjectorFallback.java
index 6417527..40cc4e9 100644
--- a/core/java/android/webkit/AccessibilityInjectorFallback.java
+++ b/core/java/android/webkit/AccessibilityInjectorFallback.java
@@ -438,7 +438,6 @@
             event.setFromIndex(0);
             event.setToIndex(selection.length());
             sendAccessibilityEvent(event);
-            event.recycle();
         }
     }
 
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index d659110..3fa0940 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -6366,7 +6366,9 @@
                             mTransientStateViewsById = new LongSparseArray<View>();
                         }
                         mTransientStateViewsById.put(lp.itemId, scrap);
-                    } else {
+                    } else if (!mDataChanged) {
+                        // avoid putting views on transient state list during a data change;
+                        // the layout positions may be out of sync with the adapter positions
                         if (mTransientStateViews == null) {
                             mTransientStateViews = new SparseArray<View>();
                         }
diff --git a/core/java/android/widget/AppSecurityPermissions.java b/core/java/android/widget/AppSecurityPermissions.java
index 06dadb0..b2073b1 100644
--- a/core/java/android/widget/AppSecurityPermissions.java
+++ b/core/java/android/widget/AppSecurityPermissions.java
@@ -66,20 +66,17 @@
 
     private final static String TAG = "AppSecurityPermissions";
     private final static boolean localLOGV = false;
-    private Context mContext;
-    private LayoutInflater mInflater;
-    private PackageManager mPm;
-    private PackageInfo mInstalledPackageInfo;
+    private final Context mContext;
+    private final LayoutInflater mInflater;
+    private final PackageManager mPm;
     private final Map<String, MyPermissionGroupInfo> mPermGroups
             = new HashMap<String, MyPermissionGroupInfo>();
     private final List<MyPermissionGroupInfo> mPermGroupsList
             = new ArrayList<MyPermissionGroupInfo>();
-    private final PermissionGroupInfoComparator mPermGroupComparator;
-    private final PermissionInfoComparator mPermComparator;
-    private List<MyPermissionInfo> mPermsList;
-    private CharSequence mNewPermPrefix;
-    private Drawable mNormalIcon;
-    private Drawable mDangerousIcon;
+    private final PermissionGroupInfoComparator mPermGroupComparator = new PermissionGroupInfoComparator();
+    private final PermissionInfoComparator mPermComparator = new PermissionInfoComparator();
+    private final List<MyPermissionInfo> mPermsList = new ArrayList<MyPermissionInfo>();
+    private final CharSequence mNewPermPrefix;
 
     static class MyPermissionGroupInfo extends PermissionGroupInfo {
         CharSequence mLabel;
@@ -113,7 +110,7 @@
         }
     }
 
-    static class MyPermissionInfo extends PermissionInfo {
+    private static class MyPermissionInfo extends PermissionInfo {
         CharSequence mLabel;
 
         /**
@@ -132,19 +129,9 @@
          */
         boolean mNew;
 
-        MyPermissionInfo() {
-        }
-
         MyPermissionInfo(PermissionInfo info) {
             super(info);
         }
-
-        MyPermissionInfo(MyPermissionInfo info) {
-            super(info);
-            mNewReqFlags = info.mNewReqFlags;
-            mExistingReqFlags = info.mExistingReqFlags;
-            mNew = info.mNew;
-        }
     }
 
     public static class PermissionItemView extends LinearLayout implements View.OnClickListener {
@@ -233,25 +220,16 @@
         }
     }
 
-    public AppSecurityPermissions(Context context, List<PermissionInfo> permList) {
+    private AppSecurityPermissions(Context context) {
         mContext = context;
+        mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         mPm = mContext.getPackageManager();
-        loadResources();
-        mPermComparator = new PermissionInfoComparator();
-        mPermGroupComparator = new PermissionGroupInfoComparator();
-        for (PermissionInfo pi : permList) {
-            mPermsList.add(new MyPermissionInfo(pi));
-        }
-        setPermissions(mPermsList);
+        // Pick up from framework resources instead.
+        mNewPermPrefix = mContext.getText(R.string.perms_new_perm_prefix);
     }
-    
+
     public AppSecurityPermissions(Context context, String packageName) {
-        mContext = context;
-        mPm = mContext.getPackageManager();
-        loadResources();
-        mPermComparator = new PermissionInfoComparator();
-        mPermGroupComparator = new PermissionGroupInfoComparator();
-        mPermsList = new ArrayList<MyPermissionInfo>();
+        this(context);
         Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
         PackageInfo pkgInfo;
         try {
@@ -264,19 +242,12 @@
         if((pkgInfo.applicationInfo != null) && (pkgInfo.applicationInfo.uid != -1)) {
             getAllUsedPermissions(pkgInfo.applicationInfo.uid, permSet);
         }
-        for(MyPermissionInfo tmpInfo : permSet) {
-            mPermsList.add(tmpInfo);
-        }
+        mPermsList.addAll(permSet);
         setPermissions(mPermsList);
     }
 
     public AppSecurityPermissions(Context context, PackageInfo info) {
-        mContext = context;
-        mPm = mContext.getPackageManager();
-        loadResources();
-        mPermComparator = new PermissionInfoComparator();
-        mPermGroupComparator = new PermissionGroupInfoComparator();
-        mPermsList = new ArrayList<MyPermissionInfo>();
+        this(context);
         Set<MyPermissionInfo> permSet = new HashSet<MyPermissionInfo>();
         if(info == null) {
             return;
@@ -300,23 +271,14 @@
                 sharedUid = mPm.getUidForSharedUser(info.sharedUserId);
                 getAllUsedPermissions(sharedUid, permSet);
             } catch (NameNotFoundException e) {
-                Log.w(TAG, "Could'nt retrieve shared user id for:"+info.packageName);
+                Log.w(TAG, "Couldn't retrieve shared user id for: " + info.packageName);
             }
         }
         // Retrieve list of permissions
-        for (MyPermissionInfo tmpInfo : permSet) {
-            mPermsList.add(tmpInfo);
-        }
+        mPermsList.addAll(permSet);
         setPermissions(mPermsList);
     }
 
-    private void loadResources() {
-        // Pick up from framework resources instead.
-        mNewPermPrefix = mContext.getText(R.string.perms_new_perm_prefix);
-        mNormalIcon = mContext.getResources().getDrawable(R.drawable.ic_text_dot);
-        mDangerousIcon = mContext.getResources().getDrawable(R.drawable.ic_bullet_key_permission);
-    }
-
     /**
      * Utility to retrieve a view displaying a single permission.  This provides
      * the old UI layout for permissions; it is only here for the device admin
@@ -332,10 +294,6 @@
                 description, dangerous, icon);
     }
     
-    public PackageInfo getInstalledPackageInfo() {
-        return mInstalledPackageInfo;
-    }
-
     private void getAllUsedPermissions(int sharedUid, Set<MyPermissionInfo> permSet) {
         String sharedPkgList[] = mPm.getPackagesForUid(sharedUid);
         if(sharedPkgList == null || (sharedPkgList.length == 0)) {
@@ -346,17 +304,12 @@
         }
     }
     
-    private void getPermissionsForPackage(String packageName, 
-            Set<MyPermissionInfo> permSet) {
-        PackageInfo pkgInfo;
+    private void getPermissionsForPackage(String packageName, Set<MyPermissionInfo> permSet) {
         try {
-            pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
-        } catch (NameNotFoundException e) {
-            Log.w(TAG, "Couldn't retrieve permissions for package:"+packageName);
-            return;
-        }
-        if ((pkgInfo != null) && (pkgInfo.requestedPermissions != null)) {
+            PackageInfo pkgInfo = mPm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
             extractPerms(pkgInfo, permSet, pkgInfo);
+        } catch (NameNotFoundException e) {
+            Log.w(TAG, "Couldn't retrieve permissions for package: " + packageName);
         }
     }
 
@@ -367,7 +320,6 @@
         if ((strList == null) || (strList.length == 0)) {
             return;
         }
-        mInstalledPackageInfo = installedPkgInfo;
         for (int i=0; i<strList.length; i++) {
             String permName = strList[i];
             // If we are only looking at an existing app, then we only
@@ -471,8 +423,6 @@
     }
 
     public View getPermissionsView(int which) {
-        mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
         LinearLayout permsView = (LinearLayout) mInflater.inflate(R.layout.app_perms_summary, null);
         LinearLayout displayList = (LinearLayout) permsView.findViewById(R.id.perms_list);
         View noPermsView = permsView.findViewById(R.id.no_permissions);
@@ -557,16 +507,27 @@
     private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
             int existingReqFlags) {
         final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
-        // Dangerous and normal permissions are always shown to the user.
-        if (base == PermissionInfo.PROTECTION_DANGEROUS ||
-                base == PermissionInfo.PROTECTION_NORMAL) {
+        final boolean isNormal = (base == PermissionInfo.PROTECTION_NORMAL);
+        final boolean isDangerous = (base == PermissionInfo.PROTECTION_DANGEROUS);
+        final boolean isRequired =
+                ((newReqFlags&PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0);
+        final boolean isDevelopment =
+                ((pInfo.protectionLevel&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0);
+        final boolean wasGranted =
+                ((existingReqFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
+        final boolean isGranted =
+                ((newReqFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
+
+        // Dangerous and normal permissions are always shown to the user if the permission
+        // is required, or it was previously granted
+        if ((isNormal || isDangerous) && (isRequired || wasGranted || isGranted)) {
             return true;
         }
+
         // Development permissions are only shown to the user if they are already
         // granted to the app -- if we are installing an app and they are not
         // already granted, they will not be granted as part of the install.
-        if ((existingReqFlags&PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0
-                && (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
+        if (isDevelopment && wasGranted) {
             if (localLOGV) Log.i(TAG, "Special perm " + pInfo.name
                     + ": protlevel=0x" + Integer.toHexString(pInfo.protectionLevel));
             return true;
diff --git a/core/java/android/widget/DigitalClock.java b/core/java/android/widget/DigitalClock.java
index c6b6dd6..b6c1e5b9 100644
--- a/core/java/android/widget/DigitalClock.java
+++ b/core/java/android/widget/DigitalClock.java
@@ -39,8 +39,6 @@
     // proportional fonts don't shake rendering
 
     Calendar mCalendar;
-    private final static String m12 = "h:mm:ss aa";
-    private final static String m24 = "k:mm:ss";
     @SuppressWarnings("FieldCanBeLocal") // We must keep a reference to this observer
     private FormatChangeObserver mFormatChangeObserver;
 
@@ -102,19 +100,8 @@
         mTickerStopped = true;
     }
 
-    /**
-     * Pulls 12/24 mode from system settings
-     */
-    private boolean get24HourMode() {
-        return android.text.format.DateFormat.is24HourFormat(getContext());
-    }
-
     private void setFormat() {
-        if (get24HourMode()) {
-            mFormat = m24;
-        } else {
-            mFormat = m12;
-        }
+        mFormat = DateFormat.getTimeFormatString(getContext());
     }
 
     private class FormatChangeObserver extends ContentObserver {
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index dc305a5..0aeef63 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -316,7 +316,7 @@
     private void setErrorIcon(Drawable icon) {
         Drawables dr = mTextView.mDrawables;
         if (dr == null) {
-            mTextView.mDrawables = dr = new Drawables();
+            mTextView.mDrawables = dr = new Drawables(mTextView.getContext());
         }
         dr.setErrorDrawable(icon, mTextView);
 
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index a746370..7b81aa8 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -36,6 +36,8 @@
 
 import java.util.ArrayList;
 
+import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
+
 /**
  * A view that shows items in a vertically scrolling two-level list. This
  * differs from the {@link ListView} by allowing two levels: groups which can
@@ -76,6 +78,10 @@
  * @attr ref android.R.styleable#ExpandableListView_childIndicatorLeft
  * @attr ref android.R.styleable#ExpandableListView_childIndicatorRight
  * @attr ref android.R.styleable#ExpandableListView_childDivider
+ * @attr ref android.R.styleable#ExpandableListView_indicatorStart
+ * @attr ref android.R.styleable#ExpandableListView_indicatorEnd
+ * @attr ref android.R.styleable#ExpandableListView_childIndicatorStart
+ * @attr ref android.R.styleable#ExpandableListView_childIndicatorEnd
  */
 public class ExpandableListView extends ListView {
 
@@ -134,6 +140,12 @@
     /** Right bound for drawing the indicator. */
     private int mIndicatorRight;
 
+    /** Start bound for drawing the indicator. */
+    private int mIndicatorStart;
+
+    /** End bound for drawing the indicator. */
+    private int mIndicatorEnd;
+
     /**
      * Left bound for drawing the indicator of a child. Value of
      * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorLeft.
@@ -147,11 +159,28 @@
     private int mChildIndicatorRight;
 
     /**
+     * Start bound for drawing the indicator of a child. Value of
+     * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorStart.
+     */
+    private int mChildIndicatorStart;
+
+    /**
+     * End bound for drawing the indicator of a child. Value of
+     * {@link #CHILD_INDICATOR_INHERIT} means use mIndicatorEnd.
+     */
+    private int mChildIndicatorEnd;
+
+    /**
      * Denotes when a child indicator should inherit this bound from the generic
      * indicator bounds
      */
     public static final int CHILD_INDICATOR_INHERIT = -1;
-    
+
+    /**
+     * Denotes an undefined value for an indicator
+     */
+    private static final int INDICATOR_UNDEFINED = -2;
+
     /** The indicator drawn next to a group. */
     private Drawable mGroupIndicator;
 
@@ -202,30 +231,118 @@
         super(context, attrs, defStyle);
 
         TypedArray a =
-            context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ExpandableListView, defStyle,
-                    0);
+            context.obtainStyledAttributes(attrs,
+                    com.android.internal.R.styleable.ExpandableListView, defStyle, 0);
 
-        mGroupIndicator = a
-                .getDrawable(com.android.internal.R.styleable.ExpandableListView_groupIndicator);
-        mChildIndicator = a
-                .getDrawable(com.android.internal.R.styleable.ExpandableListView_childIndicator);
-        mIndicatorLeft = a
-                .getDimensionPixelSize(com.android.internal.R.styleable.ExpandableListView_indicatorLeft, 0);
-        mIndicatorRight = a
-                .getDimensionPixelSize(com.android.internal.R.styleable.ExpandableListView_indicatorRight, 0);
+        mGroupIndicator = a.getDrawable(
+                com.android.internal.R.styleable.ExpandableListView_groupIndicator);
+        mChildIndicator = a.getDrawable(
+                com.android.internal.R.styleable.ExpandableListView_childIndicator);
+        mIndicatorLeft = a.getDimensionPixelSize(
+                com.android.internal.R.styleable.ExpandableListView_indicatorLeft, 0);
+        mIndicatorRight = a.getDimensionPixelSize(
+                com.android.internal.R.styleable.ExpandableListView_indicatorRight, 0);
         if (mIndicatorRight == 0 && mGroupIndicator != null) {
             mIndicatorRight = mIndicatorLeft + mGroupIndicator.getIntrinsicWidth();
         }
         mChildIndicatorLeft = a.getDimensionPixelSize(
-                com.android.internal.R.styleable.ExpandableListView_childIndicatorLeft, CHILD_INDICATOR_INHERIT);
+                com.android.internal.R.styleable.ExpandableListView_childIndicatorLeft,
+                CHILD_INDICATOR_INHERIT);
         mChildIndicatorRight = a.getDimensionPixelSize(
-                com.android.internal.R.styleable.ExpandableListView_childIndicatorRight, CHILD_INDICATOR_INHERIT);
-        mChildDivider = a.getDrawable(com.android.internal.R.styleable.ExpandableListView_childDivider);
-        
+                com.android.internal.R.styleable.ExpandableListView_childIndicatorRight,
+                CHILD_INDICATOR_INHERIT);
+        mChildDivider = a.getDrawable(
+                com.android.internal.R.styleable.ExpandableListView_childDivider);
+
+        if (!isRtlCompatibilityMode()) {
+            mIndicatorStart = a.getDimensionPixelSize(
+                    com.android.internal.R.styleable.ExpandableListView_indicatorStart,
+                    INDICATOR_UNDEFINED);
+            mIndicatorEnd = a.getDimensionPixelSize(
+                    com.android.internal.R.styleable.ExpandableListView_indicatorEnd,
+                    INDICATOR_UNDEFINED);
+
+            mChildIndicatorStart = a.getDimensionPixelSize(
+                    com.android.internal.R.styleable.ExpandableListView_childIndicatorStart,
+                    CHILD_INDICATOR_INHERIT);
+            mChildIndicatorEnd = a.getDimensionPixelSize(
+                    com.android.internal.R.styleable.ExpandableListView_childIndicatorEnd,
+                    CHILD_INDICATOR_INHERIT);
+        }
+
         a.recycle();
     }
-    
-    
+
+    /**
+     * Return true if we are in RTL compatibility mode (either before Jelly Bean MR1 or
+     * RTL not supported)
+     */
+    private boolean isRtlCompatibilityMode() {
+        final int targetSdkVersion = mContext.getApplicationInfo().targetSdkVersion;
+        return targetSdkVersion < JELLY_BEAN_MR1 || !hasRtlSupport();
+    }
+
+    /**
+     * Return true if the application tag in the AndroidManifest has set "supportRtl" to true
+     */
+    private boolean hasRtlSupport() {
+        return mContext.getApplicationInfo().hasRtlSupport();
+    }
+
+    public void onRtlPropertiesChanged(int layoutDirection) {
+        resolveIndicator();
+        resolveChildIndicator();
+    }
+
+    /**
+     * Resolve start/end indicator. start/end indicator always takes precedence over left/right
+     * indicator when defined.
+     */
+    private void resolveIndicator() {
+        final boolean isLayoutRtl = isLayoutRtl();
+        if (isLayoutRtl) {
+            if (mIndicatorStart >= 0) {
+                mIndicatorRight = mIndicatorStart;
+            }
+            if (mIndicatorEnd >= 0) {
+                mIndicatorLeft = mIndicatorEnd;
+            }
+        } else {
+            if (mIndicatorStart >= 0) {
+                mIndicatorLeft = mIndicatorStart;
+            }
+            if (mIndicatorEnd >= 0) {
+                mIndicatorRight = mIndicatorEnd;
+            }
+        }
+        if (mIndicatorRight == 0 && mGroupIndicator != null) {
+            mIndicatorRight = mIndicatorLeft + mGroupIndicator.getIntrinsicWidth();
+        }
+    }
+
+    /**
+     * Resolve start/end child indicator. start/end child indicator always takes precedence over
+     * left/right child indicator when defined.
+     */
+    private void resolveChildIndicator() {
+        final boolean isLayoutRtl = isLayoutRtl();
+        if (isLayoutRtl) {
+            if (mChildIndicatorStart >= CHILD_INDICATOR_INHERIT) {
+                mChildIndicatorRight = mChildIndicatorStart;
+            }
+            if (mChildIndicatorEnd >= CHILD_INDICATOR_INHERIT) {
+                mChildIndicatorLeft = mChildIndicatorEnd;
+            }
+        } else {
+            if (mChildIndicatorStart >= CHILD_INDICATOR_INHERIT) {
+                mChildIndicatorLeft = mChildIndicatorStart;
+            }
+            if (mChildIndicatorEnd >= CHILD_INDICATOR_INHERIT) {
+                mChildIndicatorRight = mChildIndicatorEnd;
+            }
+        }
+    }
+
     @Override
     protected void dispatchDraw(Canvas canvas) {
         // Draw children, etc.
@@ -288,6 +405,9 @@
             // Get more expandable list-related info for this item
             pos = mConnector.getUnflattenedPos(childFlPos);
 
+            final boolean isLayoutRtl = isLayoutRtl();
+            final int width = getWidth();
+
             // If this item type and the previous item type are different, then we need to change
             // the left & right bounds
             if (pos.position.type != lastItemType) {
@@ -300,9 +420,18 @@
                     indicatorRect.left = mIndicatorLeft;
                     indicatorRect.right = mIndicatorRight;
                 }
-                
-                indicatorRect.left += mPaddingLeft;
-                indicatorRect.right += mPaddingLeft;
+
+                if (isLayoutRtl) {
+                    final int temp = indicatorRect.left;
+                    indicatorRect.left = width - indicatorRect.right;
+                    indicatorRect.right = width - temp;
+
+                    indicatorRect.left -= mPaddingRight;
+                    indicatorRect.right -= mPaddingRight;
+                } else {
+                    indicatorRect.left += mPaddingLeft;
+                    indicatorRect.right += mPaddingLeft;
+                }
 
                 lastItemType = pos.position.type; 
             }
@@ -1041,8 +1170,26 @@
     public void setChildIndicatorBounds(int left, int right) {
         mChildIndicatorLeft = left;
         mChildIndicatorRight = right;
+        resolveChildIndicator();
     }
-    
+
+    /**
+     * Sets the relative drawing bounds for the child indicator. For either, you can
+     * specify {@link #CHILD_INDICATOR_INHERIT} to use inherit from the general
+     * indicator's bounds.
+     *
+     * @see #setIndicatorBounds(int, int)
+     * @param start The start position (relative to the start bounds of this View)
+     *            to start drawing the indicator.
+     * @param end The end position (relative to the end bounds of this
+     *            View) to end the drawing of the indicator.
+     */
+    public void setChildIndicatorBoundsRelative(int start, int end) {
+        mChildIndicatorStart = start;
+        mChildIndicatorEnd = end;
+        resolveChildIndicator();
+    }
+
     /**
      * Sets the indicator to be drawn next to a group.
      * 
@@ -1072,8 +1219,26 @@
     public void setIndicatorBounds(int left, int right) {
         mIndicatorLeft = left;
         mIndicatorRight = right;
+        resolveIndicator();
     }
-    
+
+    /**
+     * Sets the relative drawing bounds for the indicators (at minimum, the group indicator
+     * is affected by this; the child indicator is affected by this if the
+     * child indicator bounds are set to inherit).
+     *
+     * @see #setChildIndicatorBounds(int, int)
+     * @param start The start position (relative to the start bounds of this View)
+     *            to start drawing the indicator.
+     * @param end The end position (relative to the end bounds of this
+     *            View) to end the drawing of the indicator.
+     */
+    public void setIndicatorBoundsRelative(int start, int end) {
+        mIndicatorStart = start;
+        mIndicatorEnd = end;
+        resolveIndicator();
+    }
+
     /**
      * Extra menu information specific to an {@link ExpandableListView} provided
      * to the
diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java
index 1bbf4eb..cde6ceb 100644
--- a/core/java/android/widget/ImageView.java
+++ b/core/java/android/widget/ImageView.java
@@ -204,7 +204,7 @@
 
     @Override
     public boolean hasOverlappingRendering() {
-        return (getBackground() != null);
+        return (getBackground() != null && getBackground().getCurrent() != null);
     }
 
     @Override
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 7c40a64..4b62c2d 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -2417,6 +2417,34 @@
     }
 
     /**
+     * Used by {@link #arrowScrollImpl(int)} to help determine the next selected position
+     * to move to. This can return a position currently not represented by a view on screen
+     * but only in the direction given.
+     *
+     * @param selectedPos Current selected position to move from
+     * @param direction Direction to move in
+     * @return Desired selected position after moving in the given direction
+     */
+    private final int nextSelectedPositionForDirection(int selectedPos, int direction) {
+        int nextSelected;
+        if (direction == View.FOCUS_DOWN) {
+            nextSelected = selectedPos != INVALID_POSITION && selectedPos >= mFirstPosition ?
+                    selectedPos + 1 :
+                    mFirstPosition;
+        } else {
+            final int lastPos = mFirstPosition + getChildCount() - 1;
+            nextSelected = selectedPos != INVALID_POSITION && selectedPos < lastPos?
+                    selectedPos - 1 :
+                    lastPos;
+        }
+
+        if (nextSelected < 0 || nextSelected >= mAdapter.getCount()) {
+            return INVALID_POSITION;
+        }
+        return lookForSelectablePosition(nextSelected, direction == View.FOCUS_DOWN);
+    }
+
+    /**
      * Handle an arrow scroll going up or down.  Take into account whether items are selectable,
      * whether there are focusable items etc.
      *
@@ -2431,7 +2459,7 @@
         View selectedView = getSelectedView();
         int selectedPos = mSelectedPosition;
 
-        int nextSelectedPosition = lookForSelectablePositionOnScreen(direction);
+        int nextSelectedPosition = nextSelectedPositionForDirection(selectedPos, direction);
         int amountToScroll = amountToScroll(direction, nextSelectedPosition);
 
         // if we are moving focus, we may OVERRIDE the default behavior
@@ -2643,14 +2671,18 @@
         final int listBottom = getHeight() - mListPadding.bottom;
         final int listTop = mListPadding.top;
 
-        final int numChildren = getChildCount();
+        int numChildren = getChildCount();
 
         if (direction == View.FOCUS_DOWN) {
             int indexToMakeVisible = numChildren - 1;
             if (nextSelectedPosition != INVALID_POSITION) {
                 indexToMakeVisible = nextSelectedPosition - mFirstPosition;
             }
-
+            while (numChildren <= indexToMakeVisible) {
+                // Child to view is not attached yet.
+                addViewBelow(getChildAt(numChildren - 1), mFirstPosition + numChildren - 1);
+                numChildren++;
+            }
             final int positionToMakeVisible = mFirstPosition + indexToMakeVisible;
             final View viewToMakeVisible = getChildAt(indexToMakeVisible);
 
@@ -2684,6 +2716,12 @@
             if (nextSelectedPosition != INVALID_POSITION) {
                 indexToMakeVisible = nextSelectedPosition - mFirstPosition;
             }
+            while (indexToMakeVisible < 0) {
+                // Child to view is not attached yet.
+                addViewAbove(getChildAt(0), mFirstPosition);
+                mFirstPosition--;
+                indexToMakeVisible = nextSelectedPosition - mFirstPosition;
+            }
             final int positionToMakeVisible = mFirstPosition + indexToMakeVisible;
             final View viewToMakeVisible = getChildAt(indexToMakeVisible);
             int goalTop = listTop;
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index c9d2d95..529de2e 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -1212,8 +1212,8 @@
 
         private int mLeft, mTop, mRight, mBottom;
 
-        private int mStart = DEFAULT_RELATIVE;
-        private int mEnd = DEFAULT_RELATIVE;
+        private int mStart = DEFAULT_MARGIN_RELATIVE;
+        private int mEnd = DEFAULT_MARGIN_RELATIVE;
 
         private boolean mRulesChanged = false;
         private boolean mIsRtlCompatibilityMode = false;
@@ -1314,7 +1314,7 @@
                         break;
                 }
             }
-
+            mRulesChanged = true;
             System.arraycopy(rules, LEFT_OF, initialRules, LEFT_OF, VERB_COUNT);
 
             a.recycle();
@@ -1574,11 +1574,11 @@
         public void resolveLayoutDirection(int layoutDirection) {
             final boolean isLayoutRtl = isLayoutRtl();
             if (isLayoutRtl) {
-                if (mStart != DEFAULT_RELATIVE) mRight = mStart;
-                if (mEnd != DEFAULT_RELATIVE) mLeft = mEnd;
+                if (mStart != DEFAULT_MARGIN_RELATIVE) mRight = mStart;
+                if (mEnd != DEFAULT_MARGIN_RELATIVE) mLeft = mEnd;
             } else {
-                if (mStart != DEFAULT_RELATIVE) mLeft = mStart;
-                if (mEnd != DEFAULT_RELATIVE) mRight = mEnd;
+                if (mStart != DEFAULT_MARGIN_RELATIVE) mLeft = mStart;
+                if (mEnd != DEFAULT_MARGIN_RELATIVE) mRight = mEnd;
             }
 
             if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index 5bf21c0..a564c96 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -36,21 +36,24 @@
 import java.util.Calendar;
 import java.util.TimeZone;
 
+import libcore.icu.LocaleData;
+
 import static android.view.ViewDebug.ExportedProperty;
 import static android.widget.RemoteViews.*;
 
 /**
  * <p><code>TextClock</code> can display the current date and/or time as
  * a formatted string.</p>
- * 
+ *
  * <p>This view honors the 24-hour format system setting. As such, it is
  * possible and recommended to provide two different formatting patterns:
  * one to display the date/time in 24-hour mode and one to display the
- * date/time in 12-hour mode.</p>
- * 
+ * date/time in 12-hour mode. Most callers will want to use the defaults,
+ * though, which will be appropriate for the user's locale.</p>
+ *
  * <p>It is possible to determine whether the system is currently in
  * 24-hour mode by calling {@link #is24HourModeEnabled()}.</p>
- * 
+ *
  * <p>The rules used by this widget to decide how to format the date and
  * time are the following:</p>
  * <ul>
@@ -58,22 +61,24 @@
  *         <ul>
  *             <li>Use the value returned by {@link #getFormat24Hour()} when non-null</li>
  *             <li>Otherwise, use the value returned by {@link #getFormat12Hour()} when non-null</li>
- *             <li>Otherwise, use {@link #DEFAULT_FORMAT_24_HOUR}</li>
+ *             <li>Otherwise, use a default value appropriate for the user's locale, such as {@code h:mm a}</li>
  *         </ul>
  *     </li>
  *     <li>In 12-hour mode:
  *         <ul>
  *             <li>Use the value returned by {@link #getFormat12Hour()} when non-null</li>
  *             <li>Otherwise, use the value returned by {@link #getFormat24Hour()} when non-null</li>
- *             <li>Otherwise, use {@link #DEFAULT_FORMAT_12_HOUR}</li>
+ *             <li>Otherwise, use a default value appropriate for the user's locale, such as {@code HH:mm}</li>
  *         </ul>
  *     </li>
  * </ul>
- * 
+ *
  * <p>The {@link CharSequence} instances used as formatting patterns when calling either
  * {@link #setFormat24Hour(CharSequence)} or {@link #setFormat12Hour(CharSequence)} can
- * contain styling information. To do so, use a {@link android.text.Spanned} object.</p>
- * 
+ * contain styling information. To do so, use a {@link android.text.Spanned} object.
+ * Note that if you customize these strings, it is your responsibility to supply strings
+ * appropriate for formatting dates and/or times in the user's locale.</p>
+ *
  * @attr ref android.R.styleable#TextClock_format12Hour
  * @attr ref android.R.styleable#TextClock_format24Hour
  * @attr ref android.R.styleable#TextClock_timeZone
@@ -81,32 +86,34 @@
 @RemoteView
 public class TextClock extends TextView {
     /**
-     * The default formatting pattern in 12-hour mode. This pattenr is used
+     * The default formatting pattern in 12-hour mode. This pattern is used
      * if {@link #setFormat12Hour(CharSequence)} is called with a null pattern
      * or if no pattern was specified when creating an instance of this class.
-     * 
+     *
      * This default pattern shows only the time, hours and minutes, and an am/pm
      * indicator.
      *
      * @see #setFormat12Hour(CharSequence)
      * @see #getFormat12Hour()
+     * @deprecated Let the system use locale-appropriate defaults instead.
      */
-    public static final CharSequence DEFAULT_FORMAT_12_HOUR = "h:mm aa";
+    public static final CharSequence DEFAULT_FORMAT_12_HOUR = "h:mm a";
 
     /**
-     * The default formatting pattern in 24-hour mode. This pattenr is used
+     * The default formatting pattern in 24-hour mode. This pattern is used
      * if {@link #setFormat24Hour(CharSequence)} is called with a null pattern
      * or if no pattern was specified when creating an instance of this class.
      *
      * This default pattern shows only the time, hours and minutes.
-     * 
-     * @see #setFormat24Hour(CharSequence) 
-     * @see #getFormat24Hour() 
+     *
+     * @see #setFormat24Hour(CharSequence)
+     * @see #getFormat24Hour()
+     * @deprecated Let the system use locale-appropriate defaults instead.
      */
-    public static final CharSequence DEFAULT_FORMAT_24_HOUR = "k:mm";
+    public static final CharSequence DEFAULT_FORMAT_24_HOUR = "H:mm";
 
-    private CharSequence mFormat12 = DEFAULT_FORMAT_12_HOUR;
-    private CharSequence mFormat24 = DEFAULT_FORMAT_24_HOUR;
+    private CharSequence mFormat12;
+    private CharSequence mFormat24;
 
     @ExportedProperty
     private CharSequence mFormat;
@@ -158,7 +165,7 @@
      * Creates a new clock using the default patterns
      * {@link #DEFAULT_FORMAT_24_HOUR} and {@link #DEFAULT_FORMAT_12_HOUR}
      * respectively for the 24-hour and 12-hour modes.
-     * 
+     *
      * @param context The Context the view is running in, through which it can
      *        access the current theme, resources, etc.
      */
@@ -171,7 +178,7 @@
     /**
      * Creates a new clock inflated from XML. This object's properties are
      * intialized from the attributes specified in XML.
-     * 
+     *
      * This constructor uses a default style of 0, so the only attribute values
      * applied are those in the Context's Theme and the given AttributeSet.
      *
@@ -201,14 +208,8 @@
 
         TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextClock, defStyle, 0);
         try {
-            CharSequence format;
-
-            format = a.getText(R.styleable.TextClock_format12Hour);
-            mFormat12 = format == null ? DEFAULT_FORMAT_12_HOUR : format;
-
-            format = a.getText(R.styleable.TextClock_format24Hour);
-            mFormat24 = format == null ? DEFAULT_FORMAT_24_HOUR : format;
-
+            mFormat12 = a.getText(R.styleable.TextClock_format12Hour);
+            mFormat24 = a.getText(R.styleable.TextClock_format24Hour);
             mTimeZone = a.getString(R.styleable.TextClock_timeZone);
         } finally {
             a.recycle();
@@ -218,6 +219,16 @@
     }
 
     private void init() {
+        if (mFormat12 == null || mFormat24 == null) {
+            LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
+            if (mFormat12 == null) {
+                mFormat12 = ld.timeFormat12;
+            }
+            if (mFormat24 == null) {
+                mFormat24 = ld.timeFormat24;
+            }
+        }
+
         createTime(mTimeZone);
         // Wait until onAttachedToWindow() to handle the ticker
         chooseFormat(false);
@@ -235,11 +246,11 @@
      * Returns the formatting pattern used to display the date and/or time
      * in 12-hour mode. The formatting pattern syntax is described in
      * {@link DateFormat}.
-     * 
+     *
      * @return A {@link CharSequence} or null.
-     * 
-     * @see #setFormat12Hour(CharSequence) 
-     * @see #is24HourModeEnabled() 
+     *
+     * @see #setFormat12Hour(CharSequence)
+     * @see #is24HourModeEnabled()
      */
     @ExportedProperty
     public CharSequence getFormat12Hour() {
@@ -257,12 +268,12 @@
      * {@link #DEFAULT_FORMAT_12_HOUR} will be used instead.
      *
      * @param format A date/time formatting pattern as described in {@link DateFormat}
-     * 
+     *
      * @see #getFormat12Hour()
      * @see #is24HourModeEnabled()
      * @see #DEFAULT_FORMAT_12_HOUR
      * @see DateFormat
-     * 
+     *
      * @attr ref android.R.styleable#TextClock_format12Hour
      */
     @RemotableViewMethod
@@ -292,7 +303,7 @@
      * Specifies the formatting pattern used to display the date and/or time
      * in 24-hour mode. The formatting pattern syntax is described in
      * {@link DateFormat}.
-     * 
+     *
      * If this pattern is set to null, {@link #getFormat12Hour()} will be used
      * even in 24-hour mode. If both 24-hour and 12-hour formatting patterns
      * are set to null, {@link #DEFAULT_FORMAT_24_HOUR} and
@@ -301,7 +312,7 @@
      * @param format A date/time formatting pattern as described in {@link DateFormat}
      *
      * @see #getFormat24Hour()
-     * @see #is24HourModeEnabled() 
+     * @see #is24HourModeEnabled()
      * @see #DEFAULT_FORMAT_24_HOUR
      * @see DateFormat
      *
@@ -317,22 +328,22 @@
 
     /**
      * Indicates whether the system is currently using the 24-hour mode.
-     * 
+     *
      * When the system is in 24-hour mode, this view will use the pattern
      * returned by {@link #getFormat24Hour()}. In 12-hour mode, the pattern
      * returned by {@link #getFormat12Hour()} is used instead.
-     * 
+     *
      * If either one of the formats is null, the other format is used. If
      * both formats are null, the default values {@link #DEFAULT_FORMAT_12_HOUR}
      * and {@link #DEFAULT_FORMAT_24_HOUR} are used instead.
-     * 
+     *
      * @return true if time should be displayed in 24-hour format, false if it
      *         should be displayed in 12-hour format.
-     * 
+     *
      * @see #setFormat12Hour(CharSequence)
-     * @see #getFormat12Hour() 
+     * @see #getFormat12Hour()
      * @see #setFormat24Hour(CharSequence)
-     * @see #getFormat24Hour() 
+     * @see #getFormat24Hour()
      */
     public boolean is24HourModeEnabled() {
         return DateFormat.is24HourFormat(getContext());
@@ -340,13 +351,13 @@
 
     /**
      * Indicates which time zone is currently used by this view.
-     * 
+     *
      * @return The ID of the current time zone or null if the default time zone,
      *         as set by the user, must be used
      *
      * @see TimeZone
      * @see java.util.TimeZone#getAvailableIDs()
-     * @see #setTimeZone(String) 
+     * @see #setTimeZone(String)
      */
     public String getTimeZone() {
         return mTimeZone;
@@ -378,7 +389,7 @@
     /**
      * Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
      * depending on whether the user has selected 24-hour format.
-     * 
+     *
      * Calling this method does not schedule or unschedule the time ticker.
      */
     private void chooseFormat() {
@@ -398,17 +409,19 @@
     /**
      * Selects either one of {@link #getFormat12Hour()} or {@link #getFormat24Hour()}
      * depending on whether the user has selected 24-hour format.
-     * 
+     *
      * @param handleTicker true if calling this method should schedule/unschedule the
      *                     time ticker, false otherwise
      */
     private void chooseFormat(boolean handleTicker) {
         final boolean format24Requested = is24HourModeEnabled();
 
+        LocaleData ld = LocaleData.get(getContext().getResources().getConfiguration().locale);
+
         if (format24Requested) {
-            mFormat = abc(mFormat24, mFormat12, DEFAULT_FORMAT_24_HOUR);
+            mFormat = abc(mFormat24, mFormat12, ld.timeFormat24);
         } else {
-            mFormat = abc(mFormat12, mFormat24, DEFAULT_FORMAT_12_HOUR);
+            mFormat = abc(mFormat12, mFormat24, ld.timeFormat12);
         }
 
         boolean hadSeconds = mHasSeconds;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index b084ac4..52b7a81 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -136,6 +136,8 @@
 import java.util.Locale;
 import java.util.concurrent.locks.ReentrantLock;
 
+import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
+
 /**
  * Displays text to the user and optionally allows them to edit it.  A TextView
  * is a complete text editor, however the basic class is configured to not
@@ -294,6 +296,10 @@
         Drawable mDrawableTop, mDrawableBottom, mDrawableLeft, mDrawableRight,
                 mDrawableStart, mDrawableEnd, mDrawableError, mDrawableTemp;
 
+        Drawable mDrawableLeftInitial, mDrawableRightInitial;
+        boolean mIsRtlCompatibilityMode;
+        boolean mOverride;
+
         int mDrawableSizeTop, mDrawableSizeBottom, mDrawableSizeLeft, mDrawableSizeRight,
                 mDrawableSizeStart, mDrawableSizeEnd, mDrawableSizeError, mDrawableSizeTemp;
 
@@ -304,38 +310,64 @@
 
         int mDrawableSaved = DRAWABLE_NONE;
 
+        public Drawables(Context context) {
+            final int targetSdkVersion = context.getApplicationInfo().targetSdkVersion;
+            mIsRtlCompatibilityMode = (targetSdkVersion < JELLY_BEAN_MR1 ||
+                !context.getApplicationInfo().hasRtlSupport());
+            mOverride = false;
+        }
+
         public void resolveWithLayoutDirection(int layoutDirection) {
-            switch(layoutDirection) {
-                case LAYOUT_DIRECTION_RTL:
-                    if (mDrawableStart != null) {
-                        mDrawableRight = mDrawableStart;
+            // First reset "left" and "right" drawables to their initial values
+            mDrawableLeft = mDrawableLeftInitial;
+            mDrawableRight = mDrawableRightInitial;
 
-                        mDrawableSizeRight = mDrawableSizeStart;
-                        mDrawableHeightRight = mDrawableHeightStart;
-                    }
-                    if (mDrawableEnd != null) {
-                        mDrawableLeft = mDrawableEnd;
+            if (mIsRtlCompatibilityMode) {
+                // Use "start" drawable as "left" drawable if the "left" drawable was not defined
+                if (mDrawableStart != null && mDrawableLeft == null) {
+                    mDrawableLeft = mDrawableStart;
+                    mDrawableSizeLeft = mDrawableSizeStart;
+                    mDrawableHeightLeft = mDrawableHeightStart;
+                }
+                // Use "end" drawable as "right" drawable if the "right" drawable was not defined
+                if (mDrawableEnd != null && mDrawableRight == null) {
+                    mDrawableRight = mDrawableEnd;
+                    mDrawableSizeRight = mDrawableSizeEnd;
+                    mDrawableHeightRight = mDrawableHeightEnd;
+                }
+            } else {
+                // JB-MR1+ normal case: "start" / "end" drawables are overriding "left" / "right"
+                // drawable if and only if they have been defined
+                switch(layoutDirection) {
+                    case LAYOUT_DIRECTION_RTL:
+                        if (mOverride) {
+                            mDrawableRight = mDrawableStart;
+                            mDrawableSizeRight = mDrawableSizeStart;
+                            mDrawableHeightRight = mDrawableHeightStart;
+                        }
 
-                        mDrawableSizeLeft = mDrawableSizeEnd;
-                        mDrawableHeightLeft = mDrawableHeightEnd;
-                    }
-                    break;
+                        if (mOverride) {
+                            mDrawableLeft = mDrawableEnd;
+                            mDrawableSizeLeft = mDrawableSizeEnd;
+                            mDrawableHeightLeft = mDrawableHeightEnd;
+                        }
+                        break;
 
-                case LAYOUT_DIRECTION_LTR:
-                default:
-                    if (mDrawableStart != null) {
-                        mDrawableLeft = mDrawableStart;
+                    case LAYOUT_DIRECTION_LTR:
+                    default:
+                        if (mOverride) {
+                            mDrawableLeft = mDrawableStart;
+                            mDrawableSizeLeft = mDrawableSizeStart;
+                            mDrawableHeightLeft = mDrawableHeightStart;
+                        }
 
-                        mDrawableSizeLeft = mDrawableSizeStart;
-                        mDrawableHeightLeft = mDrawableHeightStart;
-                    }
-                    if (mDrawableEnd != null) {
-                        mDrawableRight = mDrawableEnd;
-
-                        mDrawableSizeRight = mDrawableSizeEnd;
-                        mDrawableHeightRight = mDrawableHeightEnd;
-                    }
-                    break;
+                        if (mOverride) {
+                            mDrawableRight = mDrawableEnd;
+                            mDrawableSizeRight = mDrawableSizeEnd;
+                            mDrawableHeightRight = mDrawableHeightEnd;
+                        }
+                        break;
+                }
             }
             applyErrorDrawableIfNeeded(layoutDirection);
             updateDrawablesLayoutDirection(layoutDirection);
@@ -1154,6 +1186,7 @@
                 bufferType = BufferType.SPANNABLE;
         }
 
+        // This call will save the initial left/right drawables
         setCompoundDrawablesWithIntrinsicBounds(
             drawableLeft, drawableTop, drawableRight, drawableBottom);
         setRelativeDrawablesIfNeeded(drawableStart, drawableEnd);
@@ -1302,8 +1335,9 @@
         if (hasRelativeDrawables) {
             Drawables dr = mDrawables;
             if (dr == null) {
-                mDrawables = dr = new Drawables();
+                mDrawables = dr = new Drawables(getContext());
             }
+            mDrawables.mOverride = true;
             final Rect compoundRect = dr.mCompoundRect;
             int[] state = getDrawableState();
             if (start != null) {
@@ -1876,9 +1910,11 @@
             }
         } else {
             if (dr == null) {
-                mDrawables = dr = new Drawables();
+                mDrawables = dr = new Drawables(getContext());
             }
 
+            mDrawables.mOverride = false;
+
             if (dr.mDrawableLeft != left && dr.mDrawableLeft != null) {
                 dr.mDrawableLeft.setCallback(null);
             }
@@ -1945,6 +1981,12 @@
             }
         }
 
+        // Save initial left/right drawables
+        if (dr != null) {
+            dr.mDrawableLeftInitial = left;
+            dr.mDrawableRightInitial = right;
+        }
+
         invalidate();
         requestLayout();
     }
@@ -2045,9 +2087,11 @@
             }
         } else {
             if (dr == null) {
-                mDrawables = dr = new Drawables();
+                mDrawables = dr = new Drawables(getContext());
             }
 
+            mDrawables.mOverride = true;
+
             if (dr.mDrawableStart != start && dr.mDrawableStart != null) {
                 dr.mDrawableStart.setCallback(null);
             }
@@ -2114,6 +2158,7 @@
             }
         }
 
+        resetResolvedDrawables();
         resolveDrawables();
         invalidate();
         requestLayout();
@@ -2138,7 +2183,6 @@
     @android.view.RemotableViewMethod
     public void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end,
             int bottom) {
-        resetResolvedDrawables();
         final Resources resources = getContext().getResources();
         setCompoundDrawablesRelativeWithIntrinsicBounds(
                 start != 0 ? resources.getDrawable(start) : null,
@@ -2161,7 +2205,6 @@
     public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start, Drawable top,
             Drawable end, Drawable bottom) {
 
-        resetResolvedDrawables();
         if (start != null) {
             start.setBounds(0, 0, start.getIntrinsicWidth(), start.getIntrinsicHeight());
         }
@@ -2230,7 +2273,7 @@
             }
         } else {
             if (dr == null) {
-                mDrawables = dr = new Drawables();
+                mDrawables = dr = new Drawables(getContext());
             }
             dr.mDrawablePadding = pad;
         }
@@ -4751,7 +4794,8 @@
 
     @Override
     public boolean hasOverlappingRendering() {
-        return (getBackground() != null || mText instanceof Spannable || hasSelection());
+        return ((getBackground() != null && getBackground().getCurrent() != null)
+                || mText instanceof Spannable || hasSelection());
     }
 
     /**
@@ -8838,16 +8882,6 @@
                     advancesIndex);
         }
 
-        public float getTextRunAdvances(int start, int end, int contextStart,
-                int contextEnd, int flags, float[] advances, int advancesIndex,
-                Paint p, int reserved) {
-            int count = end - start;
-            int contextCount = contextEnd - contextStart;
-            return p.getTextRunAdvances(mChars, start + mStart, count,
-                    contextStart + mStart, contextCount, flags, advances,
-                    advancesIndex, reserved);
-        }
-
         public int getTextRunCursor(int contextStart, int contextEnd, int flags,
                 int offset, int cursorOpt, Paint p) {
             int contextCount = contextEnd - contextStart;
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index eed3e67..eb2d1fe 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -27,6 +27,7 @@
 import android.os.Environment;
 import android.os.ParcelFileDescriptor;
 import android.os.RemoteException;
+import android.os.SELinux;
 import android.util.Log;
 
 import com.android.org.bouncycastle.util.encoders.Base64;
@@ -64,6 +65,10 @@
 
     public LocalTransport(Context context) {
         mContext = context;
+        mDataDir.mkdirs();
+        if (!SELinux.restorecon(mDataDir)) {
+            Log.e(TAG, "SELinux restorecon failed for " + mDataDir);
+        }
     }
 
     public Intent configurationIntent() {
diff --git a/core/java/com/android/internal/util/ArrayUtils.java b/core/java/com/android/internal/util/ArrayUtils.java
index d44df0c..9137d3c 100644
--- a/core/java/com/android/internal/util/ArrayUtils.java
+++ b/core/java/com/android/internal/util/ArrayUtils.java
@@ -79,6 +79,10 @@
      * @return true if they're equal, false otherwise
      */
     public static boolean equals(byte[] array1, byte[] array2, int length) {
+        if (length < 0) {
+            throw new IllegalArgumentException();
+        }
+
         if (array1 == array2) {
             return true;
         }
diff --git a/core/java/com/android/internal/util/XmlUtils.java b/core/java/com/android/internal/util/XmlUtils.java
index 93f6cf6..fa35308 100644
--- a/core/java/com/android/internal/util/XmlUtils.java
+++ b/core/java/com/android/internal/util/XmlUtils.java
@@ -16,6 +16,7 @@
 
 package com.android.internal.util;
 
+import android.util.Xml;
 
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
@@ -24,6 +25,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.ProtocolException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -32,11 +34,8 @@
 import java.util.Map;
 import java.util.Set;
 
-import android.util.Xml;
-
 /** {@hide} */
-public class XmlUtils
-{
+public class XmlUtils {
 
     public static void skipCurrentTag(XmlPullParser parser)
             throws XmlPullParserException, IOException {
@@ -900,4 +899,42 @@
             }
         }
     }
+
+    public static int readIntAttribute(XmlPullParser in, String name) throws IOException {
+        final String value = in.getAttributeValue(null, name);
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            throw new ProtocolException("problem parsing " + name + "=" + value + " as int");
+        }
+    }
+
+    public static void writeIntAttribute(XmlSerializer out, String name, int value)
+            throws IOException {
+        out.attribute(null, name, Integer.toString(value));
+    }
+
+    public static long readLongAttribute(XmlPullParser in, String name) throws IOException {
+        final String value = in.getAttributeValue(null, name);
+        try {
+            return Long.parseLong(value);
+        } catch (NumberFormatException e) {
+            throw new ProtocolException("problem parsing " + name + "=" + value + " as long");
+        }
+    }
+
+    public static void writeLongAttribute(XmlSerializer out, String name, long value)
+            throws IOException {
+        out.attribute(null, name, Long.toString(value));
+    }
+
+    public static boolean readBooleanAttribute(XmlPullParser in, String name) {
+        final String value = in.getAttributeValue(null, name);
+        return Boolean.parseBoolean(value);
+    }
+
+    public static void writeBooleanAttribute(XmlSerializer out, String name, boolean value)
+            throws IOException {
+        out.attribute(null, name, Boolean.toString(value));
+    }
 }
diff --git a/core/java/com/android/internal/view/IInputMethod.aidl b/core/java/com/android/internal/view/IInputMethod.aidl
index 5db860b..77456da 100644
--- a/core/java/com/android/internal/view/IInputMethod.aidl
+++ b/core/java/com/android/internal/view/IInputMethod.aidl
@@ -16,17 +16,15 @@
 
 package com.android.internal.view;
 
-import android.graphics.Rect;
 import android.os.IBinder;
 import android.os.ResultReceiver;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
+import android.view.InputChannel;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputBinding;
 import android.view.inputmethod.InputMethodSubtype;
 import com.android.internal.view.IInputContext;
-import com.android.internal.view.IInputMethodCallback;
 import com.android.internal.view.IInputMethodSession;
+import com.android.internal.view.IInputSessionCallback;
 
 /**
  * Top-level interface to an input method component (implemented in a
@@ -44,7 +42,7 @@
 
     void restartInput(in IInputContext inputContext, in EditorInfo attribute);
 
-    void createSession(IInputMethodCallback callback);
+    void createSession(in InputChannel channel, IInputSessionCallback callback);
 
     void setSessionEnabled(IInputMethodSession session, boolean enabled);
 
diff --git a/core/java/com/android/internal/view/IInputMethodCallback.aidl b/core/java/com/android/internal/view/IInputMethodCallback.aidl
deleted file mode 100644
index 480cc0e..0000000
--- a/core/java/com/android/internal/view/IInputMethodCallback.aidl
+++ /dev/null
@@ -1,34 +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.view;
-
-import android.graphics.Rect;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import com.android.internal.view.IInputContext;
-import com.android.internal.view.IInputMethodSession;
-import android.os.IBinder;
-
-/**
- * Helper interface for IInputMethod to allow the input method to call back
- * to its client with results from incoming calls.
- * {@hide}
- */
-oneway interface IInputMethodCallback {
-    void finishedEvent(int seq, boolean handled);
-    void sessionCreated(IInputMethodSession session);
-}
diff --git a/core/java/com/android/internal/view/IInputMethodSession.aidl b/core/java/com/android/internal/view/IInputMethodSession.aidl
index cdec254..90210ce 100644
--- a/core/java/com/android/internal/view/IInputMethodSession.aidl
+++ b/core/java/com/android/internal/view/IInputMethodSession.aidl
@@ -22,7 +22,6 @@
 import android.view.MotionEvent;
 import android.view.inputmethod.CompletionInfo;
 import android.view.inputmethod.ExtractedText;
-import com.android.internal.view.IInputMethodCallback;
 
 /**
  * Sub-interface of IInputMethod which is safe to give to client applications.
@@ -40,14 +39,8 @@
     void viewClicked(boolean focusChanged);
 
     void updateCursor(in Rect newCursor);
-    
+
     void displayCompletions(in CompletionInfo[] completions);
-    
-    void dispatchKeyEvent(int seq, in KeyEvent event, IInputMethodCallback callback);
-
-    void dispatchTrackballEvent(int seq, in MotionEvent event, IInputMethodCallback callback);
-
-    void dispatchGenericMotionEvent(int seq, in MotionEvent event, IInputMethodCallback callback);
 
     void appPrivateCommand(String action, in Bundle data);
 
diff --git a/core/java/com/android/internal/view/IInputSessionCallback.aidl b/core/java/com/android/internal/view/IInputSessionCallback.aidl
new file mode 100644
index 0000000..2b48f33
--- /dev/null
+++ b/core/java/com/android/internal/view/IInputSessionCallback.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 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.view;
+
+import com.android.internal.view.IInputMethodSession;
+
+/**
+ * Helper interface for IInputMethod to allow the input method to notify the client when a new
+ * session has been created.
+ * {@hide}
+ */
+
+oneway interface IInputSessionCallback {
+    void sessionCreated(IInputMethodSession session);
+}
diff --git a/core/java/com/android/internal/view/InputBindResult.java b/core/java/com/android/internal/view/InputBindResult.java
index 658f098..9143c61 100644
--- a/core/java/com/android/internal/view/InputBindResult.java
+++ b/core/java/com/android/internal/view/InputBindResult.java
@@ -18,6 +18,7 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.view.InputChannel;
 
 /**
  * Bundle of information returned by input method manager about a successful
@@ -30,7 +31,12 @@
      * The input method service.
      */
     public final IInputMethodSession method;
-    
+
+    /**
+     * The input channel used to send input events to this IME.
+     */
+    public final InputChannel channel;
+
     /**
      * The ID for this input method, as found in InputMethodInfo; null if
      * no input method will be bound.
@@ -42,18 +48,25 @@
      */
     public final int sequence;
     
-    public InputBindResult(IInputMethodSession _method, String _id, int _sequence) {
+    public InputBindResult(IInputMethodSession _method, InputChannel _channel,
+            String _id, int _sequence) {
         method = _method;
+        channel = _channel;
         id = _id;
         sequence = _sequence;
     }
     
     InputBindResult(Parcel source) {
         method = IInputMethodSession.Stub.asInterface(source.readStrongBinder());
+        if (source.readInt() != 0) {
+            channel = InputChannel.CREATOR.createFromParcel(source);
+        } else {
+            channel = null;
+        }
         id = source.readString();
         sequence = source.readInt();
     }
-    
+
     @Override
     public String toString() {
         return "InputBindResult{" + method + " " + id
@@ -62,12 +75,19 @@
 
     /**
      * Used to package this object into a {@link Parcel}.
-     * 
+     *
      * @param dest The {@link Parcel} to be written.
      * @param flags The flags used for parceling.
      */
+    @Override
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeStrongInterface(method);
+        if (channel != null) {
+            dest.writeInt(1);
+            channel.writeToParcel(dest, 0);
+        } else {
+            dest.writeInt(0);
+        }
         dest.writeString(id);
         dest.writeInt(sequence);
     }
@@ -75,17 +95,21 @@
     /**
      * Used to make this class parcelable.
      */
-    public static final Parcelable.Creator<InputBindResult> CREATOR = new Parcelable.Creator<InputBindResult>() {
+    public static final Parcelable.Creator<InputBindResult> CREATOR =
+            new Parcelable.Creator<InputBindResult>() {
+        @Override
         public InputBindResult createFromParcel(Parcel source) {
             return new InputBindResult(source);
         }
 
+        @Override
         public InputBindResult[] newArray(int size) {
             return new InputBindResult[size];
         }
     };
 
+    @Override
     public int describeContents() {
-        return 0;
+        return channel != null ? channel.describeContents() : 0;
     }
 }
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 6bb7ac7..d1db230 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -835,6 +835,8 @@
                 (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
             // Don't show while in expanded mode or with empty text
             mTitleLayout.setVisibility(GONE);
+        } else {
+            mTitleLayout.setVisibility(VISIBLE);
         }
     }
 
@@ -1587,15 +1589,10 @@
                     mTitleLayout.setVisibility(VISIBLE);
                 }
             }
-            if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
-                mTabScrollView.setVisibility(VISIBLE);
-            }
-            if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
-                mSpinner.setVisibility(VISIBLE);
-            }
-            if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
-                mCustomNavView.setVisibility(VISIBLE);
-            }
+            if (mTabScrollView != null) mTabScrollView.setVisibility(VISIBLE);
+            if (mSpinner != null) mSpinner.setVisibility(VISIBLE);
+            if (mCustomNavView != null) mCustomNavView.setVisibility(VISIBLE);
+
             mExpandedHomeLayout.setIcon(null);
             mCurrentExpandedItem = null;
             setHomeButtonEnabled(mWasHomeEnabled); // Set by expandItemActionView above
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 1e27be8..66cea9d7 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -44,6 +44,7 @@
 	android_view_InputChannel.cpp \
 	android_view_InputDevice.cpp \
 	android_view_InputEventReceiver.cpp \
+	android_view_InputEventSender.cpp \
 	android_view_KeyEvent.cpp \
 	android_view_KeyCharacterMap.cpp \
 	android_view_HardwareRenderer.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 86d3cb6..1300d01 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -163,6 +163,7 @@
 extern int register_android_view_InputChannel(JNIEnv* env);
 extern int register_android_view_InputDevice(JNIEnv* env);
 extern int register_android_view_InputEventReceiver(JNIEnv* env);
+extern int register_android_view_InputEventSender(JNIEnv* env);
 extern int register_android_view_KeyCharacterMap(JNIEnv *env);
 extern int register_android_view_KeyEvent(JNIEnv* env);
 extern int register_android_view_MotionEvent(JNIEnv* env);
@@ -1195,6 +1196,7 @@
     REG_JNI(register_android_app_NativeActivity),
     REG_JNI(register_android_view_InputChannel),
     REG_JNI(register_android_view_InputEventReceiver),
+    REG_JNI(register_android_view_InputEventSender),
     REG_JNI(register_android_view_KeyEvent),
     REG_JNI(register_android_view_MotionEvent),
     REG_JNI(register_android_view_PointerIcon),
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 29a36de..90161fd 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -566,61 +566,23 @@
         return totalAdvance;
     }
 
-    static jfloat doTextRunAdvancesICU(JNIEnv *env, SkPaint *paint, const jchar *text,
-                                    jint start, jint count, jint contextCount, jint flags,
-                                    jfloatArray advances, jint advancesIndex) {
-        NPE_CHECK_RETURN_ZERO(env, paint);
-        NPE_CHECK_RETURN_ZERO(env, text);
-
-        if ((start | count | contextCount | advancesIndex) < 0 || contextCount < count) {
-            doThrowAIOOBE(env);
-            return 0;
-        }
-        if (count == 0) {
-            return 0;
-        }
-        if (advances) {
-            size_t advancesLength = env->GetArrayLength(advances);
-            if ((size_t)count > advancesLength) {
-                doThrowAIOOBE(env);
-                return 0;
-            }
-        }
-
-        jfloat advancesArray[count];
-        jfloat totalAdvance = 0;
-
-        TextLayout::getTextRunAdvancesICU(paint, text, start, count, contextCount, flags,
-                                       advancesArray, totalAdvance);
-
-        if (advances != NULL) {
-            env->SetFloatArrayRegion(advances, advancesIndex, count, advancesArray);
-        }
-        return totalAdvance;
-    }
-
-    static float getTextRunAdvances___CIIIII_FII(JNIEnv* env, jobject clazz, SkPaint* paint,
+    static float getTextRunAdvances___CIIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
             jcharArray text, jint index, jint count, jint contextIndex, jint contextCount,
-            jint flags, jfloatArray advances, jint advancesIndex, jint reserved) {
+            jint flags, jfloatArray advances, jint advancesIndex) {
         jchar* textArray = env->GetCharArrayElements(text, NULL);
-        jfloat result = (reserved == 0) ?
-                doTextRunAdvances(env, paint, textArray + contextIndex, index - contextIndex,
-                        count, contextCount, flags, advances, advancesIndex) :
-                doTextRunAdvancesICU(env, paint, textArray + contextIndex, index - contextIndex,
-                        count, contextCount, flags, advances, advancesIndex);
+        jfloat result = doTextRunAdvances(env, paint, textArray + contextIndex,
+                index - contextIndex, count, contextCount, flags, advances, advancesIndex);
         env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
         return result;
     }
 
-    static float getTextRunAdvances__StringIIIII_FII(JNIEnv* env, jobject clazz, SkPaint* paint,
+    static float getTextRunAdvances__StringIIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
             jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
-            jfloatArray advances, jint advancesIndex, jint reserved) {
+            jfloatArray advances, jint advancesIndex) {
         const jchar* textArray = env->GetStringChars(text, NULL);
-        jfloat result = (reserved == 0) ?
-                doTextRunAdvances(env, paint, textArray + contextStart, start - contextStart,
-                        end - start, contextEnd - contextStart, flags, advances, advancesIndex) :
-                doTextRunAdvancesICU(env, paint, textArray + contextStart, start - contextStart,
-                        end - start, contextEnd - contextStart, flags, advances, advancesIndex);
+        jfloat result = doTextRunAdvances(env, paint, textArray + contextStart,
+                start - contextStart, end - start, contextEnd - contextStart, flags,
+                advances, advancesIndex);
         env->ReleaseStringChars(text, textArray);
         return result;
     }
@@ -886,10 +848,10 @@
     {"native_breakText","(Ljava/lang/String;ZF[F)I", (void*) SkPaintGlue::breakTextS},
     {"native_getTextWidths","(I[CII[F)I", (void*) SkPaintGlue::getTextWidths___CII_F},
     {"native_getTextWidths","(ILjava/lang/String;II[F)I", (void*) SkPaintGlue::getTextWidths__StringII_F},
-    {"native_getTextRunAdvances","(I[CIIIII[FII)F",
-        (void*) SkPaintGlue::getTextRunAdvances___CIIIII_FII},
-    {"native_getTextRunAdvances","(ILjava/lang/String;IIIII[FII)F",
-        (void*) SkPaintGlue::getTextRunAdvances__StringIIIII_FII},
+    {"native_getTextRunAdvances","(I[CIIIII[FI)F",
+        (void*) SkPaintGlue::getTextRunAdvances___CIIIII_FI},
+    {"native_getTextRunAdvances","(ILjava/lang/String;IIIII[FI)F",
+        (void*) SkPaintGlue::getTextRunAdvances__StringIIIII_FI},
 
 
     {"native_getTextGlyphs","(ILjava/lang/String;IIIII[C)I",
diff --git a/core/jni/android/graphics/TextLayout.cpp b/core/jni/android/graphics/TextLayout.cpp
index 2beedad..34dc3e8 100644
--- a/core/jni/android/graphics/TextLayout.cpp
+++ b/core/jni/android/graphics/TextLayout.cpp
@@ -80,14 +80,6 @@
     }
 }
 
-void TextLayout::getTextRunAdvancesICU(SkPaint* paint, const jchar* chars, jint start,
-                                    jint count, jint contextCount, jint dirFlags,
-                                    jfloat* resultAdvances, jfloat& resultTotalAdvance) {
-    // Compute advances and return them
-    computeAdvancesWithICU(paint, chars, start, count, contextCount, dirFlags,
-            resultAdvances, &resultTotalAdvance);
-}
-
 void TextLayout::getTextPath(SkPaint *paint, const jchar *text, jsize len,
                              jint bidiFlags, jfloat x, jfloat y, SkPath *path) {
     handleText(paint, text, len, bidiFlags, x, y, path);
@@ -111,73 +103,4 @@
     canvas->drawTextOnPathHV(value->getGlyphs(), value->getGlyphsCount() * 2, *path, h_, v_, *paint);
 }
 
-void TextLayout::computeAdvancesWithICU(SkPaint* paint, const UChar* chars,
-        size_t start, size_t count, size_t contextCount, int dirFlags,
-        jfloat* outAdvances, jfloat* outTotalAdvance) {
-    SkAutoSTMalloc<CHAR_BUFFER_SIZE, jchar> tempBuffer(contextCount);
-    jchar* buffer = tempBuffer.get();
-    SkScalar* scalarArray = (SkScalar*)outAdvances;
-
-    // this is where we'd call harfbuzz
-    // for now we just use ushape.c
-    size_t widths;
-    const jchar* text;
-    if (dirFlags & 0x1) { // rtl, call arabic shaping in case
-        UErrorCode status = U_ZERO_ERROR;
-        // Use fixed length since we need to keep start and count valid
-        u_shapeArabic(chars, contextCount, buffer, contextCount,
-                U_SHAPE_LENGTH_FIXED_SPACES_NEAR |
-                U_SHAPE_TEXT_DIRECTION_LOGICAL | U_SHAPE_LETTERS_SHAPE |
-                U_SHAPE_X_LAMALEF_SUB_ALTERNATE, &status);
-        // we shouldn't fail unless there's an out of memory condition,
-        // in which case we're hosed anyway
-        for (int i = start, e = i + count; i < e; ++i) {
-            if (buffer[i] == UNICODE_NOT_A_CHAR) {
-                buffer[i] = UNICODE_ZWSP; // zero-width-space for skia
-            }
-        }
-        text = buffer + start;
-        widths = paint->getTextWidths(text, count << 1, scalarArray);
-    } else {
-        text = chars + start;
-        widths = paint->getTextWidths(text, count << 1, scalarArray);
-    }
-
-    jfloat totalAdvance = 0;
-    if (widths < count) {
-#if DEBUG_ADVANCES
-    ALOGD("ICU -- count=%d", widths);
-#endif
-        // Skia operates on code points, not code units, so surrogate pairs return only
-        // one value. Expand the result so we have one value per UTF-16 code unit.
-
-        // Note, skia's getTextWidth gets confused if it encounters a surrogate pair,
-        // leaving the remaining widths zero.  Not nice.
-        for (size_t i = 0, p = 0; i < widths; ++i) {
-            totalAdvance += outAdvances[p++] = SkScalarToFloat(scalarArray[i]);
-            if (p < count &&
-                    text[p] >= UNICODE_FIRST_LOW_SURROGATE &&
-                    text[p] < UNICODE_FIRST_PRIVATE_USE &&
-                    text[p-1] >= UNICODE_FIRST_HIGH_SURROGATE &&
-                    text[p-1] < UNICODE_FIRST_LOW_SURROGATE) {
-                outAdvances[p++] = 0;
-            }
-#if DEBUG_ADVANCES
-            ALOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
-#endif
-        }
-    } else {
-#if DEBUG_ADVANCES
-    ALOGD("ICU -- count=%d", count);
-#endif
-        for (size_t i = 0; i < count; i++) {
-            totalAdvance += outAdvances[i] = SkScalarToFloat(scalarArray[i]);
-#if DEBUG_ADVANCES
-            ALOGD("icu-adv = %f - total = %f", outAdvances[i], totalAdvance);
-#endif
-        }
-    }
-    *outTotalAdvance = totalAdvance;
-}
-
 }
diff --git a/core/jni/android/graphics/TextLayout.h b/core/jni/android/graphics/TextLayout.h
index a0f9402..d58c692 100644
--- a/core/jni/android/graphics/TextLayout.h
+++ b/core/jni/android/graphics/TextLayout.h
@@ -66,10 +66,6 @@
                                    jint count, jint contextCount, jint dirFlags,
                                    jfloat* resultAdvances, jfloat* resultTotalAdvance);
 
-    static void getTextRunAdvancesICU(SkPaint* paint, const jchar* chars, jint start,
-                                   jint count, jint contextCount, jint dirFlags,
-                                   jfloat* resultAdvances, jfloat& resultTotalAdvance);
-
     static void getTextPath(SkPaint* paint, const jchar* text, jsize len,
                             jint bidiFlags, jfloat x, jfloat y, SkPath* path);
 
@@ -82,9 +78,5 @@
 
     static void handleText(SkPaint* paint, const jchar* text, jsize len,
                            int bidiFlags, jfloat x, jfloat y, SkPath* path);
-
-    static void computeAdvancesWithICU(SkPaint* paint, const UChar* chars,
-            size_t start, size_t count, size_t contextCount, int dirFlags,
-            jfloat* outAdvances, jfloat* outTotalAdvance);
 };
 } // namespace android
diff --git a/core/jni/android_ddm_DdmHandleNativeHeap.cpp b/core/jni/android_ddm_DdmHandleNativeHeap.cpp
index 42d408d..f5eaf94 100644
--- a/core/jni/android_ddm_DdmHandleNativeHeap.cpp
+++ b/core/jni/android_ddm_DdmHandleNativeHeap.cpp
@@ -2,16 +2,16 @@
 **
 ** Copyright 2006, 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 
+** 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 
+**     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 
+** 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.
 */
 
@@ -23,20 +23,17 @@
 #include <android_runtime/AndroidRuntime.h>
 
 #include <utils/Log.h>
+#include <utils/String8.h>
 
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#if defined(__arm__)
-extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize, 
-        size_t* infoSize, size_t* totalMemory, size_t* backtraceSize);
-        
-extern "C" void free_malloc_leak_info(uint8_t* info);
-#endif
+extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize,
+                                     size_t* infoSize, size_t* totalMemory, size_t* backtraceSize);
 
-#define MAPS_FILE_SIZE 65 * 1024
+extern "C" void free_malloc_leak_info(uint8_t* info);
 
 struct Header {
     size_t mapSize;
@@ -48,96 +45,57 @@
 
 namespace android {
 
+static void ReadFile(const char* path, String8& s) {
+    int fd = open(path, O_RDONLY);
+    if (fd != -1) {
+        char bytes[1024];
+        ssize_t byteCount;
+        while ((byteCount = TEMP_FAILURE_RETRY(read(fd, bytes, sizeof(bytes)))) > 0) {
+            s.append(bytes, byteCount);
+        }
+        close(fd);
+    }
+}
+
 /*
- * Retrieve the native heap information and the info from /proc/<self>/maps,
+ * Retrieve the native heap information and the info from /proc/self/maps,
  * copy them into a byte[] with a "struct Header" that holds data offsets,
  * and return the array.
  */
-static jbyteArray getLeakInfo(JNIEnv *env, jobject clazz)
-{
-#if defined(__arm__)
-    // get the info in /proc/[pid]/map
+static jbyteArray DdmHandleNativeHeap_getLeakInfo(JNIEnv* env, jobject) {
     Header header;
     memset(&header, 0, sizeof(header));
 
-    pid_t pid = getpid();
-
-    char path[FILENAME_MAX];
-    sprintf(path, "/proc/%d/maps", pid);
-
-    struct stat sb;
-    int ret = stat(path, &sb);
-
-    uint8_t* mapsFile = NULL;
-    if (ret == 0) {
-        mapsFile = (uint8_t*)malloc(MAPS_FILE_SIZE);
-        int fd = open(path, O_RDONLY);
-    
-        if (mapsFile != NULL && fd != -1) {
-            int amount = 0;
-            do {
-                uint8_t* ptr = mapsFile + header.mapSize;
-                amount = read(fd, ptr, MAPS_FILE_SIZE);
-                if (amount <= 0) {
-                    if (errno != EINTR)
-                        break; 
-                    else
-                        continue;
-                }
-                header.mapSize += amount;
-            } while (header.mapSize < MAPS_FILE_SIZE);
-            
-            ALOGD("**** read %d bytes from '%s'", (int) header.mapSize, path);
-        }
-    }
+    String8 maps;
+    ReadFile("/proc/self/maps", maps);
+    header.mapSize = maps.size();
 
     uint8_t* allocBytes;
-    get_malloc_leak_info(&allocBytes, &header.allocSize, &header.allocInfoSize, 
-            &header.totalMemory, &header.backtraceSize);
+    get_malloc_leak_info(&allocBytes, &header.allocSize, &header.allocInfoSize,
+                         &header.totalMemory, &header.backtraceSize);
 
-    jbyte* bytes = NULL;
-    jbyte* ptr = NULL;
+    ALOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d",
+          header.mapSize, header.allocSize, header.allocInfoSize, header.totalMemory);
+
     jbyteArray array = env->NewByteArray(sizeof(Header) + header.mapSize + header.allocSize);
-    if (array == NULL) {
-        goto done;
+    if (array != NULL) {
+        env->SetByteArrayRegion(array, 0,
+                                sizeof(header), reinterpret_cast<jbyte*>(&header));
+        env->SetByteArrayRegion(array, sizeof(header),
+                                maps.size(), reinterpret_cast<const jbyte*>(maps.string()));
+        env->SetByteArrayRegion(array, sizeof(header) + maps.size(),
+                                header.allocSize, reinterpret_cast<jbyte*>(allocBytes));
     }
 
-    bytes = env->GetByteArrayElements(array, NULL);
-    ptr = bytes;
-
-//    ALOGD("*** mapSize: %d allocSize: %d allocInfoSize: %d totalMemory: %d", 
-//            header.mapSize, header.allocSize, header.allocInfoSize, header.totalMemory);
-
-    memcpy(ptr, &header, sizeof(header));
-    ptr += sizeof(header);
-    
-    if (header.mapSize > 0 && mapsFile != NULL) {
-        memcpy(ptr, mapsFile, header.mapSize);
-        ptr += header.mapSize;
-    }
-    
-    memcpy(ptr, allocBytes, header.allocSize);
-    env->ReleaseByteArrayElements(array, bytes, 0);
-
-done:
-    if (mapsFile != NULL) {
-        free(mapsFile);
-    }
-    // free the info up!
     free_malloc_leak_info(allocBytes);
-
     return array;
-#else
-    return NULL;
-#endif
 }
 
 static JNINativeMethod method_table[] = {
-    { "getLeakInfo", "()[B", (void*)getLeakInfo },
+    { "getLeakInfo", "()[B", (void*) DdmHandleNativeHeap_getLeakInfo },
 };
 
-int register_android_ddm_DdmHandleNativeHeap(JNIEnv *env)
-{
+int register_android_ddm_DdmHandleNativeHeap(JNIEnv* env) {
     return AndroidRuntime::registerNativeMethods(env, "android/ddm/DdmHandleNativeHeap", method_table, NELEM(method_table));
 }
 
diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp
index b12fdfc..0a97f39 100644
--- a/core/jni/android_os_SELinux.cpp
+++ b/core/jni/android_os_SELinux.cpp
@@ -23,428 +23,407 @@
 #include "selinux/selinux.h"
 #include "selinux/android.h"
 #include <errno.h>
+#include <ScopedLocalRef.h>
+#include <ScopedUtfChars.h>
+#include <UniquePtr.h>
 
 namespace android {
 
-  static jboolean isSELinuxDisabled = true;
+struct SecurityContext_Delete {
+    void operator()(security_context_t p) const {
+        freecon(p);
+    }
+};
+typedef UniquePtr<char[], SecurityContext_Delete> Unique_SecurityContext;
 
-  static void throw_NullPointerException(JNIEnv *env, const char* msg) {
-    jclass clazz;
-    clazz = env->FindClass("java/lang/NullPointerException");
-    env->ThrowNew(clazz, msg);
-  }
+static jboolean isSELinuxDisabled = true;
 
-  /*
-   * Function: isSELinuxEnabled
-   * Purpose:  checks whether SELinux is enabled/disbaled
-   * Parameters: none
-   * Return value : true (enabled) or false (disabled)
-   * Exceptions: none
-   */
-  static jboolean isSELinuxEnabled(JNIEnv *env, jobject classz) {
-
+/*
+ * Function: isSELinuxEnabled
+ * Purpose:  checks whether SELinux is enabled/disbaled
+ * Parameters: none
+ * Return value : true (enabled) or false (disabled)
+ * Exceptions: none
+ */
+static jboolean isSELinuxEnabled(JNIEnv *env, jobject) {
     return !isSELinuxDisabled;
-  }
+}
 
-  /*
-   * Function: isSELinuxEnforced
-   * Purpose: return the current SELinux enforce mode
-   * Parameters: none
-   * Return value: true (enforcing) or false (permissive)
-   * Exceptions: none
-   */
-  static jboolean isSELinuxEnforced(JNIEnv *env, jobject clazz) {
+/*
+ * Function: isSELinuxEnforced
+ * Purpose: return the current SELinux enforce mode
+ * Parameters: none
+ * Return value: true (enforcing) or false (permissive)
+ * Exceptions: none
+ */
+static jboolean isSELinuxEnforced(JNIEnv *env, jobject) {
     return (security_getenforce() == 1) ? true : false;
-  }
+}
 
-  /*
-   * Function: setSELinuxEnforce
-   * Purpose: set the SE Linux enforcing mode
-   * Parameters: true (enforcing) or false (permissive)
-   * Return value: true (success) or false (fail)
-   * Exceptions: none
-   */
-  static jboolean setSELinuxEnforce(JNIEnv *env, jobject clazz, jboolean value) {
-    if (isSELinuxDisabled)
-      return false;
+/*
+ * Function: setSELinuxEnforce
+ * Purpose: set the SE Linux enforcing mode
+ * Parameters: true (enforcing) or false (permissive)
+ * Return value: true (success) or false (fail)
+ * Exceptions: none
+ */
+static jboolean setSELinuxEnforce(JNIEnv *env, jobject, jboolean value) {
+    if (isSELinuxDisabled) {
+        return false;
+    }
 
-    int enforce = (value) ? 1 : 0;
+    int enforce = value ? 1 : 0;
 
     return (security_setenforce(enforce) != -1) ? true : false;
-  }
+}
 
-  /*
-   * Function: getPeerCon
-   * Purpose: retrieves security context of peer socket
-   * Parameters:
-   *        fileDescriptor: peer socket file as a FileDescriptor object
-   * Returns: jstring representing the security_context of socket or NULL if error
-   * Exceptions: NullPointerException if fileDescriptor object is NULL
-   */
-  static jstring getPeerCon(JNIEnv *env, jobject clazz, jobject fileDescriptor) {
-    if (isSELinuxDisabled)
-      return NULL;
+/*
+ * Function: getPeerCon
+ * Purpose: retrieves security context of peer socket
+ * Parameters:
+ *        fileDescriptor: peer socket file as a FileDescriptor object
+ * Returns: jstring representing the security_context of socket or NULL if error
+ * Exceptions: NullPointerException if fileDescriptor object is NULL
+ */
+static jstring getPeerCon(JNIEnv *env, jobject, jobject fileDescriptor) {
+    if (isSELinuxDisabled) {
+        return NULL;
+    }
 
     if (fileDescriptor == NULL) {
-      throw_NullPointerException(env, "Trying to check security context of a null peer socket.");
-      return NULL;
+        jniThrowNullPointerException(env,
+                "Trying to check security context of a null peer socket.");
+        return NULL;
     }
 
-    security_context_t context = NULL;
-    jstring securityString = NULL;
-
     int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
-
     if (env->ExceptionOccurred() != NULL) {
-      ALOGE("There was an issue with retrieving the file descriptor");
-      goto bail;
+        ALOGE("getPeerCon => getFD for %p failed", fileDescriptor);
+        return NULL;
     }
 
-    if (getpeercon(fd, &context) == -1)
-      goto bail;
+    security_context_t tmp;
+    int ret = getpeercon(fd, &tmp);
+    Unique_SecurityContext context(tmp);
 
-    ALOGV("getPeerCon: Successfully retrived context of peer socket '%s'", context);
-
-    securityString = env->NewStringUTF(context);
-
-  bail:
-    if (context != NULL)
-      freecon(context);
-
-    return securityString;
-  }
-
-  /*
-   * Function: setFSCreateCon
-   * Purpose: set security context used for creating a new file system object
-   * Parameters:
-   *       context: security_context_t representing the new context of a file system object,
-   *                set to NULL to return to the default policy behavior
-   * Returns: true on success, false on error
-   * Exception: none
-   */
-  static jboolean setFSCreateCon(JNIEnv *env, jobject clazz, jstring context) {
-    if (isSELinuxDisabled)
-      return false;
-
-    char * securityContext = NULL;
-    const char *constant_securityContext = NULL;
-
-    if (context != NULL) {
-      constant_securityContext = env->GetStringUTFChars(context, NULL);
-
-      // GetStringUTFChars returns const char * yet setfscreatecon needs char *
-      securityContext = const_cast<char *>(constant_securityContext);
+    ScopedLocalRef<jstring> contextStr(env, NULL);
+    if (ret != -1) {
+        contextStr.reset(env->NewStringUTF(context.get()));
     }
 
-    int ret;
-    if ((ret = setfscreatecon(securityContext)) == -1)
-      goto bail;
+    ALOGV("getPeerCon(%d) => %s", fd, contextStr.get());
+    return contextStr.release();
+}
 
-    ALOGV("setFSCreateCon: set new security context to '%s' ", context == NULL ? "default", context);
+/*
+ * Function: setFSCreateCon
+ * Purpose: set security context used for creating a new file system object
+ * Parameters:
+ *       context: security_context_t representing the new context of a file system object,
+ *                set to NULL to return to the default policy behavior
+ * Returns: true on success, false on error
+ * Exception: none
+ */
+static jboolean setFSCreateCon(JNIEnv *env, jobject, jstring contextStr) {
+    if (isSELinuxDisabled) {
+        return false;
+    }
 
-  bail:
-    if (constant_securityContext != NULL)
-      env->ReleaseStringUTFChars(context, constant_securityContext);
+    UniquePtr<ScopedUtfChars> context;
+    const char* context_c_str = NULL;
+    if (contextStr != NULL) {
+        context.reset(new ScopedUtfChars(env, contextStr));
+        context_c_str = context->c_str();
+        if (context_c_str == NULL) {
+            return false;
+        }
+    }
+
+    int ret = setfscreatecon(const_cast<char *>(context_c_str));
+
+    ALOGV("setFSCreateCon(%s) => %d", context_c_str, ret);
 
     return (ret == 0) ? true : false;
-  }
+}
 
-  /*
-   * Function: setFileCon
-   * Purpose:  set the security context of a file object
-   * Parameters:
-   *       path: the location of the file system object
-   *       con: the new security context of the file system object
-   * Returns: true on success, false on error
-   * Exception: NullPointerException is thrown if either path or context strign are NULL
-   */
-  static jboolean setFileCon(JNIEnv *env, jobject clazz, jstring path, jstring con) {
-    if (isSELinuxDisabled)
-      return false;
-
-    if (path == NULL) {
-      throw_NullPointerException(env, "Trying to change the security context of a NULL file object.");
-      return false;
+/*
+ * Function: setFileCon
+ * Purpose:  set the security context of a file object
+ * Parameters:
+ *       path: the location of the file system object
+ *       context: the new security context of the file system object
+ * Returns: true on success, false on error
+ * Exception: NullPointerException is thrown if either path or context strign are NULL
+ */
+static jboolean setFileCon(JNIEnv *env, jobject, jstring pathStr, jstring contextStr) {
+    if (isSELinuxDisabled) {
+        return false;
     }
 
-    if (con == NULL) {
-      throw_NullPointerException(env, "Trying to set the security context of a file object with NULL.");
-      return false;
+    ScopedUtfChars path(env, pathStr);
+    if (path.c_str() == NULL) {
+        return false;
     }
 
-    const char *objectPath = env->GetStringUTFChars(path, NULL);
-    const char *constant_con = env->GetStringUTFChars(con, NULL);
+    ScopedUtfChars context(env, contextStr);
+    if (context.c_str() == NULL) {
+        return false;
+    }
 
     // GetStringUTFChars returns const char * yet setfilecon needs char *
-    char *newCon = const_cast<char *>(constant_con);
+    char *tmp = const_cast<char *>(context.c_str());
+    int ret = setfilecon(path.c_str(), tmp);
 
-    int ret;
-    if ((ret = setfilecon(objectPath, newCon)) == -1)
-      goto bail;
-
-    ALOGV("setFileCon: Succesfully set security context '%s' for '%s'", newCon, objectPath);
-
-  bail:
-    env->ReleaseStringUTFChars(path, objectPath);
-    env->ReleaseStringUTFChars(con, constant_con);
+    ALOGV("setFileCon(%s, %s) => %d", path.c_str(), context.c_str(), ret);
     return (ret == 0) ? true : false;
-  }
+}
 
-  /*
-   * Function: getFileCon
-   * Purpose: retrieves the context associated with the given path in the file system
-   * Parameters:
-   *        path: given path in the file system
-   * Returns:
-   *        string representing the security context string of the file object
-   *        the string may be NULL if an error occured
-   * Exceptions: NullPointerException if the path object is null
-   */
-  static jstring getFileCon(JNIEnv *env, jobject clazz, jstring path) {
-    if (isSELinuxDisabled)
-      return NULL;
-
-    if (path == NULL) {
-      throw_NullPointerException(env, "Trying to check security context of a null path.");
-      return NULL;
+/*
+ * Function: getFileCon
+ * Purpose: retrieves the context associated with the given path in the file system
+ * Parameters:
+ *        path: given path in the file system
+ * Returns:
+ *        string representing the security context string of the file object
+ *        the string may be NULL if an error occured
+ * Exceptions: NullPointerException if the path object is null
+ */
+static jstring getFileCon(JNIEnv *env, jobject, jstring pathStr) {
+    if (isSELinuxDisabled) {
+        return NULL;
     }
 
-    const char *objectPath = env->GetStringUTFChars(path, NULL);
+    ScopedUtfChars path(env, pathStr);
+    if (path.c_str() == NULL) {
+        return NULL;
+    }
 
-    security_context_t context = NULL;
-    jstring securityString = NULL;
+    security_context_t tmp;
+    int ret = getfilecon(path.c_str(), &tmp);
+    Unique_SecurityContext context(tmp);
 
-    if (getfilecon(objectPath, &context) == -1)
-      goto bail;
+    ScopedLocalRef<jstring> securityString(env, NULL);
+    if (ret != -1) {
+        securityString.reset(env->NewStringUTF(context.get()));
+    }
 
-    ALOGV("getFileCon: Successfully retrived context '%s' for file '%s'", context, objectPath);
+    ALOGV("getFileCon(%s) => %s", path.c_str(), context.get());
+    return securityString.release();
+}
 
-    securityString = env->NewStringUTF(context);
+/*
+ * Function: getCon
+ * Purpose: Get the context of the current process.
+ * Parameters: none
+ * Returns: a jstring representing the security context of the process,
+ *          the jstring may be NULL if there was an error
+ * Exceptions: none
+ */
+static jstring getCon(JNIEnv *env, jobject) {
+    if (isSELinuxDisabled) {
+        return NULL;
+    }
 
-  bail:
-    if (context != NULL)
-      freecon(context);
+    security_context_t tmp;
+    int ret = getcon(&tmp);
+    Unique_SecurityContext context(tmp);
 
-    env->ReleaseStringUTFChars(path, objectPath);
+    ScopedLocalRef<jstring> securityString(env, NULL);
+    if (ret != -1) {
+        securityString.reset(env->NewStringUTF(context.get()));
+    }
 
-    return securityString;
-  }
+    ALOGV("getCon() => %s", context.get());
+    return securityString.release();
+}
 
-  /*
-   * Function: getCon
-   * Purpose: Get the context of the current process.
-   * Parameters: none
-   * Returns: a jstring representing the security context of the process,
-   *          the jstring may be NULL if there was an error
-   * Exceptions: none
-   */
-  static jstring getCon(JNIEnv *env, jobject clazz) {
-    if (isSELinuxDisabled)
-      return NULL;
+/*
+ * Function: getPidCon
+ * Purpose: Get the context of a process identified by its pid
+ * Parameters:
+ *            pid: a jint representing the process
+ * Returns: a jstring representing the security context of the pid,
+ *          the jstring may be NULL if there was an error
+ * Exceptions: none
+ */
+static jstring getPidCon(JNIEnv *env, jobject, jint pid) {
+    if (isSELinuxDisabled) {
+        return NULL;
+    }
 
-    security_context_t context = NULL;
-    jstring securityString = NULL;
+    security_context_t tmp;
+    int ret = getpidcon(static_cast<pid_t>(pid), &tmp);
+    Unique_SecurityContext context(tmp);
 
-    if (getcon(&context) == -1)
-      goto bail;
+    ScopedLocalRef<jstring> securityString(env, NULL);
+    if (ret != -1) {
+        securityString.reset(env->NewStringUTF(context.get()));
+    }
 
-    ALOGV("getCon: Successfully retrieved context '%s'", context);
+    ALOGV("getPidCon(%d) => %s", pid, context.get());
+    return securityString.release();
+}
 
-    securityString = env->NewStringUTF(context);
-
-  bail:
-    if (context != NULL)
-      freecon(context);
-
-    return securityString;
-  }
-
-  /*
-   * Function: getPidCon
-   * Purpose: Get the context of a process identified by its pid
-   * Parameters:
-   *            pid: a jint representing the process
-   * Returns: a jstring representing the security context of the pid,
-   *          the jstring may be NULL if there was an error
-   * Exceptions: none
-   */
-  static jstring getPidCon(JNIEnv *env, jobject clazz, jint pid) {
-    if (isSELinuxDisabled)
-      return NULL;
-
-    security_context_t context = NULL;
-    jstring securityString = NULL;
-
-    pid_t checkPid = (pid_t)pid;
-
-    if (getpidcon(checkPid, &context) == -1)
-      goto bail;
-
-    ALOGV("getPidCon: Successfully retrived context '%s' for pid '%d'", context, checkPid);
-
-    securityString = env->NewStringUTF(context);
-
-  bail:
-    if (context != NULL)
-      freecon(context);
-
-    return securityString;
-  }
-
-  /*
-   * Function: getBooleanNames
-   * Purpose: Gets a list of the SELinux boolean names.
-   * Parameters: None
-   * Returns: an array of strings  containing the SELinux boolean names.
-   *          returns NULL string on error
-   * Exceptions: None
-   */
-  static jobjectArray getBooleanNames(JNIEnv *env, JNIEnv clazz) {
-    if (isSELinuxDisabled)
-      return NULL;
+/*
+ * Function: getBooleanNames
+ * Purpose: Gets a list of the SELinux boolean names.
+ * Parameters: None
+ * Returns: an array of strings  containing the SELinux boolean names.
+ *          returns NULL string on error
+ * Exceptions: None
+ */
+static jobjectArray getBooleanNames(JNIEnv *env, JNIEnv) {
+    if (isSELinuxDisabled) {
+        return NULL;
+    }
 
     char **list;
-    int i, len, ret;
-    jclass stringClass;
-    jobjectArray stringArray = NULL;
+    int len;
+    if (security_get_boolean_names(&list, &len) == -1) {
+        return NULL;
+    }
 
-    if (security_get_boolean_names(&list, &len) == -1)
-      return NULL;
-
-    stringClass = env->FindClass("java/lang/String");
-    stringArray = env->NewObjectArray(len, stringClass, env->NewStringUTF(""));
-    for (i = 0; i < len; i++) {
-      jstring obj;
-      obj = env->NewStringUTF(list[i]);
-      env->SetObjectArrayElement(stringArray, i, obj);
-      env->DeleteLocalRef(obj);
-      free(list[i]);
+    jclass stringClass = env->FindClass("java/lang/String");
+    jobjectArray stringArray = env->NewObjectArray(len, stringClass, NULL);
+    for (int i = 0; i < len; i++) {
+        ScopedLocalRef<jstring> obj(env, env->NewStringUTF(list[i]));
+        env->SetObjectArrayElement(stringArray, i, obj.get());
+        free(list[i]);
     }
     free(list);
 
     return stringArray;
-  }
+}
 
-  /*
-   * Function: getBooleanValue
-   * Purpose: Gets the value for the given SELinux boolean name.
-   * Parameters:
-   *            String: The name of the SELinux boolean.
-   * Returns: a boolean: (true) boolean is set or (false) it is not.
-   * Exceptions: None
-   */
-  static jboolean getBooleanValue(JNIEnv *env, jobject clazz, jstring name) {
-    if (isSELinuxDisabled)
-      return false;
+/*
+ * Function: getBooleanValue
+ * Purpose: Gets the value for the given SELinux boolean name.
+ * Parameters:
+ *            String: The name of the SELinux boolean.
+ * Returns: a boolean: (true) boolean is set or (false) it is not.
+ * Exceptions: None
+ */
+static jboolean getBooleanValue(JNIEnv *env, jobject, jstring nameStr) {
+    if (isSELinuxDisabled) {
+        return false;
+    }
 
-    const char *boolean_name;
-    int ret;
+    if (nameStr == NULL) {
+        return false;
+    }
 
-    if (name == NULL)
-      return false;
-    boolean_name = env->GetStringUTFChars(name, NULL);
-    ret = security_get_boolean_active(boolean_name);
-    env->ReleaseStringUTFChars(name, boolean_name);
+    ScopedUtfChars name(env, nameStr);
+    int ret = security_get_boolean_active(name.c_str());
+
+    ALOGV("getBooleanValue(%s) => %d", name.c_str(), ret);
     return (ret == 1) ? true : false;
-  }
+}
 
-  /*
-   * Function: setBooleanNames
-   * Purpose: Sets the value for the given SELinux boolean name.
-   * Parameters:
-   *            String: The name of the SELinux boolean.
-   *            Boolean: The new value of the SELinux boolean.
-   * Returns: a boolean indicating whether or not the operation succeeded.
-   * Exceptions: None
-   */
-  static jboolean setBooleanValue(JNIEnv *env, jobject clazz, jstring name, jboolean value) {
-    if (isSELinuxDisabled)
-      return false;
+/*
+ * Function: setBooleanNames
+ * Purpose: Sets the value for the given SELinux boolean name.
+ * Parameters:
+ *            String: The name of the SELinux boolean.
+ *            Boolean: The new value of the SELinux boolean.
+ * Returns: a boolean indicating whether or not the operation succeeded.
+ * Exceptions: None
+ */
+static jboolean setBooleanValue(JNIEnv *env, jobject, jstring nameStr, jboolean value) {
+    if (isSELinuxDisabled) {
+        return false;
+    }
 
-    const char *boolean_name = NULL;
-    int ret;
+    if (nameStr == NULL) {
+        return false;
+    }
 
-    if (name == NULL)
-      return false;
-    boolean_name = env->GetStringUTFChars(name, NULL);
-    ret = security_set_boolean(boolean_name, (value) ? 1 : 0);
-    env->ReleaseStringUTFChars(name, boolean_name);
-    if (ret)
-      return false;
+    ScopedUtfChars name(env, nameStr);
+    int ret = security_set_boolean(name.c_str(), value ? 1 : 0);
+    if (ret) {
+        return false;
+    }
 
-    if (security_commit_booleans() == -1)
-      return false;
+    if (security_commit_booleans() == -1) {
+        return false;
+    }
 
     return true;
-  }
+}
 
-  /*
-   * Function: checkSELinuxAccess
-   * Purpose: Check permissions between two security contexts.
-   * Parameters: scon: subject security context as a string
-   *             tcon: object security context as a string
-   *             tclass: object's security class name as a string
-   *             perm: permission name as a string
-   * Returns: boolean: (true) if permission was granted, (false) otherwise
-   * Exceptions: None
-   */
-  static jboolean checkSELinuxAccess(JNIEnv *env, jobject clazz, jstring scon, jstring tcon, jstring tclass, jstring perm) {
-    if (isSELinuxDisabled)
-      return true;
+/*
+ * Function: checkSELinuxAccess
+ * Purpose: Check permissions between two security contexts.
+ * Parameters: subjectContextStr: subject security context as a string
+ *             objectContextStr: object security context as a string
+ *             objectClassStr: object's security class name as a string
+ *             permissionStr: permission name as a string
+ * Returns: boolean: (true) if permission was granted, (false) otherwise
+ * Exceptions: None
+ */
+static jboolean checkSELinuxAccess(JNIEnv *env, jobject, jstring subjectContextStr,
+        jstring objectContextStr, jstring objectClassStr, jstring permissionStr) {
+    if (isSELinuxDisabled) {
+        return true;
+    }
 
-    int accessGranted = -1;
+    ScopedUtfChars subjectContext(env, subjectContextStr);
+    if (subjectContext.c_str() == NULL) {
+        return false;
+    }
 
-    const char *const_scon, *const_tcon, *mytclass, *myperm;
-    char *myscon, *mytcon;
+    ScopedUtfChars objectContext(env, objectContextStr);
+    if (objectContext.c_str() == NULL) {
+        return false;
+    }
 
-    if (scon == NULL || tcon == NULL || tclass == NULL || perm == NULL)
-      goto bail;
+    ScopedUtfChars objectClass(env, objectClassStr);
+    if (objectClass.c_str() == NULL) {
+        return false;
+    }
 
-    const_scon = env->GetStringUTFChars(scon, NULL);
-    const_tcon = env->GetStringUTFChars(tcon, NULL);
-    mytclass   = env->GetStringUTFChars(tclass, NULL);
-    myperm     = env->GetStringUTFChars(perm, NULL);
+    ScopedUtfChars permission(env, permissionStr);
+    if (permission.c_str() == NULL) {
+        return false;
+    }
 
-    // selinux_check_access needs char* for some
-    myscon = const_cast<char *>(const_scon);
-    mytcon = const_cast<char *>(const_tcon);
+    char *tmp1 = const_cast<char *>(subjectContext.c_str());
+    char *tmp2 = const_cast<char *>(objectContext.c_str());
+    int accessGranted = selinux_check_access(tmp1, tmp2, objectClass.c_str(), permission.c_str(),
+            NULL);
 
-    accessGranted = selinux_check_access(myscon, mytcon, mytclass, myperm, NULL);
+    ALOGV("checkSELinuxAccess(%s, %s, %s, %s) => %d", subjectContext.c_str(), objectContext.c_str(),
+            objectClass.c_str(), permission.c_str(), accessGranted);
 
-    ALOGV("selinux_check_access returned %d", accessGranted);
-
-    env->ReleaseStringUTFChars(scon, const_scon);
-    env->ReleaseStringUTFChars(tcon, const_tcon);
-    env->ReleaseStringUTFChars(tclass, mytclass);
-    env->ReleaseStringUTFChars(perm, myperm);
-
-  bail:
     return (accessGranted == 0) ? true : false;
-  }
+}
 
-  /*
-   * Function: native_restorecon
-   * Purpose: restore default SELinux security context
-   * Parameters: pathname: the pathname for the file to be relabeled
-   * Returns: boolean: (true) file label successfully restored, (false) otherwise
-   * Exceptions: none
-   */
-  static jboolean native_restorecon(JNIEnv *env, jobject clazz, jstring pathname) {
-    if (isSELinuxDisabled)
-      return true;
+/*
+ * Function: native_restorecon
+ * Purpose: restore default SELinux security context
+ * Parameters: pathname: the pathname for the file to be relabeled
+ * Returns: boolean: (true) file label successfully restored, (false) otherwise
+ * Exceptions: none
+ */
+static jboolean native_restorecon(JNIEnv *env, jobject, jstring pathnameStr) {
+    if (isSELinuxDisabled) {
+        return true;
+    }
 
-    const char *file = const_cast<char *>(env->GetStringUTFChars(pathname, NULL));
-    int ret = selinux_android_restorecon(file);
-    env->ReleaseStringUTFChars(pathname, file);
+    ScopedUtfChars pathname(env, pathnameStr);
+    if (pathname.c_str() == NULL) {
+        ALOGV("restorecon(%p) => threw exception", pathname);
+        return false;
+    }
+
+    int ret = selinux_android_restorecon(pathname.c_str());
+    ALOGV("restorecon(%s) => %d", pathname.c_str(), ret);
     return (ret == 0);
-  }
+}
 
-  /*
-   * JNI registration.
-   */
-  static JNINativeMethod method_table[] = {
-
+/*
+ * JNI registration.
+ */
+static JNINativeMethod method_table[] = {
     /* name,                     signature,                    funcPtr */
     { "checkSELinuxAccess"       , "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z" , (void*)checkSELinuxAccess },
     { "getBooleanNames"          , "()[Ljava/lang/String;"                        , (void*)getBooleanNames  },
@@ -460,25 +439,25 @@
     { "setFileContext"           , "(Ljava/lang/String;Ljava/lang/String;)Z"      , (void*)setFileCon       },
     { "setFSCreateContext"       , "(Ljava/lang/String;)Z"                        , (void*)setFSCreateCon   },
     { "setSELinuxEnforce"        , "(Z)Z"                                         , (void*)setSELinuxEnforce},
-  };
+};
 
-  static int log_callback(int type, const char *fmt, ...) {
+static int log_callback(int type, const char *fmt, ...) {
     va_list ap;
     va_start(ap, fmt);
     LOG_PRI_VA(ANDROID_LOG_ERROR, "SELinux", fmt, ap);
     va_end(ap);
     return 0;
-  }
+}
 
-  int register_android_os_SELinux(JNIEnv *env) {
+int register_android_os_SELinux(JNIEnv *env) {
     union selinux_callback cb;
     cb.func_log = log_callback;
     selinux_set_callback(SELINUX_CB_LOG, cb);
 
     isSELinuxDisabled = (is_selinux_enabled() != 1) ? true : false;
 
-    return AndroidRuntime::registerNativeMethods(
-         env, "android/os/SELinux",
-         method_table, NELEM(method_table));
-  }
+    return AndroidRuntime::registerNativeMethods(env, "android/os/SELinux", method_table,
+            NELEM(method_table));
+}
+
 }
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 10c92ba..b87fe27 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -868,8 +868,8 @@
 }
 
 static void android_view_GLES20Canvas_drawLayer(JNIEnv* env, jobject clazz,
-        OpenGLRenderer* renderer, Layer* layer, jfloat x, jfloat y, SkPaint* paint) {
-    renderer->drawLayer(layer, x, y, paint);
+        OpenGLRenderer* renderer, Layer* layer, jfloat x, jfloat y) {
+    renderer->drawLayer(layer, x, y);
 }
 
 static jboolean android_view_GLES20Canvas_copyLayer(JNIEnv* env, jobject clazz,
@@ -1050,7 +1050,7 @@
     { "nClearLayerTexture",      "(I)V",       (void*) android_view_GLES20Canvas_clearLayerTexture },
     { "nDestroyLayer",           "(I)V",       (void*) android_view_GLES20Canvas_destroyLayer },
     { "nDestroyLayerDeferred",   "(I)V",       (void*) android_view_GLES20Canvas_destroyLayerDeferred },
-    { "nDrawLayer",              "(IIFFI)V",   (void*) android_view_GLES20Canvas_drawLayer },
+    { "nDrawLayer",              "(IIFF)V",    (void*) android_view_GLES20Canvas_drawLayer },
     { "nCopyLayer",              "(II)Z",      (void*) android_view_GLES20Canvas_copyLayer },
     { "nClearLayerUpdates",      "(I)V",       (void*) android_view_GLES20Canvas_clearLayerUpdates },
     { "nPushLayerUpdate",        "(II)V",      (void*) android_view_GLES20Canvas_pushLayerUpdate },
diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp
new file mode 100644
index 0000000..bd1d103
--- /dev/null
+++ b/core/jni/android_view_InputEventSender.cpp
@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#define LOG_TAG "InputEventSender"
+
+//#define LOG_NDEBUG 0
+
+// Log debug messages about the dispatch cycle.
+#define DEBUG_DISPATCH_CYCLE 0
+
+
+#include "JNIHelp.h"
+
+#include <android_runtime/AndroidRuntime.h>
+#include <utils/Log.h>
+#include <utils/Looper.h>
+#include <utils/threads.h>
+#include <utils/KeyedVector.h>
+#include <androidfw/InputTransport.h>
+#include "android_os_MessageQueue.h"
+#include "android_view_InputChannel.h"
+#include "android_view_KeyEvent.h"
+#include "android_view_MotionEvent.h"
+
+namespace android {
+
+static struct {
+    jclass clazz;
+
+    jmethodID dispatchInputEventFinished;
+} gInputEventSenderClassInfo;
+
+
+class NativeInputEventSender : public LooperCallback {
+public:
+    NativeInputEventSender(JNIEnv* env,
+            jobject senderObj, const sp<InputChannel>& inputChannel,
+            const sp<MessageQueue>& messageQueue);
+
+    status_t initialize();
+    void dispose();
+    status_t sendKeyEvent(uint32_t seq, const KeyEvent* event);
+    status_t sendMotionEvent(uint32_t seq, const MotionEvent* event);
+
+protected:
+    virtual ~NativeInputEventSender();
+
+private:
+    jobject mSenderObjGlobal;
+    InputPublisher mInputPublisher;
+    sp<MessageQueue> mMessageQueue;
+    KeyedVector<uint32_t, uint32_t> mPublishedSeqMap;
+    uint32_t mNextPublishedSeq;
+
+    const char* getInputChannelName() {
+        return mInputPublisher.getChannel()->getName().string();
+    }
+
+    virtual int handleEvent(int receiveFd, int events, void* data);
+    status_t receiveFinishedSignals(JNIEnv* env);
+};
+
+
+NativeInputEventSender::NativeInputEventSender(JNIEnv* env,
+        jobject senderObj, const sp<InputChannel>& inputChannel,
+        const sp<MessageQueue>& messageQueue) :
+        mSenderObjGlobal(env->NewGlobalRef(senderObj)),
+        mInputPublisher(inputChannel), mMessageQueue(messageQueue),
+        mNextPublishedSeq(0) {
+#if DEBUG_DISPATCH_CYCLE
+    ALOGD("channel '%s' ~ Initializing input event sender.", getInputChannelName());
+#endif
+}
+
+NativeInputEventSender::~NativeInputEventSender() {
+    JNIEnv* env = AndroidRuntime::getJNIEnv();
+    env->DeleteGlobalRef(mSenderObjGlobal);
+}
+
+status_t NativeInputEventSender::initialize() {
+    int receiveFd = mInputPublisher.getChannel()->getFd();
+    mMessageQueue->getLooper()->addFd(receiveFd, 0, ALOOPER_EVENT_INPUT, this, NULL);
+    return OK;
+}
+
+void NativeInputEventSender::dispose() {
+#if DEBUG_DISPATCH_CYCLE
+    ALOGD("channel '%s' ~ Disposing input event sender.", getInputChannelName());
+#endif
+
+    mMessageQueue->getLooper()->removeFd(mInputPublisher.getChannel()->getFd());
+}
+
+status_t NativeInputEventSender::sendKeyEvent(uint32_t seq, const KeyEvent* event) {
+#if DEBUG_DISPATCH_CYCLE
+    ALOGD("channel '%s' ~ Sending key event, seq=%u.", getInputChannelName(), seq);
+#endif
+
+    uint32_t publishedSeq = mNextPublishedSeq++;
+    status_t status = mInputPublisher.publishKeyEvent(publishedSeq,
+            event->getDeviceId(), event->getSource(), event->getAction(), event->getFlags(),
+            event->getKeyCode(), event->getScanCode(), event->getMetaState(),
+            event->getRepeatCount(), event->getDownTime(), event->getEventTime());
+    if (status) {
+        ALOGW("Failed to send key event on channel '%s'.  status=%d",
+                getInputChannelName(), status);
+        return status;
+    }
+    mPublishedSeqMap.add(publishedSeq, seq);
+    return OK;
+}
+
+status_t NativeInputEventSender::sendMotionEvent(uint32_t seq, const MotionEvent* event) {
+#if DEBUG_DISPATCH_CYCLE
+    ALOGD("channel '%s' ~ Sending motion event, seq=%u.", getInputChannelName(), seq);
+#endif
+
+    uint32_t publishedSeq;
+    for (size_t i = 0; i <= event->getHistorySize(); i++) {
+        publishedSeq = mNextPublishedSeq++;
+        status_t status = mInputPublisher.publishMotionEvent(publishedSeq,
+                event->getDeviceId(), event->getSource(), event->getAction(), event->getFlags(),
+                event->getEdgeFlags(), event->getMetaState(), event->getButtonState(),
+                event->getXOffset(), event->getYOffset(),
+                event->getXPrecision(), event->getYPrecision(),
+                event->getDownTime(), event->getHistoricalEventTime(i),
+                event->getPointerCount(), event->getPointerProperties(),
+                event->getHistoricalRawPointerCoords(0, i));
+        if (status) {
+            ALOGW("Failed to send motion event sample on channel '%s'.  status=%d",
+                    getInputChannelName(), status);
+            return status;
+        }
+    }
+    mPublishedSeqMap.add(publishedSeq, seq);
+    return OK;
+}
+
+int NativeInputEventSender::handleEvent(int receiveFd, int events, void* data) {
+    if (events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP)) {
+        ALOGE("channel '%s' ~ Consumer closed input channel or an error occurred.  "
+                "events=0x%x", getInputChannelName(), events);
+        return 0; // remove the callback
+    }
+
+    if (!(events & ALOOPER_EVENT_INPUT)) {
+        ALOGW("channel '%s' ~ Received spurious callback for unhandled poll event.  "
+                "events=0x%x", getInputChannelName(), events);
+        return 1;
+    }
+
+    JNIEnv* env = AndroidRuntime::getJNIEnv();
+    status_t status = receiveFinishedSignals(env);
+    mMessageQueue->raiseAndClearException(env, "handleReceiveCallback");
+    return status == OK || status == NO_MEMORY ? 1 : 0;
+}
+
+status_t NativeInputEventSender::receiveFinishedSignals(JNIEnv* env) {
+#if DEBUG_DISPATCH_CYCLE
+    ALOGD("channel '%s' ~ Receiving finished signals.", getInputChannelName());
+#endif
+
+    bool skipCallbacks = false;
+    for (;;) {
+        uint32_t publishedSeq;
+        bool handled;
+        status_t status = mInputPublisher.receiveFinishedSignal(&publishedSeq, &handled);
+        if (status) {
+            if (status == WOULD_BLOCK) {
+                return OK;
+            }
+            ALOGE("channel '%s' ~ Failed to consume finished signals.  status=%d",
+                    getInputChannelName(), status);
+            return status;
+        }
+
+        ssize_t index = mPublishedSeqMap.indexOfKey(publishedSeq);
+        if (index >= 0) {
+            uint32_t seq = mPublishedSeqMap.valueAt(index);
+            mPublishedSeqMap.removeItemsAt(index);
+
+#if DEBUG_DISPATCH_CYCLE
+            ALOGD("channel '%s' ~ Received finished signal, seq=%u, handled=%s, "
+                    "pendingEvents=%u.",
+                    getInputChannelName(), seq, handled ? "true" : "false",
+                    mPublishedSeqMap.size());
+#endif
+
+            if (!skipCallbacks) {
+                env->CallVoidMethod(mSenderObjGlobal,
+                        gInputEventSenderClassInfo.dispatchInputEventFinished,
+                        jint(seq), jboolean(handled));
+                if (env->ExceptionCheck()) {
+                    ALOGE("Exception dispatching finished signal.");
+                    skipCallbacks = true;
+                }
+            }
+        }
+    }
+}
+
+
+static jint nativeInit(JNIEnv* env, jclass clazz, jobject senderObj,
+        jobject inputChannelObj, jobject messageQueueObj) {
+    sp<InputChannel> inputChannel = android_view_InputChannel_getInputChannel(env,
+            inputChannelObj);
+    if (inputChannel == NULL) {
+        jniThrowRuntimeException(env, "InputChannel is not initialized.");
+        return 0;
+    }
+
+    sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueueObj);
+    if (messageQueue == NULL) {
+        jniThrowRuntimeException(env, "MessageQueue is not initialized.");
+        return 0;
+    }
+
+    sp<NativeInputEventSender> sender = new NativeInputEventSender(env,
+            senderObj, inputChannel, messageQueue);
+    status_t status = sender->initialize();
+    if (status) {
+        String8 message;
+        message.appendFormat("Failed to initialize input event sender.  status=%d", status);
+        jniThrowRuntimeException(env, message.string());
+        return 0;
+    }
+
+    sender->incStrong(gInputEventSenderClassInfo.clazz); // retain a reference for the object
+    return reinterpret_cast<jint>(sender.get());
+}
+
+static void nativeDispose(JNIEnv* env, jclass clazz, jint senderPtr) {
+    sp<NativeInputEventSender> sender =
+            reinterpret_cast<NativeInputEventSender*>(senderPtr);
+    sender->dispose();
+    sender->decStrong(gInputEventSenderClassInfo.clazz); // drop reference held by the object
+}
+
+static jboolean nativeSendKeyEvent(JNIEnv* env, jclass clazz, jint senderPtr,
+        jint seq, jobject eventObj) {
+    sp<NativeInputEventSender> sender =
+            reinterpret_cast<NativeInputEventSender*>(senderPtr);
+    KeyEvent event;
+    android_view_KeyEvent_toNative(env, eventObj, &event);
+    status_t status = sender->sendKeyEvent(seq, &event);
+    return !status;
+}
+
+static jboolean nativeSendMotionEvent(JNIEnv* env, jclass clazz, jint senderPtr,
+        jint seq, jobject eventObj) {
+    sp<NativeInputEventSender> sender =
+            reinterpret_cast<NativeInputEventSender*>(senderPtr);
+    MotionEvent* event = android_view_MotionEvent_getNativePtr(env, eventObj);
+    status_t status = sender->sendMotionEvent(seq, event);
+    return !status;
+}
+
+
+static JNINativeMethod gMethods[] = {
+    /* name, signature, funcPtr */
+    { "nativeInit",
+            "(Landroid/view/InputEventSender;Landroid/view/InputChannel;Landroid/os/MessageQueue;)I",
+            (void*)nativeInit },
+    { "nativeDispose", "(I)V",
+            (void*)nativeDispose },
+    { "nativeSendKeyEvent", "(IILandroid/view/KeyEvent;)Z",
+            (void*)nativeSendKeyEvent },
+    { "nativeSendMotionEvent", "(IILandroid/view/MotionEvent;)Z",
+            (void*)nativeSendMotionEvent },
+};
+
+#define FIND_CLASS(var, className) \
+        var = env->FindClass(className); \
+        LOG_FATAL_IF(! var, "Unable to find class " className); \
+        var = jclass(env->NewGlobalRef(var));
+
+#define GET_METHOD_ID(var, clazz, methodName, methodDescriptor) \
+        var = env->GetMethodID(clazz, methodName, methodDescriptor); \
+        LOG_FATAL_IF(! var, "Unable to find method " methodName);
+
+int register_android_view_InputEventSender(JNIEnv* env) {
+    int res = jniRegisterNativeMethods(env, "android/view/InputEventSender",
+            gMethods, NELEM(gMethods));
+    LOG_FATAL_IF(res < 0, "Unable to register native methods.");
+
+    FIND_CLASS(gInputEventSenderClassInfo.clazz, "android/view/InputEventSender");
+
+    GET_METHOD_ID(gInputEventSenderClassInfo.dispatchInputEventFinished,
+            gInputEventSenderClassInfo.clazz,
+            "dispatchInputEventFinished", "(IZ)V");
+    return 0;
+}
+
+} // namespace android
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 4671282..a41a389 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -55,6 +55,7 @@
 static struct {
     jclass clazz;
     jfieldID mNativeObject;
+    jfieldID mNativeObjectLock;
     jfieldID mCanvas;
     jmethodID ctor;
 } gSurfaceClassInfo;
@@ -90,8 +91,15 @@
 }
 
 sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj) {
-    return reinterpret_cast<Surface *>(
-            env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeObject));
+    sp<Surface> sur;
+    jobject lock = env->GetObjectField(surfaceObj,
+            gSurfaceClassInfo.mNativeObjectLock);
+    if (env->MonitorEnter(lock) == JNI_OK) {
+        sur = reinterpret_cast<Surface *>(
+                env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeObject));
+        env->MonitorExit(lock);
+    }
+    return sur;
 }
 
 jobject android_view_Surface_createFromIGraphicBufferProducer(JNIEnv* env,
@@ -399,6 +407,8 @@
     gSurfaceClassInfo.clazz = jclass(env->NewGlobalRef(clazz));
     gSurfaceClassInfo.mNativeObject =
             env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObject", "I");
+    gSurfaceClassInfo.mNativeObjectLock =
+            env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObjectLock", "Ljava/lang/Object;");
     gSurfaceClassInfo.mCanvas =
             env->GetFieldID(gSurfaceClassInfo.clazz, "mCanvas", "Landroid/graphics/Canvas;");
     gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(I)V");
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 5a1c0f8..9eca0ce 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -74,6 +74,11 @@
     <protected-broadcast android:name="android.app.action.ENTER_DESK_MODE" />
     <protected-broadcast android:name="android.app.action.EXIT_DESK_MODE" />
 
+    <protected-broadcast android:name="android.appwidget.action.APPWIDGET_UPDATE_OPTIONS" />
+    <protected-broadcast android:name="android.appwidget.action.APPWIDGET_DELETED" />
+    <protected-broadcast android:name="android.appwidget.action.APPWIDGET_DISABLED" />
+    <protected-broadcast android:name="android.appwidget.action.APPWIDGET_ENABLED" />
+
     <protected-broadcast android:name="android.backup.intent.RUN" />
     <protected-broadcast android:name="android.backup.intent.CLEAR" />
     <protected-broadcast android:name="android.backup.intent.INIT" />
@@ -1073,10 +1078,10 @@
 
     <!-- Group of permissions that are related to the screenlock. -->
     <permission-group android:name="android.permission-group.SCREENLOCK"
-        android:label="@string/permgrouplab_storage"
+        android:label="@string/permgrouplab_screenlock"
         android:icon="@drawable/perm_group_screenlock"
         android:permissionGroupFlags="personalInfo"
-        android:description="@string/permgroupdesc_storage"
+        android:description="@string/permgroupdesc_screenlock"
         android:priority="230" />
 
     <!-- Allows applications to disable the keyguard -->
diff --git a/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_default_holo_dark.9.png b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_default_holo_dark.9.png
new file mode 100644
index 0000000..45450e4
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_default_holo_light.9.png b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_default_holo_light.9.png
new file mode 100644
index 0000000..b568989
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_focused_holo_dark.9.png b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_focused_holo_dark.9.png
new file mode 100644
index 0000000..e0434584
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_focused_holo_light.9.png b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_focused_holo_light.9.png
new file mode 100644
index 0000000..f208c99
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_pressed_holo_dark.9.png b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_pressed_holo_dark.9.png
new file mode 100644
index 0000000..94eb994
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_pressed_holo_light.9.png b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_pressed_holo_light.9.png
new file mode 100644
index 0000000..1fee149
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-hdpi/btn_cab_done_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_default_holo_dark.9.png b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_default_holo_dark.9.png
new file mode 100644
index 0000000..abffc49
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_default_holo_light.9.png b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_default_holo_light.9.png
new file mode 100644
index 0000000..a369081
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_focused_holo_dark.9.png b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_focused_holo_dark.9.png
new file mode 100644
index 0000000..e33e964
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_focused_holo_light.9.png b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_focused_holo_light.9.png
new file mode 100644
index 0000000..0a845dd
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_pressed_holo_dark.9.png b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_pressed_holo_dark.9.png
new file mode 100644
index 0000000..74b0352
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_pressed_holo_light.9.png b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_pressed_holo_light.9.png
new file mode 100644
index 0000000..bfb4972
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-mdpi/btn_cab_done_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_default_holo_dark.9.png b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_default_holo_dark.9.png
new file mode 100644
index 0000000..d253dd4
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_default_holo_light.9.png b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_default_holo_light.9.png
new file mode 100644
index 0000000..65f9ec1
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_focused_holo_dark.9.png b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_focused_holo_dark.9.png
new file mode 100644
index 0000000..105da60
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_focused_holo_light.9.png b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_focused_holo_light.9.png
new file mode 100644
index 0000000..de53be7
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_pressed_holo_dark.9.png b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_pressed_holo_dark.9.png
new file mode 100644
index 0000000..3be0b0c
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_pressed_holo_light.9.png b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_pressed_holo_light.9.png
new file mode 100644
index 0000000..878c702
--- /dev/null
+++ b/core/res/res/drawable-ldrtl-xhdpi/btn_cab_done_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout/keyguard_emergency_carrier_area.xml b/core/res/res/layout/keyguard_emergency_carrier_area.xml
index 52adc04..b8a7654 100644
--- a/core/res/res/layout/keyguard_emergency_carrier_area.xml
+++ b/core/res/res/layout/keyguard_emergency_carrier_area.xml
@@ -18,7 +18,7 @@
 -->
 
 <!-- This contains emergency call button and carrier as shared by pin/pattern/password screens -->
-<LinearLayout
+<com.android.internal.policy.impl.keyguard.EmergencyCarrierArea
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
@@ -29,6 +29,7 @@
     android:clickable="true">
 
     <com.android.internal.policy.impl.keyguard.CarrierText
+        android:id="@+id/carrier_text"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:singleLine="true"
@@ -72,4 +73,4 @@
             android:visibility="gone"/>
     </LinearLayout>
 
-</LinearLayout>
+</com.android.internal.policy.impl.keyguard.EmergencyCarrierArea>
diff --git a/core/res/res/layout/media_controller.xml b/core/res/res/layout/media_controller.xml
index 7575836..24c2866 100644
--- a/core/res/res/layout/media_controller.xml
+++ b/core/res/res/layout/media_controller.xml
@@ -18,7 +18,8 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="#CC000000"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:layoutDirection="ltr">
 
     <LinearLayout
         android:layout_width="match_parent"
diff --git a/core/res/res/layout/simple_expandable_list_item_1.xml b/core/res/res/layout/simple_expandable_list_item_1.xml
index 9810a60..7cce12a 100644
--- a/core/res/res/layout/simple_expandable_list_item_1.xml
+++ b/core/res/res/layout/simple_expandable_list_item_1.xml
@@ -21,4 +21,5 @@
     android:paddingStart="?android:attr/expandableListPreferredItemPaddingLeft"
     android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
+    android:textAlignment="viewStart"
 />
diff --git a/core/res/res/layout/simple_expandable_list_item_2.xml b/core/res/res/layout/simple_expandable_list_item_2.xml
index ed845f8..da60d7a 100644
--- a/core/res/res/layout/simple_expandable_list_item_2.xml
+++ b/core/res/res/layout/simple_expandable_list_item_2.xml
@@ -28,6 +28,7 @@
         android:layout_height="wrap_content"
         android:layout_marginTop="6dip"
         android:textAppearance="?android:attr/textAppearanceListItem"
+        android:textAlignment="viewStart"
     />
 
     <TextView android:id="@android:id/text2"
@@ -36,6 +37,7 @@
         android:layout_below="@android:id/text1"
         android:layout_alignStart="@android:id/text1"
         android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textAlignment="viewStart"
     />
 
 </TwoLineListItem>
diff --git a/core/res/res/values-af/strings.xml b/core/res/res/values-af/strings.xml
index 8cfad68..57e1797 100644
--- a/core/res/res/values-af/strings.xml
+++ b/core/res/res/values-af/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direkte toegang tot die mikrofoon om oudio op te neem."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direkte toegang tot kamera vir die neem van foto of video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Jou programme-inligting"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Vermoë om die gedrag van ander programme op jou toestel te beïnvloed."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Muurpapier"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Teksaksies"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Bergingspasie word min"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Sommige stelselfunksies werk moontlik nie"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Kanselleer"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Aan:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Voer die vereiste PIN in:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Die foon sal tydelik van Wi-Fi ontkoppel terwyl dit aan <xliff:g id="DEVICE_NAME">%1$s</xliff:g> gekoppel is"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Die foon sal tydelik van Wi-Fi ontkoppel terwyl dit aan <xliff:g id="DEVICE_NAME">%1$s</xliff:g> gekoppel is"</string>
     <string name="select_character" msgid="3365550120617701745">"Voeg karakter in"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Stuur SMS-boodskappe"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; stuur \'n groot aantal SMS-boodskappe. Wil jy hierdie program toelaat om voort te gaan om boodskappe te stuur?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Jy het jou ontsluitpatroon <xliff:g id="NUMBER_0">%d</xliff:g> keer verkeerdelik geteken. Na nog <xliff:g id="NUMBER_1">%d</xliff:g> onsuksesvolle pogings, sal jy gevra word om jou foon te ontsluit deur middel van \'n e-posrekening."\n\n" Probeer weer oor <xliff:g id="NUMBER_2">%d</xliff:g> sekondes."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Verwyder"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Moet volume bo veilige vlak verhoog word?"\n"Deur vir lang tydperke op hoë volume te luister, kan jou gehoor beskadig."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Hou aan met twee vingers inhou om toeganklikheid te aktiveer."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Toeganklikheid geaktiveer."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Toeganklikheid gekanselleer."</string>
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index 2cef636..103f0b7 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"ድምጽ ለመቅረጽ ወደ ማይክሮፎኑ ቀጥተኛ መዳረሻ።"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"ካሜራ"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"ለካሜራ ምስል ወይም ቪዲዮ ለመቅረጽ ቀጥተኛ መዳረሻ።"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"የመተግበሪያዎችህ መረጃ"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"በመሣሪያህ ላይ ያሉ የሌሎች መተግበሪያዎች ባህሪዎች ላይ ተፅዕኖ የማሳረፍ ችሎታ።"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"ልጣፍ"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"የፅሁፍ እርምጃዎች"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"የማከማቻ ቦታ እያለቀ ነው"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"አንዳንድ የስርዓት ተግባራት ላይሰሩ ይችላሉ"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"እሺ"</string>
     <string name="cancel" msgid="6442560571259935130">"ይቅር"</string>
     <string name="yes" msgid="5362982303337969312">"እሺ"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"ለ፦"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"የሚፈለገውን ፒን ተይብ፦"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"ፒን፦"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"ስልኩ ከ<xliff:g id="DEVICE_NAME">%1$s</xliff:g> ጋር ተገናኝቶ ባለበት ጊዜ በጊዜያዊነት ከWi-Fi ጋር ያለው ግንኙነት ይቋረጣል"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"ስልኩ ከ<xliff:g id="DEVICE_NAME">%1$s</xliff:g> ጋር ተገናኝቶ ባለበት ጊዜ በጊዜያዊነት ከWi-Fi ጋር ያለው ግንኙነት ይቋረጣል"</string>
     <string name="select_character" msgid="3365550120617701745">"ቁምፊ አስገባ"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"የSMS መልዕክቶች መበላክ ላይ"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ቁጥራቸው ብዙ የሆኑ የኤስ.ኤም.ኤስ. መልዕክቶችን እየላከ ነው። ይሄ መተግበሪያ መልዕክቶችን መላኩን እንዲቀጥል መፍቀድ ትፈልጋለህ?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"የመክፈቻ ስርዓተ ጥለቱን <xliff:g id="NUMBER_0">%d</xliff:g> ጊዜ በትክክል አልሳሉትም። ከ<xliff:g id="NUMBER_1">%d</xliff:g> ተጨማሪ ያልተሳኩ ሙከራዎች በኋላ የኢሜይል መለያ ተጠቅመው ስልክዎን እንዲከፍቱ ይጠየቃሉ።"\n\n"እባክዎ ከ<xliff:g id="NUMBER_2">%d</xliff:g> ሰከንዶች በኋላ እንደገና ይሞክሩ።"</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"አስወግድ"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"ድምጽ አደጋ ከሌለው መጠን በላይ ይጨመር??"\n"ለረጅም ጊዜ በከፍተኛ ድምጽ መስማት የመስማት ችሎታዎን ሊጎዳይ ይችላል።"</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"ተደራሽነትን ለማንቃት ሁለት ጣቶችዎን ባሉበት ያቆዩዋቸው።"</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"ተደራሽነት ነቅቷል።"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"ተደራሽነት ተሰርዟል።"</string>
diff --git a/core/res/res/values-ar/strings.xml b/core/res/res/values-ar/strings.xml
index 9f6345f..b8fc281 100644
--- a/core/res/res/values-ar/strings.xml
+++ b/core/res/res/values-ar/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"الدخول المباشر إلى الميكروفون لتسجيل الصوت."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"الكاميرا"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"الدخول المباشر إلى الكاميرا لالتقاط صورة أو تصوير مقطع فيديو."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"معلومات التطبيقات"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"القدرة على التأثير في سلوك التطبيقات الأخرى بجهازك."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"الخلفية"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"إجراءات النص"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"مساحة التخزين منخفضة"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"قد لا تعمل بعض وظائف النظام"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"موافق"</string>
     <string name="cancel" msgid="6442560571259935130">"إلغاء"</string>
     <string name="yes" msgid="5362982303337969312">"موافق"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"إلى:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"اكتب رقم التعريف الشخصي المطلوب:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"رقم التعريف الشخصي:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"سيتم قطع اتصال الهاتف مؤقتًا بشبكة Wi-Fi في الوقت الذي يكون فيه متصلاً بـ <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"سيتم قطع اتصال الهاتف مؤقتًا بشبكة Wi-Fi في الوقت الذي يكون فيه متصلاً بـ <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"إدراج حرف"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"إرسال رسائل قصيرة SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; يرسل عددًا كبيرًا من الرسائل القصيرة SMS. هل تريد السماح لهذا التطبيق بالاستمرار في إرسال الرسائل؟"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"لقد رسمت نقش إلغاء التأمين بشكل غير صحيح <xliff:g id="NUMBER_0">%d</xliff:g> مرة. بعد إجراء <xliff:g id="NUMBER_1">%d</xliff:g> من المحاولات غير الناجحة الأخرى، ستُطالب بإلغاء تأمين الهاتف باستخدام حساب بريد إلكتروني لإلغاء تأمين الهاتف."\n\n" أعد المحاولة خلال <xliff:g id="NUMBER_2">%d</xliff:g> ثانية."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"إزالة"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"هل تريد رفع مستوى الصوت فوق المستوى الآمن؟"\n"قد يضر سماع صوت عالٍ لفترات طويلة بسمعك."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"اضغط بإصبعين لأسفل مع الاستمرار لتمكين تسهيل الدخول."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"تم تمكين إمكانية الدخول."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"تم إلغاء تسهيل الدخول."</string>
diff --git a/core/res/res/values-be/strings.xml b/core/res/res/values-be/strings.xml
index 2c6aff3..3746e91 100644
--- a/core/res/res/values-be/strings.xml
+++ b/core/res/res/values-be/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Прамы доступ да мікрафону для запісу гуку."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Камера"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Прамы доступ да камеры, каб зрабіць здымак ці зняць відэа."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Інфармацыя аб вашых прыкладаннях"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Магчымасць уплываць на паводзіны іншых прыкладанняў на вашай прыладзе."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Шпалеры"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Дзеянні з тэкстам"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Месца для захавання на зыходзе"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Некаторыя сістэмныя функцыі могуць не працаваць"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"ОК"</string>
     <string name="cancel" msgid="6442560571259935130">"Адмяніць"</string>
     <string name="yes" msgid="5362982303337969312">"ОК"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Каму:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Увядзіце патрэбны PIN-код:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN-код"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Тэлефон будзе часова адключаны ад Wi-Fi, пакуль ён падлучаны да прылады <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Тэлефон будзе часова адключаны ад Wi-Fi, пакуль ён падлучаны да прылады <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Уставіць сімвал"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Адпраўка SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Прыкладанне &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; дасылае вялікую колькасць SMS-паведамленняў. Дазволіць гэтаму прыкладанню працягваць адпраўляць паведамленні?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Вы няправільна ўвялі графічны ключ разблакiроўкi пэўную колькасць разоў: <xliff:g id="NUMBER_0">%d</xliff:g>. Пасля яшчэ некалькiх няўдалых спроб (<xliff:g id="NUMBER_1">%d</xliff:g>) вам будзе прапанавана разблакiраваць тэлефон, увайшоўшы ў Google."\n\n" Паўтарыце спробу праз <xliff:g id="NUMBER_2">%d</xliff:g> с."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Выдалiць"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Павялiчыць гук больш за рэкамендаваны ўзровень?"\n"Доўгае слуханне музыкi на вялiкай гучнасцi можа пашкодзiць ваш слых."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Утрымлiвайце два пальцы, каб уключыць доступ."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Даступнасць уключана."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Даступнасць адменена."</string>
diff --git a/core/res/res/values-bg/strings.xml b/core/res/res/values-bg/strings.xml
index f5f89a6..4831909 100644
--- a/core/res/res/values-bg/strings.xml
+++ b/core/res/res/values-bg/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Осъществяване на директен достъп до микрофона с цел записване на звук."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Камера"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Осъществяване на директен достъп до камерата с цел заснемане на снимки или видеоклипове."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Информация за приложенията ви"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Възможност за оказване на влияние върху поведението на други приложения на устройството ви."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Тапет"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Действия с текста"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Мястото в хранилището е на изчерпване"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Възможно е някои функции на системата да не работят"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Отказ"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"До:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Въведете задължителния ПИН:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"ПИН:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Телефонът временно ще прекрати връзката с Wi-Fi, докато е свързан с/ъс <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Телефонът временно ще прекрати връзката с Wi-Fi, докато е свързан с/ъс <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Вмъкване на знак"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Изпращане на SMS съобщения"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; изпраща голям брой SMS съобщения. Искате ли да разрешите на това приложение да продължи да го прави?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Начертахте неправилно фигурата си за отключване <xliff:g id="NUMBER_0">%d</xliff:g> пъти. След още <xliff:g id="NUMBER_1">%d</xliff:g> неуспешни опита ще бъдете помолени да отключите телефона посредством имейл адрес."\n\n" Опитайте отново след <xliff:g id="NUMBER_2">%d</xliff:g> секунди."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Премахване"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Да се увеличи ли силата на звука над безопасното ниво?"\n"Продължителното слушане при висока сила на звука може да увреди слуха ви."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Продължете да натискате с два пръста, за да активирате функцията за достъпност."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Достъпността е активирана."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Функцията за достъпност е анулирана."</string>
diff --git a/core/res/res/values-ca/strings.xml b/core/res/res/values-ca/strings.xml
index 6f0652f..59323c7 100644
--- a/core/res/res/values-ca/strings.xml
+++ b/core/res/res/values-ca/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Accés directe al micròfon per enregistrar àudio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Càmera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Accés directe a la càmera per a la captura d\'imatges o de vídeos."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informació de les aplicacions"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Capacitat d\'afectar el rendiment d\'altres aplicacions del dispositiu."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Fons de pantalla"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Accions de text"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"S\'està acabant l\'espai d\'emmagatzematge"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"És possible que algunes funcions del sistema no funcionin"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"D\'acord"</string>
     <string name="cancel" msgid="6442560571259935130">"Cancel·la"</string>
     <string name="yes" msgid="5362982303337969312">"D\'acord"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Per a:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Introdueix el PIN sol·licitat:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"El telèfon es desconnectarà temporalment de la Wi-Fi mentre estigui connectat a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"El telèfon es desconnectarà temporalment de la Wi-Fi mentre estigui connectat a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Insereix un caràcter"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"S\'estan enviant missatges SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; està enviant molts missatges SMS. Vols permetre que aquesta aplicació continuï enviant missatges?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Has dibuixat el patró de desbloqueig <xliff:g id="NUMBER_0">%d</xliff:g> vegades de manera incorrecta. Després de <xliff:g id="NUMBER_1">%d</xliff:g> intents incorrectes més, se\'t demanarà que desbloquegis el telèfon amb un compte de correu electrònic."\n\n" Torna-ho a provar d\'aquí a <xliff:g id="NUMBER_2">%d</xliff:g> segons."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Elimina"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Vols augmentar el volum per sobre del nivell de seguretat?"\n"Escoltar música a un volum alt durant períodes llargs pot perjudicar l\'oïda."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Mantén premuts els dos dits per activar l\'accessibilitat."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"S\'ha activat l\'accessibilitat."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Accessibilitat cancel·lada."</string>
diff --git a/core/res/res/values-cs/strings.xml b/core/res/res/values-cs/strings.xml
index 102815f..6e067b5 100644
--- a/core/res/res/values-cs/strings.xml
+++ b/core/res/res/values-cs/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Přímý přístup k mikrofonu a možnost nahrávání zvuku"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fotoaparát"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Přímý přístup k fotoaparátu a možnost pořizování fotografií a videí"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informace o vašich aplikacích"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Možnost ovlivnit chování dalších aplikací v zařízení"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Tapeta"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Operace s textem"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"V úložišti je málo místa"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Některé systémové funkce nemusí fungovat"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Zrušit"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Komu:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Zadejte požadovaný kód PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefon se při připojení k zařízení <xliff:g id="DEVICE_NAME">%1$s</xliff:g> dočasně odpojí od sítě Wi-Fi"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefon se při připojení k zařízení <xliff:g id="DEVICE_NAME">%1$s</xliff:g> dočasně odpojí od sítě Wi-Fi"</string>
     <string name="select_character" msgid="3365550120617701745">"Vkládání znaků"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Odesílání zpráv SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Aplikace &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;odesílá velký počet SMS zpráv. Chcete aplikaci povolit, aby zprávy odesílala i nadále?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Již <xliff:g id="NUMBER_0">%d</xliff:g>krát jste nesprávně nakreslili své heslo odemknutí. Po <xliff:g id="NUMBER_1">%d</xliff:g> dalších neúspěšných pokusech budete požádáni o odemčení telefonu pomocí e-mailového účtu."\n\n" Zkuste to znovu za <xliff:g id="NUMBER_2">%d</xliff:g> s."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Odebrat"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Chcete hlasitost zvýšit nad bezpečnou úroveň?"\n"Dlouhodobý poslech hlasitého zvuku může poškodit sluch."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Usnadnění zapnete dlouhým stisknutím dvěma prsty."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Usnadnění přístupu je aktivováno."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Usnadnění zrušeno."</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index b86ae9f..ea9c3ad 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direkte adgang til mikrofonen, så der kan optages lyd."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direkte adgang til kamera, så der kan tages billeder eller optages video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Oplysninger om dine applikationer"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Evne til at påvirke andre applikationers adfærd på din enhed."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Baggrund"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Teksthandlinger"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Der er snart ikke mere lagerplads"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Nogle systemfunktioner virker måske ikke"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Annuller"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Til:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Skriv den påkrævede pinkode:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Pinkode:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefonens Wi-Fi-forbindelse vil midlertidigt blive afbrudt, når den er tilsluttet <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefonens Wi-Fi-forbindelse vil midlertidigt blive afbrudt, når den er tilsluttet <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Indsæt tegn"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Sender sms-beskeder"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sender et stort antal sms-beskeder. Vil du tillade, at denne app fortsat sender beskeder?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Du har tegnet dit oplåsningsmønster forkert <xliff:g id="NUMBER_0">%d</xliff:g> gange. Efter <xliff:g id="NUMBER_1">%d</xliff:g> yderligere mislykkede forsøg til vil du blive bedt om at låse din telefon op ved hjælp af en e-mailkonto."\n\n" Prøv igen om <xliff:g id="NUMBER_2">%d</xliff:g> sekunder."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Fjern"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Skal lydstyrken være over det sikre niveau?"\n"Du kan skade din hørelse ved at lytte ved høj lydstyrke i længere tid."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Hold fortsat to fingre nede for at aktivere tilgængelighed."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Tilgængelighed aktiveret."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Tilgængelighed er annulleret."</string>
diff --git a/core/res/res/values-de/strings.xml b/core/res/res/values-de/strings.xml
index 2fc7f4a..f3f897a 100644
--- a/core/res/res/values-de/strings.xml
+++ b/core/res/res/values-de/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direkter Zugriff auf das Mikrofon zur Audioaufnahme"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direkter Zugriff auf Kamera für Bild- oder Videoaufnahmen"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informationen zu Ihren Apps"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Einflussnahme auf das Verhalten anderer Apps auf Ihrem Gerät"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Hintergrund"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Textaktionen"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Der Speicherplatz wird knapp"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Einige Systemfunktionen funktionieren möglicherweise nicht."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Abbrechen"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"An:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Geben Sie die erforderliche PIN ein:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Das Telefon wird vorübergehend vom WLAN getrennt, während eine Verbindung mit <xliff:g id="DEVICE_NAME">%1$s</xliff:g> hergestellt wird."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Das Telefon wird vorübergehend vom WLAN getrennt, während eine Verbindung mit <xliff:g id="DEVICE_NAME">%1$s</xliff:g> hergestellt wird."</string>
     <string name="select_character" msgid="3365550120617701745">"Zeichen einfügen"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS werden gesendet"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sendet eine große Anzahl SMS. Möchten Sie zulassen, dass die App weiterhin Nachrichten sendet?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Sie haben Ihr Entsperrungsmuster <xliff:g id="NUMBER_0">%d</xliff:g>-mal falsch gezeichnet. Nach <xliff:g id="NUMBER_1">%d</xliff:g> weiteren erfolglosen Versuchen werden Sie aufgefordert, Ihr Telefon mithilfe eines E-Mail-Kontos zu entsperren."\n\n" Versuchen Sie es in <xliff:g id="NUMBER_2">%d</xliff:g> Sekunden erneut."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Entfernen"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Lautstärke höher als Schwellenwert stellen?"\n"Wenn Sie über längere Zeiträume hinweg Musik in hoher Lautstärke hören, kann dies Ihr Gehör schädigen."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Drücken Sie mit zwei Fingern, um die Bedienungshilfen zu aktivieren."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Bedienungshilfen aktiviert"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Bedienungshilfen abgebrochen"</string>
diff --git a/core/res/res/values-el/strings.xml b/core/res/res/values-el/strings.xml
index 478b064..00fbd8f 100644
--- a/core/res/res/values-el/strings.xml
+++ b/core/res/res/values-el/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Άμεση πρόσβαση στο μικρόφωνο για την εγγραφή ήχου."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Κάμερα"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Άμεση πρόσβαση σε κάμερα για λήψη εικόνας ή βίντεο."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Οι πληροφορίες των εφαρμογών σας"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Δυνατότητα επιρροής συμπεριφοράς άλλων εφαρμογών στη συσκευή σας."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Ταπετσαρία"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Ενέργειες κειμένου"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Ο χώρος αποθήκευσης εξαντλείται"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Ορισμένες λειτουργίες συστήματος ενδέχεται να μην λειτουργούν"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Ακύρωση"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Προς:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Πληκτρολογήστε τον απαιτούμενο κωδικό PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Το τηλέφωνο θα αποσυνδεθεί προσωρινά από το δίκτυο Wi-Fi ενώ συνδέεται στη συσκευή <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Το τηλέφωνο θα αποσυνδεθεί προσωρινά από το δίκτυο Wi-Fi ενώ συνδέεται στη συσκευή <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Εισαγωγή χαρακτήρα"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Αποστολή μηνυμάτων SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Η εφαρμογή &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; στέλνει έναν μεγάλο αριθμό μηνυμάτων SMS. Θέλετε να επιτρέψετε σε αυτήν την εφαρμογή να συνεχίσει να στέλνει μηνύματα;"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Σχεδιάσατε το μοτίβο ξεκλειδώματος εσφαλμένα <xliff:g id="NUMBER_0">%d</xliff:g> φορές. Μετά από <xliff:g id="NUMBER_1">%d</xliff:g> ανεπιτυχείς προσπάθειες ακόμη, θα σας ζητηθεί να ξεκλειδώσετε το τηλέφωνό σας με τη χρήση ενός λογαριασμού ηλεκτρονικού ταχυδρομείου."\n\n" Δοκιμάστε ξανά σε <xliff:g id="NUMBER_2">%d</xliff:g> δευτερόλεπτα."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Κατάργηση"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Αύξηση έντασης ήχου πάνω από το επίπεδο ασφαλείας;"\n"Αν ακούτε μουσική σε υψηλή ένταση για μεγάλο χρονικό διάστημα ενδέχεται να προκληθεί βλάβη στην ακοή σας."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Αγγίξτε παρατεταμένα με δύο δάχτυλα για να ενεργοποιήσετε τη λειτουργία προσβασιμότητας."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Ενεργοποιήθηκε η προσβασιμότητα."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Η λειτουργία προσβασιμότητας ακυρώθηκε."</string>
diff --git a/core/res/res/values-en-rGB/strings.xml b/core/res/res/values-en-rGB/strings.xml
index 8794a5d..0314fc9 100644
--- a/core/res/res/values-en-rGB/strings.xml
+++ b/core/res/res/values-en-rGB/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direct access to the microphone to record audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Camera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direct access to camera for image or video capture."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Your applications information"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Ability to affect behaviour of other applications on your device."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Wallpaper"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Text actions"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Storage space running out"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Some system functions may not work"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Cancel"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"To:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Type the required PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"The phone will temporarily disconnect from Wi-FI while it\'s connected to <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"The phone will temporarily disconnect from Wi-FI while it\'s connected to <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Insert character"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Sending SMS messages"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; is sending a large number of SMS messages. Do you want to allow this app to continue sending messages?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"You have incorrectly drawn your unlock pattern <xliff:g id="NUMBER_0">%d</xliff:g> times. After <xliff:g id="NUMBER_1">%d</xliff:g> more unsuccessful attempts, you will be asked to unlock your phone using an email account."\n\n" Try again in <xliff:g id="NUMBER_2">%d</xliff:g> seconds."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Remove"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Raise volume above safe level?"\n"Listening at high volume for long periods may damage your hearing."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Keep holding down two fingers to enable accessibility."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Accessibility enabled."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Accessibility cancelled."</string>
diff --git a/core/res/res/values-es-rUS/strings.xml b/core/res/res/values-es-rUS/strings.xml
index eeb6878..c26998a 100644
--- a/core/res/res/values-es-rUS/strings.xml
+++ b/core/res/res/values-es-rUS/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Acceso directo a micrófono para grabar audio"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Cámara"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Acceso directo a cámara para imagen o captura de video"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Información de tus aplicaciones"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Capacidad para influir en el comportamiento de otras aplicaciones en el dispositivo"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Fondo de pantalla"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Acciones de texto"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Queda poco espacio de almacenamiento"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Es posible que algunas funciones del sistema no estén disponibles."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Aceptar"</string>
     <string name="cancel" msgid="6442560571259935130">"Cancelar"</string>
     <string name="yes" msgid="5362982303337969312">"Aceptar"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Para:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Escribe el PIN solicitado:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"El dispositivo se desconectará temporalmente de la red Wi-Fi mientras esté conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"El dispositivo se desconectará temporalmente de la red Wi-Fi mientras esté conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
     <string name="select_character" msgid="3365550120617701745">"Insertar caracteres"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Enviando mensajes SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; está enviando una gran cantidad de mensajes SMS. ¿Quieres permitir que está aplicación siga enviando mensajes?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Dibujaste incorrectamente tu patrón de desbloqueo <xliff:g id="NUMBER_0">%d</xliff:g> veces. Luego de <xliff:g id="NUMBER_1">%d</xliff:g> intentos incorrectos más, se te solicitará que desbloquees tu dispositivo mediante el uso de una cuenta de correo."\n\n" Vuelve a intentarlo en <xliff:g id="NUMBER_2">%d</xliff:g> segundos."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Eliminar"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"¿Aumentar el volumen por encima del nivel seguro?"\n"Si escuchas con el volumen alto durante períodos prolongados, puedes dañar tu audición."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Mantén presionado con dos dedos para activar la accesibilidad."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Se activó la accesibilidad."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Se canceló la accesibilidad."</string>
diff --git a/core/res/res/values-es/strings.xml b/core/res/res/values-es/strings.xml
index 0974ebe..b709983 100644
--- a/core/res/res/values-es/strings.xml
+++ b/core/res/res/values-es/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Acceder directamente al micrófono para grabar audio"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Cámara"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Acceder directamente a la cámara para hacer fotos o grabar vídeos"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Información de tus aplicaciones"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Posibilidad de influir en el funcionamiento de otras aplicaciones del dispositivo"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Fondo de pantalla"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Acciones de texto"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Queda poco espacio"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Es posible que algunas funciones del sistema no funcionen."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Aceptar"</string>
     <string name="cancel" msgid="6442560571259935130">"Cancelar"</string>
     <string name="yes" msgid="5362982303337969312">"Aceptar"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Para:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Escribe el PIN solicitado:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"El teléfono se desconectará temporalmente de la red Wi-Fi mientras está conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"El teléfono se desconectará temporalmente de la red Wi-Fi mientras está conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
     <string name="select_character" msgid="3365550120617701745">"Insertar carácter"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Enviando mensajes SMS..."</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; está enviando un gran número de mensajes SMS. ¿Quieres permitir que está aplicación siga enviando mensajes?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Has fallado <xliff:g id="NUMBER_0">%d</xliff:g> veces al dibujar el patrón de desbloqueo. Si fallas otras <xliff:g id="NUMBER_1">%d</xliff:g> veces, deberás usar una cuenta de correo electrónico para desbloquear el teléfono."\n\n" Inténtalo de nuevo en <xliff:g id="NUMBER_2">%d</xliff:g> segundos."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Eliminar"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"¿Subir el volumen por encima del nivel de seguridad?"\n"Escuchar sonidos a alto volumen durante largos períodos de tiempo puede dañar tus oídos."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Mantén la pantalla pulsada con dos dedos para habilitar las funciones de accesibilidad."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Accesibilidad habilitada"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Accesibilidad cancelada"</string>
diff --git a/core/res/res/values-et/strings.xml b/core/res/res/values-et/strings.xml
index 2815c43..3abaf62e 100644
--- a/core/res/res/values-et/strings.xml
+++ b/core/res/res/values-et/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Otsene juurdepääs mikrofonile heli salvestamiseks."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kaamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Otsene juurdepääs kaamerale fotode või videote jäädvustamiseks."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Teie rakenduste teave"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Võime mõjutada teiste seadmes olevate rakenduste käitumist."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Taustapilt"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Tekstitoimingud"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Talletusruum saab täis"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Mõned süsteemifunktsioonid ei pruugi töötada"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Tühista"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Saaja:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Sisestage nõutav PIN-kood:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN-kood:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefoni ühendus WiFi-ga katkestatakse ajutiselt, kui see on ühendatud seadmega <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefoni ühendus WiFi-ga katkestatakse ajutiselt, kui see on ühendatud seadmega <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Sisesta tähemärk"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS-sõnumite saatmine"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; saadab suurel hulgal SMS-sõnumeid. Kas tahate lubada sellel rakendusel ka edaspidi sõnumeid saata?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Joonistasite oma avamismustri <xliff:g id="NUMBER_0">%d</xliff:g> korda valesti. Pärast veel <xliff:g id="NUMBER_1">%d</xliff:g> ebaõnnestunud katset palutakse teil telefon avada meilikontoga."\n\n" Proovige uuesti <xliff:g id="NUMBER_2">%d</xliff:g> sekundi pärast."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Eemalda"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Kas suurendada helitugevust üle ohutu piiri?"\n"Pikaajaline suure helitugevusega muusika kuulamine võib kahjustada kuulmist."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Hõlbustuse lubamiseks hoidke kaht sõrme all."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Hõlbustus on lubatud."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Hõlbustus on tühistatud."</string>
diff --git a/core/res/res/values-fa/strings.xml b/core/res/res/values-fa/strings.xml
index 660029a..f8c1629 100644
--- a/core/res/res/values-fa/strings.xml
+++ b/core/res/res/values-fa/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"مستقیم به میکروفن برای ضبط صدا دسترسی داشته باشید."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"دوربین"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"مستقیم به دوربین برای عکس گرفتن یا ضبط فیلم دسترسی داشته باشید."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"اطلاعات برنامه‌های شما"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"می‌تواند بر عملکرد برنامه‌های دیگر روی دستگاه اثر بگذارد."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"تصویر زمینه"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"عملکردهای متنی"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"فضای ذخیره‌سازی رو به اتمام است"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"برخی از عملکردهای سیستم ممکن است کار نکنند"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"تأیید"</string>
     <string name="cancel" msgid="6442560571259935130">"لغو"</string>
     <string name="yes" msgid="5362982303337969312">"تأیید"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"به:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"پین لازم را تایپ کنید:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"پین:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"این گوشی به‌طور موقت از Wi-Fi قطع خواهد شد، در حالی که به <xliff:g id="DEVICE_NAME">%1$s</xliff:g> وصل است"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"این گوشی به‌طور موقت از Wi-Fi قطع خواهد شد، در حالی که به <xliff:g id="DEVICE_NAME">%1$s</xliff:g> وصل است"</string>
     <string name="select_character" msgid="3365550120617701745">"درج نویسه"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"ارسال پیامک ها"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; در حال ارسال تعداد زیادی پیامک است. آیا اجازه می‌دهید این برنامه همچنان پیامک ارسال کند؟"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"شما الگوی بازگشایی قفل خود را <xliff:g id="NUMBER_0">%d</xliff:g> بار اشتباه کشیده‌اید. پس از <xliff:g id="NUMBER_1">%d</xliff:g> تلاش ناموفق، از شما خواسته می‎شود که با استفاده از یک حساب ایمیل قفل تلفن خود را باز کنید."\n\n" لطفاً پس از <xliff:g id="NUMBER_2">%d</xliff:g> ثانیه دوباره امتحان کنید."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"حذف"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"صدا به بالاتر از سطح ایمن افزایش یابد؟"\n"گوش دادن به صدای بلند برای زمان‌های طولانی می‌تواند به شنوایی شما آسیب برساند."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"برای فعال کردن قابلیت دسترسی، با دو انگشت خود همچنان به طرف پایین فشار دهید."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"قابلیت دسترسی فعال شد."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"قابلیت دسترسی لغو شد."</string>
diff --git a/core/res/res/values-fi/strings.xml b/core/res/res/values-fi/strings.xml
index 78e1412..da5c2db 100644
--- a/core/res/res/values-fi/strings.xml
+++ b/core/res/res/values-fi/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Äänen tallentamiseen käytettävän mikrofonin käyttöoikeus."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Kuvien tai videon tallentamiseen käytettävän kameran käyttöoikeus."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Sovelluksiesi tiedot"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Mahdollisuus vaikuttaa muiden laitteen sovelluksien käytökseen."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Taustakuva"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Tekstitoiminnot"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Tallennustila loppumassa"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Kaikki järjestelmätoiminnot eivät välttämättä toimi"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Peruuta"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Kohde:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Kirjoita pyydetty PIN-koodi:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN-koodi:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Puhelimen yhteys wifi-verkkoon katkaistaan väliaikaisesti puhelimen ollessa yhdistettynä laitteeseen <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Puhelimen yhteys wifi-verkkoon katkaistaan väliaikaisesti puhelimen ollessa yhdistettynä laitteeseen <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Lisää merkki"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Tekstiviestien lähettäminen"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; lähettää suuria määriä tekstiviestejä. Annetaanko tämän sovelluksen jatkaa tekstiviestien lähettämistä?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Piirsit lukituksenpoistokuvion väärin <xliff:g id="NUMBER_0">%d</xliff:g> kertaa. Jos piirrät kuvion väärin vielä <xliff:g id="NUMBER_1">%d</xliff:g> kertaa, sinua pyydetään poistamaan puhelimesi lukitus sähköpostitilin avulla."\n\n" Yritä uudelleen <xliff:g id="NUMBER_2">%d</xliff:g> sekunnin kuluttua."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Poista"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Nostetaanko äänenvoimakkuus turvallista tasoa voimakkaammaksi?"\n"Jos kuuntelet suurella äänenvoimakkuudella pitkiä aikoja, kuulosi voi vahingoittua."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Ota esteettömyystila käyttöön koskettamalla pitkään kahdella sormella."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Esteettömyystila käytössä."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Esteettömyystila peruutettu."</string>
diff --git a/core/res/res/values-fr/strings.xml b/core/res/res/values-fr/strings.xml
index 4c9c0a5..c9a0eb5 100644
--- a/core/res/res/values-fr/strings.xml
+++ b/core/res/res/values-fr/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Accès direct au microphone pour enregistrer du contenu audio"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Appareil photo"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Accès direct à la caméra pour la capture d\'images ou de vidéos"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informations relatives à vos applications"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Possibilité de modifier le comportement des autres applications sur votre appareil"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Fond d\'écran"</string>
@@ -902,7 +906,7 @@
     <string name="permdesc_accessContentProvidersExternally" msgid="4544346486697853685">"Permettre à l\'application titulaire d\'accéder à des fournisseurs de contenu depuis la commande shell. Les applications standards ne devraient jamais avoir recours à cette autorisation."</string>
     <string name="permlab_updateLock" msgid="3527558366616680889">"déconseiller mises à jour auto appareil"</string>
     <string name="permdesc_updateLock" msgid="1655625832166778492">"Permet à l\'application autorisée d\'indiquer au système le moment opportun pour un redémarrage non interactif en vue de la mise à jour de l\'appareil."</string>
-    <string name="save_password_message" msgid="767344687139195790">"Voulez-vous que le navigateur se souvienne de ce mot de passe ?"</string>
+    <string name="save_password_message" msgid="767344687139195790">"Voulez-vous que le navigateur se souvienne de ce mot de passe ?"</string>
     <string name="save_password_notnow" msgid="6389675316706699758">"Pas maintenant"</string>
     <string name="save_password_remember" msgid="6491879678996749466">"Mémoriser"</string>
     <string name="save_password_never" msgid="8274330296785855105">"Jamais"</string>
@@ -918,7 +922,7 @@
     <string name="searchview_description_query" msgid="5911778593125355124">"Requête de recherche"</string>
     <string name="searchview_description_clear" msgid="1330281990951833033">"Effacer la requête"</string>
     <string name="searchview_description_submit" msgid="2688450133297983542">"Envoyer la requête"</string>
-    <string name="searchview_description_voice" msgid="2453203695674994440">"Recherche vocale"</string>
+    <string name="searchview_description_voice" msgid="2453203695674994440">"Recherche vocale"</string>
     <string name="enable_explore_by_touch_warning_title" msgid="7460694070309730149">"Activer \"Explorer au toucher\" ?"</string>
     <string name="enable_explore_by_touch_warning_message" product="tablet" msgid="8655887539089910577">"<xliff:g id="ACCESSIBILITY_SERVICE_NAME">%1$s</xliff:g> souhaite activer la fonctionnalité \"Explorer au toucher\". Lorsque celle-ci est activée, vous pouvez entendre ou voir les descriptions des éléments que vous sélectionnez, ou bien interagir avec la tablette en effectuant certains gestes."</string>
     <string name="enable_explore_by_touch_warning_message" product="default" msgid="2708199672852373195">"<xliff:g id="ACCESSIBILITY_SERVICE_NAME">%1$s</xliff:g> souhaite activer la fonctionnalité \"Explorer au toucher\". Lorsque celle-ci est activée, vous pouvez entendre ou voir les descriptions des éléments que vous sélectionnez, ou bien interagir avec le téléphone en effectuant certains gestes."</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Actions sur le texte"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Espace de stockage bientôt saturé"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Il est possible que certaines fonctionnalités du système ne soient pas opérationnelles."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Annuler"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"À :"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Saisissez le code PIN requis :"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Code PIN :"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Le téléphone sera déconnecté du réseau Wi-Fi tant qu\'il sera connecté à l\'appareil <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Le téléphone sera déconnecté du réseau Wi-Fi tant qu\'il sera connecté à l\'appareil <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
     <string name="select_character" msgid="3365550120617701745">"Insérer un caractère"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Envoi de messages SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; envoie un grand nombre de SMS. Autorisez-vous cette application à poursuivre l\'envoi des messages ?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Vous avez dessiné un schéma de déverrouillage incorrect à <xliff:g id="NUMBER_0">%d</xliff:g> reprises. Si vous échouez encore <xliff:g id="NUMBER_1">%d</xliff:g> fois, vous devrez déverrouiller votre téléphone à l\'aide d\'un compte de messagerie électronique."\n\n" Veuillez réessayer dans <xliff:g id="NUMBER_2">%d</xliff:g> secondes."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Supprimer"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Augmenter le volume au-dessus du niveau de sécurité ?"\n"L\'écoute à un volume élevé pendant des périodes prolongées peut endommager votre audition."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Pour activer l\'accessibilité, appuyez de manière prolongée avec deux doigts."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"L\'accessibilité a bien été activée."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Accessibilité annulée."</string>
diff --git a/core/res/res/values-hi/strings.xml b/core/res/res/values-hi/strings.xml
index 3aaace5..cbec3fe 100644
--- a/core/res/res/values-hi/strings.xml
+++ b/core/res/res/values-hi/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"ऑडियो रिकॉर्ड करने के लिए माइक्रोफ़ोन पर सीधी पहुंच."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"कैमरा"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"चित्र या वीडियो कैप्‍चर के लिए कैमरे पर सीधी पहुंच."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"आपके एप्‍लिकेशन की जानकारी"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"अपने उपकरण पर अन्‍य एप्‍लिकेशन के व्‍यवहार को प्रभावित करने की क्षमता."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"वॉलपेपर"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"पाठ क्रियाएं"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"संग्रहण स्‍थान समाप्‍त हो रहा है"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"हो सकता है कुछ सिस्टम फ़ंक्शन कार्य न करें"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"ठीक"</string>
     <string name="cancel" msgid="6442560571259935130">"रद्द करें"</string>
     <string name="yes" msgid="5362982303337969312">"ठीक"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"प्रति:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"आवश्‍यक पिन लिखें:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"पिन:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"फ़ोन <xliff:g id="DEVICE_NAME">%1$s</xliff:g> से कनेक्ट रहते समय Wi-Fi से अस्थायी रूप से डिस्कनेक्ट हो जाएगा"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"फ़ोन <xliff:g id="DEVICE_NAME">%1$s</xliff:g> से कनेक्ट रहते समय Wi-Fi से अस्थायी रूप से डिस्कनेक्ट हो जाएगा"</string>
     <string name="select_character" msgid="3365550120617701745">"वर्ण सम्‍मिलित करें"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS संदेश भेज रहा है"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; बड़ी संख्या में SMS संदेश भेज रहा है. क्या आप इस एप्लिकेशन को संदेश भेजना जारी रखने देना चाहते हैं?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"आपने अपने अनलॉक प्रतिमान को <xliff:g id="NUMBER_0">%d</xliff:g> बार गलत तरीके से आरेखित किया है. <xliff:g id="NUMBER_1">%d</xliff:g> और असफल प्रयासों के बाद, आपसे अपने फ़ोन को किसी ईमेल खाते का उपयोग करके अनलॉक करने के लिए कहा जाएगा."\n\n" <xliff:g id="NUMBER_2">%d</xliff:g> सेकंड में पुन: प्रयास करें."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"निकालें"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"वॉल्यूम को सुरक्षित स्तर से अधिक करें?"\n"अधिक देर तक उच्च वॉल्यूम पर सुनने से आपकी सुनने की क्षमता को नुकसान हो सकता है."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"पहुंच-योग्यता को सक्षम करने के लिए दो अंगुलियों से नीचे दबाए रखें."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"पहुंच-योग्यता सक्षम कर दी है."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"पहुंच-योग्यता रद्द की गई."</string>
diff --git a/core/res/res/values-hr/strings.xml b/core/res/res/values-hr/strings.xml
index dbf80ce..6eb3863 100644
--- a/core/res/res/values-hr/strings.xml
+++ b/core/res/res/values-hr/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Izravan pristup mikrofonu za snimanje zvuka."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fotoaparat"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Izravan pristup fotoaparatu za slikanje ili snimanje videozapisa."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informacije o vašoj aplikaciji"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Sposobnost da utječu na postupanje drugih aplikacija na vašem uređaju."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Pozadinska slika"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Radnje s tekstom"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Ponestaje prostora za pohranu"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Neke sistemske funkcije možda neće raditi"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"U redu"</string>
     <string name="cancel" msgid="6442560571259935130">"Odustani"</string>
     <string name="yes" msgid="5362982303337969312">"U redu"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Prima:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Upišite potreban PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefon će se privremeno isključiti s Wi-Fija dok je povezan s uređajem <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefon će se privremeno isključiti s Wi-Fija dok je povezan s uređajem <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Umetni znak"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Slanje SMS poruka"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Aplikacija &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; šalje veliki broj SMS poruka. Želite li dopustiti ovoj aplikaciji da nastavi slati poruke?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Netočno ste iscrtali obrazac za otključavanje <xliff:g id="NUMBER_0">%d</xliff:g> puta. Nakon još ovoliko neuspješnih pokušaja: <xliff:g id="NUMBER_1">%d</xliff:g> morat ćete otključati telefon pomoću računa e-pošte."\n\n" Pokušajte ponovo za <xliff:g id="NUMBER_2">%d</xliff:g> s."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Ukloni"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Pojačati iznad sigurne razine?"\n"Dulje slušanje preglasne glazbe može vam oštetiti sluh."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Nastavite držati s dva prsta kako biste omogućili pristupačnost."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Dostupnost je omogućena."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Pristupačnost otkazana."</string>
diff --git a/core/res/res/values-hu/strings.xml b/core/res/res/values-hu/strings.xml
index 3cb1df7..b621899 100644
--- a/core/res/res/values-hu/strings.xml
+++ b/core/res/res/values-hu/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Közvetlen hozzáférés a mikrofonhoz hangrögzítés céljából"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fényképezőgép"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Közvetlen hozzáférés a fényképezőgéphez kép vagy videó rögzítése céljából"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Az Ön alkalmazásainak információi"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Képes az eszközön a többi alkalmazás viselkedését befolyásolni."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Háttérkép"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Műveletek szöveggel"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Kevés a szabad terület"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Előfordulhat, hogy néhány rendszerfunkció nem működik."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Mégse"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Címzett:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Adja meg a szükséges PIN kódot:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN kód:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"A telefon ideiglenesen kilép a Wi-Fi hálózatról, míg a(z) <xliff:g id="DEVICE_NAME">%1$s</xliff:g> eszközhöz csatlakozik."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"A telefon ideiglenesen kilép a Wi-Fi hálózatról, míg a(z) <xliff:g id="DEVICE_NAME">%1$s</xliff:g> eszközhöz csatlakozik."</string>
     <string name="select_character" msgid="3365550120617701745">"Karakter beszúrása"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS-ek küldése"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/ b&gt; nagyszámú SMS üzenetet küld. Engedélyezi, hogy ez az alkalmazás továbbra is üzeneteket küldjön?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"<xliff:g id="NUMBER_0">%d</xliff:g> alkalommal helytelenül rajzolta le a feloldási mintát. További <xliff:g id="NUMBER_1">%d</xliff:g> sikertelen kísérlet után egy e-mail fiók használatával kell feloldania a telefonját."\n\n" Kérjük, próbálja újra <xliff:g id="NUMBER_2">%d</xliff:g> másodperc múlva."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Eltávolítás"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"A biztonságos szint fölé emeli a hangerőt?"\n"Ha hosszú ideig hangosan hallgatja a zenét, az károsíthatja a hallását."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Továbbra is tartsa lenyomva két ujját a hozzáférés engedélyezéséhez."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Hozzáférés engedélyezve"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Hozzáférés megszakítva."</string>
diff --git a/core/res/res/values-in/strings.xml b/core/res/res/values-in/strings.xml
index 33e3b2d2..2d8d75d 100644
--- a/core/res/res/values-in/strings.xml
+++ b/core/res/res/values-in/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Akses langsung ke mikrofon untuk merekam audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Akses langsung ke kamera untuk gambar atau tangkapan video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informasi aplikasi Anda"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Kemampuan untuk memengaruhi perilaku aplikasi lain pada perangkat Anda."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Wallpaper"</string>
@@ -351,7 +355,7 @@
     <string name="permlab_canRequestEnahncedWebAccessibility" msgid="1905232971331801453">"meminta aksesibilitas web yang disempurnakan"</string>
     <string name="permdesc_canRequestEnahncedWebAccessibility" msgid="4500520989321729676">"Memungkinkan pemegang meminta pengaktifan penyempurnaan aksesibilitas web. Contohnya, memasang skrip agar konten aplikasi lebih mudah diakses."</string>
     <string name="permlab_bindTextService" msgid="7358378401915287938">"mengikat ke layanan SMS"</string>
-    <string name="permdesc_bindTextService" msgid="8151968910973998670">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan teks (mis. SpellCheckerService). Tidak pernah diperlukan oleh apl normal."</string>
+    <string name="permdesc_bindTextService" msgid="8151968910973998670">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan teks (misal: SpellCheckerService). Tidak pernah diperlukan oleh apl normal."</string>
     <string name="permlab_bindVpnService" msgid="4708596021161473255">"mengikat ke layanan VPN"</string>
     <string name="permdesc_bindVpnService" msgid="2067845564581693905">"Mengizinkan pemegang mengikat antarmuka tingkat tinggi dari suatu layanan Vpn. Tidak pernah diperlukan oleh apl normal."</string>
     <string name="permlab_bindWallpaper" msgid="8716400279937856462">"mengikat ke wallpaper"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Tindakan teks"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Ruang penyimpanan hampir habis"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Beberapa fungsi sistem mungkin tidak dapat bekerja"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Oke"</string>
     <string name="cancel" msgid="6442560571259935130">"Batal"</string>
     <string name="yes" msgid="5362982303337969312">"Oke"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Kepada:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Ketik PIN yang diminta:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Ponsel akan terputus sementara dari Wi-Fi saat tersambung ke <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Ponsel akan terputus sementara dari Wi-Fi saat tersambung ke <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Sisipkan huruf"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Mengirim pesan SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sedang mengirim pesan SMS dalam jumlah besar. Izinkan aplikasi ini untuk melanjutkan pengiriman pesan?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Anda telah <xliff:g id="NUMBER_0">%d</xliff:g> kali salah menggambar pola pembuka kunci. Setelah <xliff:g id="NUMBER_1">%d</xliff:g> lagi upaya gagal, Anda akan diminta membuka kunci ponsel menggunakan akun email."\n\n"Coba lagi dalam <xliff:g id="NUMBER_2">%d</xliff:g> detik."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Hapus"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Naikkan volume di atas tingkat aman?"\n"Mendengarkan volume tinggi dalam jangka waktu yang lama dapat merusak pendengaran Anda."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Tahan terus dua jari untuk mengaktifkan aksesibilitas."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Aksesibilitas diaktifkan."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Aksesibilitas dibatalkan."</string>
diff --git a/core/res/res/values-it/strings.xml b/core/res/res/values-it/strings.xml
index 314d1ae..4486e69 100644
--- a/core/res/res/values-it/strings.xml
+++ b/core/res/res/values-it/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Accesso diretto al microfono per registrare audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fotocamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Accesso diretto alla fotocamera per acquisizione di immagini o video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informazioni sulle tue applicazioni"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Possibilità di influenzare il comportamento di altre applicazioni sul dispositivo."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Sfondo"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Azioni testo"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Spazio di archiviazione in esaurimento"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Alcune funzioni di sistema potrebbero non funzionare"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Annulla"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"A:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Inserisci il PIN richiesto:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Il telefono verrà momentaneamente scollegato dalla rete Wi-Fi durante il collegamento a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Il telefono verrà momentaneamente scollegato dalla rete Wi-Fi durante il collegamento a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
     <string name="select_character" msgid="3365550120617701745">"Inserisci carattere"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Invio SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sta inviando molti SMS. Vuoi consentire all\'applicazione di continuare a inviare messaggi?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"<xliff:g id="NUMBER_0">%d</xliff:g> tentativi errati di inserimento della sequenza di sblocco. Dopo altri <xliff:g id="NUMBER_1">%d</xliff:g> tentativi falliti, ti verrà chiesto di sbloccare il telefono con un account email."\n\n" Riprova tra <xliff:g id="NUMBER_2">%d</xliff:g> secondi."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Rimuovi"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Aumentare il volume oltre il livello di sicurezza?"\n"Ascoltare musica ad alto volume per lunghi periodi potrebbe danneggiare l\'udito."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Continua a tenere premuto con due dita per attivare l\'accessibilità."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Accessibilità attivata."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Accessibilità annullata."</string>
diff --git a/core/res/res/values-iw/strings.xml b/core/res/res/values-iw/strings.xml
index 6a0d9e2..17e8a37 100644
--- a/core/res/res/values-iw/strings.xml
+++ b/core/res/res/values-iw/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"גישה ישירה אל המיקרופון להקלטת אודיו."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"מצלמה"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"גישה ישירה למצלמה לצילום תמונות או וידאו."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"מידע על היישומים שלך"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"יכולת להשפיע על התנהגותם של יישומים אחרים במכשיר."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"טפט"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"פעולות טקסט"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"שטח האחסון אוזל"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"ייתכן שפונקציות מערכת מסוימות לא יפעלו"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"אישור"</string>
     <string name="cancel" msgid="6442560571259935130">"ביטול"</string>
     <string name="yes" msgid="5362982303337969312">"אישור"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"אל:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"הקלד את קוד ה-PIN הנדרש."</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"הטלפון יתנתק מרשת ה-Wi-Fi באופן זמני בשעה שהוא מחובר אל <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"הטלפון יתנתק מרשת ה-Wi-Fi באופן זמני בשעה שהוא מחובר אל <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"הוסף תו"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"שולח הודעות SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt; <xliff:g id="APP_NAME">%1$s</xliff:g> &lt;/ b&gt; שולח מספר רב של הודעות SMS. האם ברצונך לאפשר ליישום זה להמשיך לשלוח הודעות?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"שרטטת את קו ביטול הנעילה באופן שגוי <xliff:g id="NUMBER_0">%d</xliff:g> פעמים. לאחר <xliff:g id="NUMBER_1">%d</xliff:g> ניסיונות כושלים נוספים, תתבקש לבטל את נעילת הטלפון באמצעות חשבון דוא\"ל‏."\n\n"נסה שוב בעוד <xliff:g id="NUMBER_2">%d</xliff:g> שניות."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"הסר"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"האם להעלות את עוצמת הקול מעל לרמה הבטוחה?"\n"האזנה בעוצמת קול גבוהה למשך זמן ארוך עלולה לפגוע בשמיעה."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"המשך לגעת בשתי אצבעות כדי להפעיל נגישות."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"נגישות הופעלה."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"נגישות בוטלה."</string>
diff --git a/core/res/res/values-ja/strings.xml b/core/res/res/values-ja/strings.xml
index 5009af4..2b6cb00 100644
--- a/core/res/res/values-ja/strings.xml
+++ b/core/res/res/values-ja/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"マイクに直接アクセスして音声を記録します。"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"カメラ"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"カメラに直接アクセスして画像または動画を撮影します。"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"アプリ情報"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"端末上の他のアプリの動作に影響を及ぼします。"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"壁紙"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"テキスト操作"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"空き容量わずか"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"一部のシステム機能が動作しない可能性があります"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"キャンセル"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"To:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"必要なPINを入力してください:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"携帯端末が<xliff:g id="DEVICE_NAME">%1$s</xliff:g>に接続されている間は一時的にWi-Fi接続が解除されます。"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"携帯端末が<xliff:g id="DEVICE_NAME">%1$s</xliff:g>に接続されている間は一時的にWi-Fi接続が解除されます。"</string>
     <string name="select_character" msgid="3365550120617701745">"文字を挿入"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMSメッセージの送信中"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;が大量のSMSメッセージを送信しています。このアプリにこのままメッセージの送信を許可しますか?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"ロック解除パターンの入力を<xliff:g id="NUMBER_0">%d</xliff:g>回間違えました。あと<xliff:g id="NUMBER_1">%d</xliff:g>回間違えると、携帯端末のロック解除にメールアカウントが必要になります。"\n\n"<xliff:g id="NUMBER_2">%d</xliff:g>秒後にもう一度お試しください。"</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" - "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"削除"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"安全レベルを超えるまで音量を上げますか?"\n"大音量で長時間聞き続けると、聴力を損なう恐れがあります。"</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"ユーザー補助機能を有効にするには2本の指で押し続けてください。"</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"ユーザー補助が有効になりました。"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"ユーザー補助をキャンセルしました。"</string>
diff --git a/core/res/res/values-ko/strings.xml b/core/res/res/values-ko/strings.xml
index 46e6339..a810269 100644
--- a/core/res/res/values-ko/strings.xml
+++ b/core/res/res/values-ko/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"오디오를 녹음하기 위해 마이크에 직접 액세스합니다."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"카메라"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"이미지 및 동영상을 캡처하기 위해 카메라에 직접 액세스합니다."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"애플리케이션 정보"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"기기의 다른 애플리케이션의 작동에 영향을 줍니다."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"배경화면"</string>
@@ -259,7 +263,7 @@
     <string name="permdesc_getTasks" msgid="7454215995847658102">"앱이 현재 실행 중이거나 최근에 실행된 작업에 대한 정보를 검색할 수 있도록 허용합니다. 이 경우 앱이 기기에서 사용되는 다른 앱에 대한 정보를 검색할 수 있습니다."</string>
     <string name="permlab_interactAcrossUsers" msgid="7114255281944211682">"여러 사용자와의 상호작용"</string>
     <string name="permdesc_interactAcrossUsers" msgid="364670963623385786">"앱이 기기에서 다양한 사용자에 대한 작업을 수행할 수 있도록 허용합니다. 이 경우 악성 앱이 사용자 간의 보호를 위반할 수 있습니다."</string>
-    <string name="permlab_interactAcrossUsersFull" msgid="2567734285545074105">"여러 사용자와의 상호작용을 위한 정식 라이센스"</string>
+    <string name="permlab_interactAcrossUsersFull" msgid="2567734285545074105">"여러 사용자와의 상호작용을 위한 정식 라이선스"</string>
     <string name="permdesc_interactAcrossUsersFull" msgid="376841368395502366">"여러 사용자와의 가능한 모든 상호작용을 허용합니다."</string>
     <string name="permlab_manageUsers" msgid="1676150911672282428">"사용자 관리"</string>
     <string name="permdesc_manageUsers" msgid="8409306667645355638">"앱이 기기에서 검색, 생성 및 삭제를 포함한 사용자 관리를 할 수 있도록 허용합니다."</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"텍스트 작업"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"저장 공간이 부족함"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"일부 시스템 기능이 작동하지 않을 수 있습니다."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"확인"</string>
     <string name="cancel" msgid="6442560571259935130">"취소"</string>
     <string name="yes" msgid="5362982303337969312">"확인"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"받는사람:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"필수 PIN 입력:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>에 연결되어 있는 동안 일시적으로 휴대전화의 Wi-Fi 연결이 해제됩니다."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"<xliff:g id="DEVICE_NAME">%1$s</xliff:g>에 연결되어 있는 동안 일시적으로 휴대전화의 Wi-Fi 연결이 해제됩니다."</string>
     <string name="select_character" msgid="3365550120617701745">"문자 삽입"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS 메시지를 보내는 중"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;이(가) SMS 메시지를 대량으로 보내고 있습니다. 해당 앱이 메시지를 계속 보내도록 하시겠습니까?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"잠금해제 패턴을 <xliff:g id="NUMBER_0">%d</xliff:g>회 잘못 그렸습니다. <xliff:g id="NUMBER_1">%d</xliff:g>회 더 실패하면 이메일 계정을 사용하여 휴대전화를 잠금해제해야 합니다."\n\n" <xliff:g id="NUMBER_2">%d</xliff:g>초 후에 다시 시도해 주세요."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"삭제"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"안전한 수준 이상으로 볼륨을 높이시겠습니까?"\n"높은 볼륨으로 장시간 청취하면 청력에 손상이 올 수 있습니다."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"두 손가락으로 길게 누르면 접근성을 사용하도록 설정됩니다."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"접근성을 사용 설정했습니다."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"접근성이 취소되었습니다."</string>
diff --git a/core/res/res/values-lt/strings.xml b/core/res/res/values-lt/strings.xml
index fb476b5..1a48fac 100644
--- a/core/res/res/values-lt/strings.xml
+++ b/core/res/res/values-lt/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Tiesioginė prieiga prie mikrofono, kad būtų galima įrašyti garsą."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fotoaparatas"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Tiesioginė prieiga prie fotoaparato, kad būtų galima fotografuoti vaizdus arba įrašyti vaizdo įrašus."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Programų informacija"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Galimybė paveikti kitų įrenginio programų veikimą."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Ekrano fonas"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Teksto veiksmai"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Mažėja laisvos saugyklos vietos"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Kai kurios sistemos funkcijos gali neveikti"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Gerai"</string>
     <string name="cancel" msgid="6442560571259935130">"Atšaukti"</string>
     <string name="yes" msgid="5362982303337969312">"Gerai"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Skirta:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Įveskite reikiamą PIN kodą:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN kodas:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefonas bus laikinai atjungtas nuo „Wi-Fi“, kol bus prijungtas prie „<xliff:g id="DEVICE_NAME">%1$s</xliff:g>“"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefonas bus laikinai atjungtas nuo „Wi-Fi“, kol bus prijungtas prie „<xliff:g id="DEVICE_NAME">%1$s</xliff:g>“"</string>
     <string name="select_character" msgid="3365550120617701745">"Įterpti simbolį"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS pranešimų siuntimas"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Naudojant &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; siunčiama daug SMS pranešimų. Ar norite leisti šiai programai toliau siųsti pranešimus?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Netinkamai nupiešėte atrakinimo piešinį <xliff:g id="NUMBER_0">%d</xliff:g> k. Po dar <xliff:g id="NUMBER_1">%d</xliff:g> nesėkm. band. būsite paprašyti atrakinti telefoną naudodami „Google“ prisijungimo duomenis."\n\n" Bandykite dar kartą po <xliff:g id="NUMBER_2">%d</xliff:g> sek."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Pašalinti"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Padidinti garsumą viršijant saugų lygį?"\n"Ilgai klausantis dideliu garsumu gali sutrikti klausa."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Laikykite palietę dviem pirštais, kad įgalintumėte pritaikymo neįgaliesiems režimą."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Pritaikymas neįgaliesiems įgalintas."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Pritaikymo neįgaliesiems režimas atšauktas."</string>
diff --git a/core/res/res/values-lv/strings.xml b/core/res/res/values-lv/strings.xml
index 667e29c..dcaf8e3 100644
--- a/core/res/res/values-lv/strings.xml
+++ b/core/res/res/values-lv/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Tieša piekļuve mikrofonam, lai ierakstītu audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Tieša piekļuve kamerai, lai uzņemtu attēlus vai videoklipus."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informācija par jūsu lietojumprogrammām"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Spēja ietekmēt citu ierīcē esošo lietojumprogrammu darbību."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Fona tapete"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Teksta darbības"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Paliek maz brīvas vietas"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Dažas sistēmas funkcijas var nedarboties."</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Labi"</string>
     <string name="cancel" msgid="6442560571259935130">"Atcelt"</string>
     <string name="yes" msgid="5362982303337969312">"Labi"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Kam:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Ierakstiet pieprasīto PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Tālrunis tiks īslaicīgi atvienots no Wi-Fi tīkla, kamēr būs izveidots savienojums ar ierīci <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Tālrunis tiks īslaicīgi atvienots no Wi-Fi tīkla, kamēr būs izveidots savienojums ar ierīci <xliff:g id="DEVICE_NAME">%1$s</xliff:g>."</string>
     <string name="select_character" msgid="3365550120617701745">"Ievietojiet rakstzīmi"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Īsziņu sūtīšana"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Lietotne &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sūta daudz īsziņu. Vai vēlaties, lai šī lietotne turpinātu sūtīt ziņojumus?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Jūs nepareizi norādījāt atbloķēšanas kombināciju <xliff:g id="NUMBER_0">%d</xliff:g> reizes. Pēc vēl <xliff:g id="NUMBER_1">%d</xliff:g> neveiksmīgiem mēģinājumiem tālrunis būs jāatbloķē, izmantojot e-pasta kontu."\n\n"Mēģiniet vēlreiz pēc <xliff:g id="NUMBER_2">%d</xliff:g> sekundēm."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">"  — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Noņemt"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Vai palielināt skaļumu virs drošības līmeņa?"\n"Ilgstoši klausoties skaņu lielā skaļumā, var tikt bojāta dzirde."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Lai iespējotu pieejamību, turiet nospiestus divus pirkstus."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Pieejamības režīms ir iespējots."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Pieejamība ir atcelta."</string>
diff --git a/core/res/res/values-ms/strings.xml b/core/res/res/values-ms/strings.xml
index a04aac1..be04f9d 100644
--- a/core/res/res/values-ms/strings.xml
+++ b/core/res/res/values-ms/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Akses langsung ke mikrofon untuk merakam audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Akses langsung ke kamera untuk merakam imej atau video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Maklumat aplikasi anda"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Keupayaan untuk mempengaruhi tingkah laku aplikasi lain pada peranti anda."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Kertas dinding"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Tindakan teks"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Ruang storan semakin berkurangan"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Beberapa fungsi sistem mungkin tidak berfungsi"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Batal"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Kepada:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Taipkan PIN yang diperlukan:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Sambungan telefon ke Wi-Fi akan diputuskan buat sementara waktu semasa telefon bersambung ke <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Sambungan telefon ke Wi-Fi akan diputuskan buat sementara waktu semasa telefon bersambung ke <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Masukkan aksara"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Menghantar mesej SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sedang menghantar banyak mesej SMS. Adakah anda mahu membenarkan apl ini terus menghantar mesej?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Anda telah tersilap lukis corak buka kunci sebanyak <xliff:g id="NUMBER_0">%d</xliff:g> kali. Selepas <xliff:g id="NUMBER_1">%d</xliff:g> lagi percubaan yang tidak berjaya, anda akan diminta membuka kunci telefon anda menggunakan log masuk Google anda."\n\n" Cuba lagi dalam <xliff:g id="NUMBER_2">%d</xliff:g> saat."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Alih keluar"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Tingkatkan kelantangan di atas tahap selamat?"\n"Mendengar pada kelantangan tinggi untuk tempoh yang panjang boleh merosakkan pendengaran anda."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Teruskan menahan dengan dua jari untuk mendayakan kebolehcapaian."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Kebolehcapaian didayakan."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Kebolehcapaian dibatalkan."</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index 044415d..387676f 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direkte tilgang til mikrofonen for å ta opp lyd."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kameraet"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direkte tilgang til kamera for bilde- eller videoopptak."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Appinformasjonen din"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Ha muligheten til å påvirke andre apper på enheten din."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Bakgrunnen"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Teksthandlinger"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Lite ledig lagringsplass"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Enkelte systemfunksjoner fungerer muligens ikke slik de skal"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Avbryt"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Til:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Skriv inn påkrevd PIN-kode:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefonen frakobles Wi-Fi midlertidig mens den er tilkoblet <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefonen frakobles Wi-Fi midlertidig mens den er tilkoblet <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Sett inn tegn"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Sender SMS-meldinger"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; sender et stort antall SMS. Vil du la appen fortsette å sende ut meldinger?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Du har tegnet opplåsningsmønsteret feil <xliff:g id="NUMBER_0">%d</xliff:g> ganger. Etter ytterligere <xliff:g id="NUMBER_1">%d</xliff:g> gale forsøk, blir du bedt om å låse opp telefonen via en e-postkonto."\n\n" Prøv på nytt om <xliff:g id="NUMBER_2">%d</xliff:g> sekunder."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Fjern"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Vil du øke lydnivået over trygt nivå?"\n"Lytting på høyt lydnivå i lange perioder kan skade hørselen din."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Fortsett å holde nede to fingre for å aktivere tilgjengelighet."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Tilgjengelighet er aktivert."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Tilgjengelighetstjenesten ble avbrutt."</string>
diff --git a/core/res/res/values-nl/strings.xml b/core/res/res/values-nl/strings.xml
index 47264b03..38619e5 100644
--- a/core/res/res/values-nl/strings.xml
+++ b/core/res/res/values-nl/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Rechtstreeks toegang krijgen tot de microfoon om geluid op te nemen."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Camera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Rechtstreeks toegang krijgen tot de camera om afbeeldingen of video\'s vast te leggen."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informatie over uw applicaties"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Mogelijkheid om het gedrag van andere applicaties op uw apparaat te beïnvloeden."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Achtergrond"</string>
@@ -813,7 +817,7 @@
     <string name="lockscreen_glogin_instructions" msgid="3931816256100707784">"Als u wilt ontgrendelen, moet u zich aanmelden bij uw Google-account."</string>
     <string name="lockscreen_glogin_username_hint" msgid="8846881424106484447">"Gebruikersnaam (e-mail)"</string>
     <string name="lockscreen_glogin_password_hint" msgid="5958028383954738528">"Wachtwoord"</string>
-    <string name="lockscreen_glogin_submit_button" msgid="7130893694795786300">"Aanmelden"</string>
+    <string name="lockscreen_glogin_submit_button" msgid="7130893694795786300">"Inloggen"</string>
     <string name="lockscreen_glogin_invalid_input" msgid="1364051473347485908">"Gebruikersnaam of wachtwoord ongeldig."</string>
     <string name="lockscreen_glogin_account_recovery_hint" msgid="1696924763690379073">"Bent u uw gebruikersnaam of wachtwoord vergeten?"\n"Ga naar "<b>"https://www.google.com/accounts/recovery"</b>"."</string>
     <string name="lockscreen_glogin_checking_password" msgid="7114627351286933867">"Controleren…"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Tekstacties"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Opslagruimte is bijna vol"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Bepaalde systeemfuncties werken mogelijk niet"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Annuleren"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1121,7 +1129,7 @@
     <item quantity="other" msgid="7915895323644292768">"Open Wi-Fi-netwerken beschikbaar"</item>
   </plurals>
     <string name="wifi_available_sign_in" msgid="4029489716605255386">"Aanmelden bij wifi-netwerk"</string>
-    <string name="network_available_sign_in" msgid="8495155593358054676">"Aanmelden bij netwerk"</string>
+    <string name="network_available_sign_in" msgid="8495155593358054676">"Inloggen bij netwerk"</string>
     <!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
     <skip />
     <string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Kan geen verbinding maken met Wi-Fi"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Naar:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Voer de gewenste pincode in:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Pincode"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"De verbinding met het wifi-netwerk wordt tijdelijk uitgeschakeld terwijl de telefoon verbonden is met <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"De verbinding met het wifi-netwerk wordt tijdelijk uitgeschakeld terwijl de telefoon verbonden is met <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Teken invoegen"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS-berichten verzenden"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; verzendt moment een groot aantal sms-berichten. Wilt u toestaan ​​dat deze app berichten blijft verzenden?"</string>
@@ -1447,10 +1457,10 @@
     <string name="kg_invalid_puk" msgid="3638289409676051243">"Geef de juiste PUK-code opnieuw op. Bij herhaalde pogingen wordt de simkaart permanent uitgeschakeld."</string>
     <string name="kg_invalid_confirm_pin_hint" product="default" msgid="7003469261464593516">"Pincodes komen niet overeen"</string>
     <string name="kg_login_too_many_attempts" msgid="6486842094005698475">"Te veel patroonpogingen"</string>
-    <string name="kg_login_instructions" msgid="1100551261265506448">"Als u wilt ontgrendelen, moet u zich aanmelden bij uw Google-account."</string>
+    <string name="kg_login_instructions" msgid="1100551261265506448">"Als u wilt ontgrendelen, moet u inloggen op uw Google-account."</string>
     <string name="kg_login_username_hint" msgid="5718534272070920364">"Gebruikersnaam (e-mail)"</string>
     <string name="kg_login_password_hint" msgid="9057289103827298549">"Wachtwoord"</string>
-    <string name="kg_login_submit_button" msgid="5355904582674054702">"Aanmelden"</string>
+    <string name="kg_login_submit_button" msgid="5355904582674054702">"Inloggen"</string>
     <string name="kg_login_invalid_input" msgid="5754664119319872197">"Ongeldige gebruikersnaam of wachtwoord."</string>
     <string name="kg_login_account_recovery_hint" msgid="5690709132841752974">"Bent u uw gebruikersnaam of wachtwoord vergeten?"\n"Ga naar "<b>"google.com/accounts/recovery"</b>"."</string>
     <string name="kg_login_checking_password" msgid="1052685197710252395">"Account controleren…"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"U heeft uw ontgrendelingspatroon <xliff:g id="NUMBER_0">%d</xliff:g> keer onjuist getekend. Na nog eens <xliff:g id="NUMBER_1">%d</xliff:g> mislukte pogingen wordt u gevraagd uw telefoon te ontgrendelen via een e-mailaccount."\n\n" Probeer het over <xliff:g id="NUMBER_2">%d</xliff:g> seconden opnieuw."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Verwijderen"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Wilt u het volume verhogen tot boven het aanbevolen geluidsniveau?"\n"Te lang luisteren op een te hoog volume kan leiden tot gehoorbeschadiging."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Blijf het scherm met twee vingers aanraken om toegankelijkheid in te schakelen."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Toegankelijkheid ingeschakeld."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Toegankelijkheid geannuleerd."</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 8aedc15..a491104 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Bezpośredni dostęp do mikrofonu i nagrywanie dźwięku."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Aparat"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Bezpośredni dostęp do aparatu – robienie zdjęć i nagrywanie filmów."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informacje o aplikacjach"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Możliwość zmiany działania innych aplikacji na urządzeniu."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Tapeta"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Działania na tekście"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Kończy się miejsce"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Niektóre funkcje systemu mogą nie działać"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Anuluj"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Do:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Wpisz wymagany kod PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Kod PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Na czas połączenia z <xliff:g id="DEVICE_NAME">%1$s</xliff:g> telefon zostanie tymczasowo odłączony od Wi-Fi"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Na czas połączenia z <xliff:g id="DEVICE_NAME">%1$s</xliff:g> telefon zostanie tymczasowo odłączony od Wi-Fi"</string>
     <string name="select_character" msgid="3365550120617701745">"Wstaw znak"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Wysyłanie wiadomości SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; wysyła wiele SMS-ów. Chcesz pozwolić tej aplikacji dalej wysyłać SMS-y?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Po raz <xliff:g id="NUMBER_0">%d</xliff:g> nieprawidłowo narysowałeś wzór odblokowania. Po kolejnych <xliff:g id="NUMBER_1">%d</xliff:g> nieudanych próbach konieczne będzie odblokowanie telefonu przy użyciu danych logowania na konto Google."\n\n" Spróbuj ponownie za <xliff:g id="NUMBER_2">%d</xliff:g> s."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Usuń"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Chcesz ustawić głośność powyżej bezpiecznego poziomu?"\n"Słuchanie przy dużym poziomie głośności przez dłuższy czas może doprowadzić do uszkodzenia słuchu."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Aby włączyć ułatwienia dostępu, przytrzymaj dwa palce."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Włączono ułatwienia dostępu."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Ułatwienia dostępu zostały anulowane."</string>
diff --git a/core/res/res/values-pt-rPT/strings.xml b/core/res/res/values-pt-rPT/strings.xml
index 86ead94..646bc3a 100644
--- a/core/res/res/values-pt-rPT/strings.xml
+++ b/core/res/res/values-pt-rPT/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Acesso direto ao microfone para gravar áudio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Câmara"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Acesso direto à câmara para captura de imagens ou vídeos."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"As informações das suas aplicações"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Capacidade de afetar o comportamento de outras aplicações no seu dispositivo."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Imagem de fundo"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Acções de texto"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Está quase sem espaço de armazenamento"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Algumas funções do sistema poderão não funcionar"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Cancelar"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Para:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Introduza o PIN solicitado:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"O telemóvel irá desligar-se temporariamente da rede Wi-Fi enquanto está ligado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"O telemóvel irá desligar-se temporariamente da rede Wi-Fi enquanto está ligado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Introduzir carácter"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"A enviar mensagens SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; está a enviar um grande número de mensagens SMS. Pretende autorizar que a aplicação continue a enviar mensagens?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Desenhou a sequência de desbloqueio incorretamente <xliff:g id="NUMBER_0">%d</xliff:g> vezes. Depois de mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativas sem sucesso, ser-lhe-á pedido para desbloquear o telemóvel através de uma conta de email."\n\n" Tente novamente dentro de <xliff:g id="NUMBER_2">%d</xliff:g> segundos."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" - "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Remover"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Aumentar o volume acima do nível de segurança?"\n"Ouvir em volume alto durante longos períodos de tempo poderá prejudicar a sua audição."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Mantenha os dois dedos para ativar a acessibilidade."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Acessibilidade ativada."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Acessibilidade cancelada."</string>
diff --git a/core/res/res/values-pt/strings.xml b/core/res/res/values-pt/strings.xml
index 4650d55..873c9db 100644
--- a/core/res/res/values-pt/strings.xml
+++ b/core/res/res/values-pt/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Acesso direto ao microfone para gravação de áudio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Câmera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Acesso direto à câmera para captura de imagens ou vídeo."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informações sobre seus aplicativos"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Capacidade de afetar o comportamento de outros aplicativos no dispositivo."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Plano de fundo"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Ações de texto"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Pouco espaço de armazenamento"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Algumas funções do sistema podem não funcionar"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Cancelar"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Para:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Digite o PIN obrigatório:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"O telefone desconectará temporariamente da rede Wi-Fi enquanto estiver conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"O telefone desconectará temporariamente da rede Wi-Fi enquanto estiver conectado a <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Inserir caractere"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Enviando mensagens SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; envia uma grande quantidade de mensagens SMS. Deseja permitir que este aplicativo continue enviando mensagens?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Você desenhou sua sequência de desbloqueio incorretamente <xliff:g id="NUMBER_0">%d</xliff:g> vezes. Se fizer mais <xliff:g id="NUMBER_1">%d</xliff:g> tentativas incorretas, será solicitado que você use o login do Google para desbloquear."\n\n" Tente novamente em <xliff:g id="NUMBER_2">%d</xliff:g> segundos."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Remover"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Aumentar o volume acima do nível seguro?"\n"A audição em volume elevado por períodos longos pode prejudicar sua audição."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Mantenha pressionado com dois dedos para ativar a acessibilidade."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Acessibilidade ativada."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Acessibilidade cancelada."</string>
diff --git a/core/res/res/values-rm/strings.xml b/core/res/res/values-rm/strings.xml
index b49854a..e934a08 100644
--- a/core/res/res/values-rm/strings.xml
+++ b/core/res/res/values-rm/strings.xml
@@ -271,6 +271,10 @@
     <skip />
     <!-- no translation found for permgroupdesc_camera (2933667372289567714) -->
     <skip />
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <!-- no translation found for permgrouplab_appInfo (8028789762634147725) -->
     <skip />
     <!-- no translation found for permgroupdesc_appInfo (3950378538049625907) -->
@@ -1630,6 +1634,10 @@
     <skip />
     <!-- no translation found for low_internal_storage_view_text (6640505817617414371) -->
     <skip />
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Interrumper"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1777,6 +1785,8 @@
     <skip />
     <!-- no translation found for wifi_p2p_show_pin_message (8530563323880921094) -->
     <skip />
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
     <!-- no translation found for wifi_p2p_frequency_conflict_message (7363907213787469151) -->
     <skip />
     <string name="select_character" msgid="3365550120617701745">"Inserir in caracter"</string>
@@ -2368,7 +2378,7 @@
     <skip />
     <!-- no translation found for kg_reordering_delete_drop_target_text (7899202978204438708) -->
     <skip />
-    <!-- no translation found for safe_media_volume_warning (7382971871993371648) -->
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
     <skip />
     <!-- no translation found for continue_to_enable_accessibility (1626427372316070258) -->
     <skip />
diff --git a/core/res/res/values-ro/strings.xml b/core/res/res/values-ro/strings.xml
index 4fb58b8..c44b362 100644
--- a/core/res/res/values-ro/strings.xml
+++ b/core/res/res/values-ro/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Acces direct la microfon pentru înregistrări audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Camera foto"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Acces direct la camera foto pentru a realiza fotografii şi videoclipuri."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informaţiile despre aplicaţiile dvs."</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Capacitatea de a influenţa comportamentul altor aplicaţii de pe dispozitiv."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Imaginea de fundal"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Acţiuni pentru text"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Spaţiul de stocare aproape ocupat"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Este posibil ca unele funcţii de sistem să nu funcţioneze"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Anulaţi"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Către:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Introduceţi codul PIN necesar:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Cod PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefonul se va deconecta temporar de la reţeaua Wi-Fi cât timp este conectat la <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefonul se va deconecta temporar de la reţeaua Wi-Fi cât timp este conectat la <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Introduceţi caracterul"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Se trimit mesaje SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; trimite un număr mare de mesaje SMS. Permiteţi acestei aplicaţii să trimită în continuare mesaje?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Aţi desenat incorect modelul pentru deblocare de <xliff:g id="NUMBER_0">%d</xliff:g> ori. După încă <xliff:g id="NUMBER_1">%d</xliff:g> încercări nereuşite, vi se va solicita să deblocaţi telefonul cu ajutorul unui cont de e-mail."\n\n" Încercaţi din nou peste <xliff:g id="NUMBER_2">%d</xliff:g> (de) secunde."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Eliminaţi"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Ridicaţi volumul mai sus de nivelul sigur?"\n"Ascultarea la volum ridicat pe perioade lungi de timp vă poate afecta auzul."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Menţineţi două degete pe ecran pentru a activa accesibilitatea."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"S-a activat accesibilitatea."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Accesibilitatea a fost anulată"</string>
diff --git a/core/res/res/values-ru/strings.xml b/core/res/res/values-ru/strings.xml
index 9475472..7152bb8 100644
--- a/core/res/res/values-ru/strings.xml
+++ b/core/res/res/values-ru/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Прямой доступ к микрофону для записи звука."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Камера"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Прямой доступ к камере для фото- и видеосъемки."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Информация о приложениях"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Возможность влиять на поведение других приложений на устройстве."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Обои"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Операции с текстом"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Заканчивается свободное место"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Некоторые системные функции могут не работать"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"ОК"</string>
     <string name="cancel" msgid="6442560571259935130">"Отмена"</string>
     <string name="yes" msgid="5362982303337969312">"ОК"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Кому:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Введите PIN-код:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN-код:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"При подключении к устройству <xliff:g id="DEVICE_NAME">%1$s</xliff:g> телефон будет временно отключаться от сети Wi-Fi"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"При подключении к устройству <xliff:g id="DEVICE_NAME">%1$s</xliff:g> телефон будет временно отключаться от сети Wi-Fi"</string>
     <string name="select_character" msgid="3365550120617701745">"Введите символ"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Отправка SMS-сообщений"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; отправляет большое количество SMS. Разрешить приложению и дальше отправлять сообщения?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Вы <xliff:g id="NUMBER_0">%d</xliff:g> раз неверно указали графический ключ. После <xliff:g id="NUMBER_1">%d</xliff:g> неверных попыток для разблокировки телефона потребуется войти в аккаунт Google."\n\n"Повтор через <xliff:g id="NUMBER_2">%d</xliff:g> сек."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Удалить"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Увеличить громкость до небезопасного уровня?"\n"Долговременное прослушивание на такой громкости может повредить слух."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Чтобы включить специальные возможности, удерживайте пальцы на экране."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Специальные возможности включены."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Специальные возможности не будут включены."</string>
diff --git a/core/res/res/values-sk/strings.xml b/core/res/res/values-sk/strings.xml
index c1d2c46..6f95ff6 100644
--- a/core/res/res/values-sk/strings.xml
+++ b/core/res/res/values-sk/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Priamy prístup k mikrofónu na záznam zvuku."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fotoaparát"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Priamy prístup k fotoaparátu na nasnímanie fotografií alebo natočenie videí."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Informácie o vašich aplikáciách"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Schopnosť ovplyvniť správanie ďalších aplikácií na vašom zariadení."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Tapeta"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Operácie s textom"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Nedostatok ukladacieho priestoru"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Niektoré systémové funkcie nemusia fungovať"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Zrušiť"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Komu:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Zadajte požadovaný kód PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefón bude počas pripojenia k zariadeniu <xliff:g id="DEVICE_NAME">%1$s</xliff:g> od siete Wi-Fi dočasne odpojený."</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefón bude počas pripojenia k zariadeniu <xliff:g id="DEVICE_NAME">%1$s</xliff:g> od siete Wi-Fi dočasne odpojený."</string>
     <string name="select_character" msgid="3365550120617701745">"Vkladanie znakov"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Odosielanie správ SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Aplikácia &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; posiela veľký počet správ SMS. Chcete tejto aplikácií povoliť, aby aj naďalej posielala správy?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"<xliff:g id="NUMBER_0">%d</xliff:g>-krát ste nesprávne nakreslili svoj bezpečnostný vzor. Po <xliff:g id="NUMBER_1">%d</xliff:g> ďalších neúspešných pokusoch sa zobrazí výzva na odomknutie telefónu pomocou e-mailového účtu."\n\n" Skúste to znova o <xliff:g id="NUMBER_2">%d</xliff:g> s."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Odstrániť"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Chcete zvýšiť hlasitosť nad bezpečnú úroveň?"\n"Dlhodobé počúvanie pri vysokej hlasitosti môže viesť k poškodeniu vášho sluchu."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Zjednodušenie ovládania povolíte dlhým stlačením dvoma prstami."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Zjednodušenie ovládania je povolené."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Zjednodušenie ovládania bolo zrušené."</string>
diff --git a/core/res/res/values-sl/strings.xml b/core/res/res/values-sl/strings.xml
index 7eb8583..1486341 100644
--- a/core/res/res/values-sl/strings.xml
+++ b/core/res/res/values-sl/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Neposreden dostop do mikrofona za snemanje zvoka."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Fotoaparat"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Neposreden dostop do fotoaparata za fotografiranje ali snemanje videoposnetkov."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Podatki o vaših aplikacijah"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Zmožnost vpliva na delovanje drugih aplikacij v napravi."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Slika za ozadje"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Besedilna dejanja"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Prostor za shranjevanje bo pošel"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Nekatere sistemske funkcije morda ne delujejo"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"V redu"</string>
     <string name="cancel" msgid="6442560571259935130">"Prekliči"</string>
     <string name="yes" msgid="5362982303337969312">"V redu"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Za:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Vnesite zahtevano kodo PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefon bo začasno prekinil povezavo z Wi-Fi-jem, ko je povezan z napravo <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefon bo začasno prekinil povezavo z Wi-Fi-jem, ko je povezan z napravo <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Vstavljanje znaka"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Pošiljanje sporočil SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; pošilja veliko SMS-ov. Ali želite dovoliti, da jih še naprej pošilja?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Vzorec za odklepanje ste <xliff:g id="NUMBER_0">%d</xliff:g>-krat napačno vnesli. Po nadaljnjih <xliff:g id="NUMBER_1">%d</xliff:g> neuspešnih poskusih boste pozvani, da odklenete telefon z Googlovimi podatki za prijavo."\n\n"Poskusite znova čez <xliff:g id="NUMBER_2">%d</xliff:g> s."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Odstrani"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Želite povečati glasnost nad varno raven?"\n"Dolgotrajna izpostavljenost glasnim tonom lahko poškoduje sluh."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Če želite omogočiti pripomočke za ljudi s posebnimi potrebami, na zaslonu pridržite z dvema prstoma."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Pripomočki za ljudi s posebnimi potrebami so omogočeni."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Omogočanje pripomočkov za ljudi s posebnimi potrebami preklicano."</string>
diff --git a/core/res/res/values-sr/strings.xml b/core/res/res/values-sr/strings.xml
index de942ea..a1b869f 100644
--- a/core/res/res/values-sr/strings.xml
+++ b/core/res/res/values-sr/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Директан приступ микрофону за снимање звука."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Камера"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Директан приступ камери за снимање слика или видео снимака."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Информације о апликацијама"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Способност да се утиче на понашање других апликација на уређају."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Позадина"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Радње у вези са текстом"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Простор за складиштење је на измаку"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Неке системске функције можда не функционишу"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Потврди"</string>
     <string name="cancel" msgid="6442560571259935130">"Откажи"</string>
     <string name="yes" msgid="5362982303337969312">"Потврди"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Коме:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Унесите потребни PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Телефон ће привремено прекинути везу са Wi-Fi-јем док је повезан са уређајем <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Телефон ће привремено прекинути везу са Wi-Fi-јем док је повезан са уређајем <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Уметање знака"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Слање SMS порука"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; шаље велики број SMS порука. Желите ли да дозволите овој апликацији да настави са слањем порука?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Нацртали сте шаблон за откључавање неисправно <xliff:g id="NUMBER_0">%d</xliff:g> пута. После још <xliff:g id="NUMBER_1">%d</xliff:g> неуспешна(их) покушаја, од вас ће бити затражено да откључате телефон помоћу налога е-поште."\n\n"Покушајте поново за <xliff:g id="NUMBER_2">%d</xliff:g> секунде(и)."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Уклони"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Желите да појачате звук изнад безбедног нивоа?"\n"Ако дуже време слушате гласну музику, може доћи до оштећења слуха."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Држите са два прста да бисте омогућили приступачност."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Приступачност је омогућена."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Приступачност је отказана."</string>
diff --git a/core/res/res/values-sv/strings.xml b/core/res/res/values-sv/strings.xml
index 370c7d6..4c98712 100644
--- a/core/res/res/values-sv/strings.xml
+++ b/core/res/res/values-sv/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direktåtkomst till mikrofonen för att spela in ljud."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direktåtkomst till kamera för att ta bilder eller spela in video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Information i dina appar"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Kan påverka beteendet hos andra appar på enheten."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Bakgrund"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Textåtgärder"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Lagringsutrymmet börjar ta slut"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Det kan hända att vissa systemfunktioner inte fungerar"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Avbryt"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Till:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Ange den obligatoriska PIN-koden:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN-kod:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Mobilen kommer tillfälligt att kopplas från Wi-Fi när den är ansluten till <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Mobilen kommer tillfälligt att kopplas från Wi-Fi när den är ansluten till <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Infoga tecken"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Skickar SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; skickar ett stort antal SMS. Vill du tillåta att appen fortsätter att skicka meddelanden?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Du har ritat ditt grafiska lösenord fel <xliff:g id="NUMBER_0">%d</xliff:g> gånger. Efter ytterligare <xliff:g id="NUMBER_1">%d</xliff:g> försök ombeds du låsa upp mobilen med hjälp av ett e-postkonto."\n\n" Försök igen om <xliff:g id="NUMBER_2">%d</xliff:g> sekunder."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Ta bort"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Vill du höja volymen över den säkra nivån?"\n"Om du lyssnar på hög volym under långa perioder kan din hörsel skadas."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Fortsätt trycka med två fingrar om du vill aktivera tillgänglighetsläget."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Tillgänglighetsläget har aktiverats."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Byte till tillgänglighetsläge avbrutet."</string>
diff --git a/core/res/res/values-sw/strings.xml b/core/res/res/values-sw/strings.xml
index f30d11f..d1e4270 100644
--- a/core/res/res/values-sw/strings.xml
+++ b/core/res/res/values-sw/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Kufikia moja kwa moja kipokea sauti ili kurekodi sauti."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Kufikia moja kwa moja kamera ya kunasa taswira au video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Taarifa ya programu zako"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Uwezo wa kuathiri tabia ya programu nyingine kwenye kifaa chako."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Taswira"</string>
@@ -637,7 +641,7 @@
     <string name="policydesc_expirePassword" msgid="1729725226314691591">"Dhibiti ni mara ngapi nenosiri la kufunga skrini linafaa libadilishwe."</string>
     <string name="policylab_encryptedStorage" msgid="8901326199909132915">"Weka msimbo fiche wa hifadhi"</string>
     <string name="policydesc_encryptedStorage" msgid="2637732115325316992">"Inahitaji kwamba data ya programu iliyohifadhiwa iwe na msimbo fiche."</string>
-    <string name="policylab_disableCamera" msgid="6395301023152297826">"Lemaza kamera"</string>
+    <string name="policylab_disableCamera" msgid="6395301023152297826">"Zima kamera"</string>
     <string name="policydesc_disableCamera" msgid="2306349042834754597">"Zuia matumizi yote ya kamera za kifaa."</string>
     <string name="policylab_disableKeyguardFeatures" msgid="266329104542638802">"Lemaza vipengele kwenye kilinzi cha kitufe."</string>
     <string name="policydesc_disableKeyguardFeatures" msgid="3467082272186534614">"Inazuia matumizi ya baadhi ya vipengele kwenye kilinzi cha kitufe."</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Vitendo vya maandishi"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Nafasi ya kuhafadhi inakwisha"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Baadhi ya vipengee vya mfumo huenda visifanye kazi"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Sawa"</string>
     <string name="cancel" msgid="6442560571259935130">"Ghairi"</string>
     <string name="yes" msgid="5362982303337969312">"Sawa"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Kwa:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Charaza PIN inayohitajika:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Simu itaukata muunganisho kwa muda kutoka kwenye Wi-Fi inapokuwa imeunganishwa kwenye <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Simu itaukata muunganisho kwa muda kutoka kwenye Wi-Fi inapokuwa imeunganishwa kwenye <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Ingiza kibambo"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Inatuma ujumbe wa SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; inatuma idadi kubwa ya SMS. Je, unataka kuruhusu programu hii kuendelea kutuma SMS?"</string>
@@ -1429,7 +1439,7 @@
     <string name="wifi_display_notification_disconnect" msgid="6183754463561153372">"Tenganisha"</string>
     <string name="kg_emergency_call_label" msgid="684946192523830531">"Simu ya dharura"</string>
     <string name="kg_forgot_pattern_button_text" msgid="8852021467868220608">"Umesahau Ruwaza"</string>
-    <string name="kg_wrong_pattern" msgid="1850806070801358830">"Ruwaza Isiyo sahihi"</string>
+    <string name="kg_wrong_pattern" msgid="1850806070801358830">"Mchoro Usio sahihi"</string>
     <string name="kg_wrong_password" msgid="2333281762128113157">"Nenosiri Lisilo sahihi"</string>
     <string name="kg_wrong_pin" msgid="1131306510833563801">"PIN isiyo sahihi"</string>
     <string name="kg_too_many_failed_attempts_countdown" msgid="6358110221603297548">"Jaribu tena baada ya sekunde <xliff:g id="NUMBER">%d</xliff:g>."</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Umekosea kuchora mchoro wako wa kufungua mara <xliff:g id="NUMBER_0">%d</xliff:g>. Baada ya majaribio <xliff:g id="NUMBER_1">%d</xliff:g> yasiyofaulu, utaombwa kufungua simu yako kwa kutumia akaunti ya barua pepe."\n\n" Jaribu tena baada ya sekunde <xliff:g id="NUMBER_2">%d</xliff:g>."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Ondoa"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Ongeza sauti zaidi ya kiwango salama? "\n"Kusikiliza kwa sauti ya juu kwa muda mrefu kunaweza kuharibu uwezo wako wa kusikia."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Endelea kushikilia chini kwa vidole vyako viwili ili kuwezesha ufikivu."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Ufikivu umewezeshwa."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Ufikivu umeghairiwa."</string>
diff --git a/core/res/res/values-th/strings.xml b/core/res/res/values-th/strings.xml
index 1a6d610..4bca1b1 100644
--- a/core/res/res/values-th/strings.xml
+++ b/core/res/res/values-th/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"เข้าถึงไมโครโฟนเพื่อบันทึกเสียงโดยตรง"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"กล้องถ่ายรูป"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"เข้าถึงกล้องถ่ายรูปเพื่อดูภาพและวิดีโอที่ถ่ายไว้โดยตรง"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"ข้อมูลแอปพลิเคชันของคุณ"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"สามารถส่งผลต่อการทำงานของแอปพลิเคชันอื่นในอุปกรณ์ของคุณ"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"วอลเปเปอร์"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"การทำงานของข้อความ"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"พื้นที่จัดเก็บเหลือน้อย"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"บางฟังก์ชันระบบอาจไม่ทำงาน"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"ตกลง"</string>
     <string name="cancel" msgid="6442560571259935130">"ยกเลิก"</string>
     <string name="yes" msgid="5362982303337969312">"ตกลง"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"ถึง:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"พิมพ์ PIN ที่ต้องการ:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"โทรศัพท์จะยกเลิกการเชื่อมต่อกับ Wi-Fi ชั่วคราวในขณะที่เชื่อมต่อกับ <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"โทรศัพท์จะยกเลิกการเชื่อมต่อกับ Wi-Fi ชั่วคราวในขณะที่เชื่อมต่อกับ <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"ใส่อักขระ"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"กำลังส่งข้อความ SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; กำลังส่งข้อความ SMS จำนวนมาก คุณต้องการอนุญาตให้แอปพลิเคชันนี้ส่งข้อความต่อหรือไม่"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"คุณวาดรูปแบบการปลดล็อกไม่ถูกต้อง <xliff:g id="NUMBER_0">%d</xliff:g> ครั้งแล้ว หากทำไม่สำเร็จอีก <xliff:g id="NUMBER_1">%d</xliff:g> ครั้ง ระบบจะขอให้คุณปลดล็อกโทรศัพท์โดยใช้ับัญชีอีเมล"\n\n" โปรดลองอีกครั้งในอีก <xliff:g id="NUMBER_2">%d</xliff:g> วินาที"</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"นำออก"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"เพิ่มระดับเสียงจนเกินระดับที่ปลอดภัยหรือไม่"\n"การฟังเสียงดังเป็นเวลานานอาจทำให้การได้ยินของคุณบกพร่องได้"</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"ใช้สองนิ้วแตะค้างไว้เพื่อเปิดใช้งานการเข้าถึง"</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"เปิดใช้งานการเข้าถึงแล้ว"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"ยกเลิกการเข้าถึงแล้ว"</string>
diff --git a/core/res/res/values-tl/strings.xml b/core/res/res/values-tl/strings.xml
index 1354129..00c9ef8 100644
--- a/core/res/res/values-tl/strings.xml
+++ b/core/res/res/values-tl/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Direktang access sa mikropono upang mag-record ng audio."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Camera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Direktang access sa camera para sa pagkuha ng larawan o video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Ang impormasyon ng iyong mga application"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Kakayahang maapektuhan ang pag-uugali ng iba pang mga application sa iyong device."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Wallpaper"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Pagkilos ng teksto"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Nauubusan na ang puwang ng storage"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Maaaring hindi gumana nang tama ang ilang paggana ng system"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Kanselahin"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Kay:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"I-type ang kinakailangang PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Pansamantalang madidiskoneta ang telepono sa Wi-Fi habang nakakonekta ito sa <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Pansamantalang madidiskoneta ang telepono sa Wi-Fi habang nakakonekta ito sa <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Magpasok ng character"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Nagpapadala ng mga SMS na mensahe"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Ang &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ay nagpapadala ng maraming mensaheng SMS. Gusto mo bang payagan ang app na ito na magpatuloy sa pagpapadala ng mga mensahe?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Naguhit mo nang hindi tama ang iyong pattern sa pag-unlock nang <xliff:g id="NUMBER_0">%d</xliff:g> (na) beses. Pagkatapos ng <xliff:g id="NUMBER_1">%d</xliff:g> pang hindi matagumpay na pagtatangka, hihilingin sa iyong i-unlock ang telepono mo gamit ang isang email account."\n\n" Subukang muli sa loob ng <xliff:g id="NUMBER_2">%d</xliff:g> (na) segundo."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Alisin"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Lakasan ang volume nang lagpas sa ligtas na antas?"\n"Maaaring mapinsala ng pakikinig sa malakas na volume sa loob ng mahahabang panahon ang iyong pandinig."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Panatilihing nakapindot nang matagal ang iyong dalawang daliri upang paganahin ang pagiging naa-access."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Pinagana ang accessibility."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Nakansela ang pagiging naa-access."</string>
diff --git a/core/res/res/values-tr/strings.xml b/core/res/res/values-tr/strings.xml
index aa3244c..5595a7a 100644
--- a/core/res/res/values-tr/strings.xml
+++ b/core/res/res/values-tr/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Ses kaydetmek için mikrofona doğrudan erişim."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Kamera"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Resim ve video kaydı için kameraya doğrudan erişim."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Uygulama bilgileriniz"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Cihazınızdaki diğer uygulamaların davranışlarını etkileyebilme."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Duvar Kağıdı"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Metin eylemleri"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Depolama alanı bitiyor"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Bazı sistem işlevleri çalışmayabilir"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"Tamam"</string>
     <string name="cancel" msgid="6442560571259935130">"İptal"</string>
     <string name="yes" msgid="5362982303337969312">"Tamam"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Alıcı:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Gerekli PIN\'i yazın:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Telefon <xliff:g id="DEVICE_NAME">%1$s</xliff:g> adlı cihaza bağlıyken Kablosuz ağ bağlantısı geçici olarak kesilecektir"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Telefon <xliff:g id="DEVICE_NAME">%1$s</xliff:g> adlı cihaza bağlıyken Kablosuz ağ bağlantısı geçici olarak kesilecektir"</string>
     <string name="select_character" msgid="3365550120617701745">"Karakter ekle"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"SMS mesajları gönderiliyor"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; çok sayıda SMS mesajı gönderiyor. Bu uygulamanın mesaj göndermeye devam etmesine izin veriyor musunuz?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Kilit açma deseninizi <xliff:g id="NUMBER_0">%d</xliff:g> kez yanlış çizdiniz. <xliff:g id="NUMBER_1">%d</xliff:g> başarısız denemeden sonra telefonunuzu bir e-posta hesabı kullanarak açmanız istenir."\n\n" <xliff:g id="NUMBER_2">%d</xliff:g> saniye içinde tekrar deneyin."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Kaldır"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Ses düzeyi güvenli seviyenin üzerine çıkarılsın mı?"\n"Yüksek sesle uzun süre dinlemek işitme yetinize zarar verebilir."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Erişilebilirliği etkinleştirmek için iki parmağınızı basılı tutmaya devam edin."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Erişilebilirlik etkinleştirildi."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Erişilebilirlik iptal edildi."</string>
diff --git a/core/res/res/values-uk/strings.xml b/core/res/res/values-uk/strings.xml
index 2f6d65c..49bc0c3 100644
--- a/core/res/res/values-uk/strings.xml
+++ b/core/res/res/values-uk/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Безпосередній доступ до мікрофона для запису звуку."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Камера"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Безпосередній доступ до камери для здійснення фото- чи відеозйомки."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Інформація про програми"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Здатність впливати на роботу інших програм на пристрої."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Фоновий малюнок"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Дії з текстом"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Закінчується пам’ять"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Деякі системні функції можуть не працювати"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Скасувати"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Кому:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Введіть потрібний PIN-код:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN-код:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Під час з’єднання з пристроєм <xliff:g id="DEVICE_NAME">%1$s</xliff:g> телефон тимчасово від’єднається від мережі Wi-Fi"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Під час з’єднання з пристроєм <xliff:g id="DEVICE_NAME">%1$s</xliff:g> телефон тимчасово від’єднається від мережі Wi-Fi"</string>
     <string name="select_character" msgid="3365550120617701745">"Вставл-ня символу"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Надсил. SMS повідомлень"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"Програма &lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; надсилає велику кількість SMS-повідомлень. Дозволити цій програмі й надалі надсилати повідомлення?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Ключ розблокування неправильно намальовано стільки разів: <xliff:g id="NUMBER_0">%d</xliff:g>. У вас є ще стільки спроб: <xliff:g id="NUMBER_1">%d</xliff:g>. У разі невдачі з’явиться запит розблокувати телефон за допомогою облікового запису електронної пошти."\n\n" Повторіть спробу через <xliff:g id="NUMBER_2">%d</xliff:g> сек."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Вилучити"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Збільшити гучність понад безпечний рівень?"\n"Надто гучне прослуховування впродовж тривалого періоду може пошкодити слух."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Утримуйте двома пальцями, щоб увімкнути доступність."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Доступність увімкнено."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Доступність скасовано."</string>
diff --git a/core/res/res/values-vi/strings.xml b/core/res/res/values-vi/strings.xml
index df86597..48e3fca 100644
--- a/core/res/res/values-vi/strings.xml
+++ b/core/res/res/values-vi/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Truy cập trực tiếp vào micrô để ghi âm."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Máy ảnh"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Truy cập trực tiếp vào máy ảnh để chụp ảnh hoặc quay video."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Thông tin về các ứng dụng của bạn"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Khả năng ảnh hưởng tới hoạt động của các ứng dụng khác trên thiết bị của bạn."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Hình nền"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Tác vụ văn bản"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Sắp hết dung lượng lưu trữ"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Một số chức năng hệ thống có thể không hoạt động"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"OK"</string>
     <string name="cancel" msgid="6442560571259935130">"Hủy"</string>
     <string name="yes" msgid="5362982303337969312">"OK"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Người nhận:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Nhập PIN bắt buộc:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"Mã PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Điện thoại sẽ tạm thời ngắt kết nối khỏi Wi-Fi trong khi điện thoại được kết nối với <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Điện thoại sẽ tạm thời ngắt kết nối khỏi Wi-Fi trong khi điện thoại được kết nối với <xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Chèn ký tự"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Đang gửi tin nhắn SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; đang gửi rất nhiều tin nhắn SMS. Bạn có muốn cho phép ứng dụng này tiếp tục gửi tin nhắn không?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Bạn đã <xliff:g id="NUMBER_0">%d</xliff:g> lần vẽ không chính xác hình mở khóa của mình. Sau <xliff:g id="NUMBER_1">%d</xliff:g> lần thử không thành công nữa, bạn sẽ được yêu cầu mở khóa điện thoại bằng tài khoản email."\n\n" Vui lòng thử lại sau <xliff:g id="NUMBER_2">%d</xliff:g> giây."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Xóa"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Tăng âm lượng trên mức an toàn?"\n"Nghe ở âm lượng cao trong thời gian dài có thể gây hại cho thính giác của bạn."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Tiếp tục giữ hai ngón tay để bật trợ năng."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Trợ năng đã được bật."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Đã hủy trợ năng."</string>
diff --git a/core/res/res/values-zh-rCN/strings.xml b/core/res/res/values-zh-rCN/strings.xml
index b952bd4..ccc66fb 100644
--- a/core/res/res/values-zh-rCN/strings.xml
+++ b/core/res/res/values-zh-rCN/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"直接使用麦克风以录制音频。"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"相机"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"直接使用相机以拍摄图片或视频。"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"您的应用信息"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"能够影响设备上其他应用的行为。"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"壁纸"</string>
@@ -428,9 +432,9 @@
     <string name="permdesc_readProfile" product="default" msgid="5462475151849888848">"允许该应用读取您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着该应用可以识别您的身份,并可能将您的个人资料信息发送给他人。"</string>
     <string name="permlab_writeProfile" msgid="907793628777397643">"修改您自己的名片"</string>
     <string name="permdesc_writeProfile" product="default" msgid="5552084294598465899">"允许该应用更改或添加您设备上存储的个人资料信息,例如您的姓名和联系信息。这意味着该应用可以识别您的身份,并可能将您的个人资料信息发送给他人。"</string>
-    <string name="permlab_readSocialStream" product="default" msgid="1268920956152419170">"读取您的社交视频流"</string>
+    <string name="permlab_readSocialStream" product="default" msgid="1268920956152419170">"读取您的社交信息流"</string>
     <string name="permdesc_readSocialStream" product="default" msgid="4255706027172050872">"允许该应用访问并同步您和朋友的社交动态信息。在分享信息时一定要小心,因为此权限可让该应用读取您与社交网络上的朋友之间的交流信息。"</string>
-    <string name="permlab_writeSocialStream" product="default" msgid="3504179222493235645">"写入您的社交视频流"</string>
+    <string name="permlab_writeSocialStream" product="default" msgid="3504179222493235645">"写入您的社交信息流"</string>
     <string name="permdesc_writeSocialStream" product="default" msgid="3086557552204114849">"允许该应用显示您朋友的社交动态信息。在分享信息时一定要小心,因为此权限可让该应用冒充某个朋友编写消息。请注意:此权限可能不适用于所有社交网络。"</string>
     <string name="permlab_readCalendar" msgid="5972727560257612398">"读取日历活动和机密信息"</string>
     <string name="permdesc_readCalendar" product="tablet" msgid="4216462049057658723">"允许该应用读取您平板电脑上存储的所有日历活动,包括朋友或同事的活动。此权限可让该应用分享或保存您的日历数据,而不论这些数据是否属于机密或敏感内容。"</string>
@@ -870,9 +874,9 @@
     <string name="autofill_address_summary_separator" msgid="7483307893170324129">", "</string>
     <string name="autofill_address_summary_format" msgid="4874459455786827344">"$1$2$3"</string>
     <string name="autofill_province" msgid="2231806553863422300">"省/直辖市/自治区"</string>
-    <string name="autofill_postal_code" msgid="4696430407689377108">"邮政编码"</string>
+    <string name="autofill_postal_code" msgid="4696430407689377108">"邮编"</string>
     <string name="autofill_state" msgid="6988894195520044613">"州"</string>
-    <string name="autofill_zip_code" msgid="8697544592627322946">"邮政编码"</string>
+    <string name="autofill_zip_code" msgid="8697544592627322946">"邮编"</string>
     <string name="autofill_county" msgid="237073771020362891">"郡"</string>
     <string name="autofill_island" msgid="4020100875984667025">"岛"</string>
     <string name="autofill_district" msgid="8400735073392267672">"地区"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"文字操作"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"存储空间不足"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"某些系统功能可能无法正常使用"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"确定"</string>
     <string name="cancel" msgid="6442560571259935130">"取消"</string>
     <string name="yes" msgid="5362982303337969312">"确定"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"收件人:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"键入所需的 PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"手机连接到<xliff:g id="DEVICE_NAME">%1$s</xliff:g>时会暂时断开与 Wi-Fi 的连接。"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"手机连接到<xliff:g id="DEVICE_NAME">%1$s</xliff:g>时会暂时断开与 Wi-Fi 的连接。"</string>
     <string name="select_character" msgid="3365550120617701745">"插入字符"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"正在发送短信"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt;在发送大量短信。是否允许该应用继续发送短信?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"您已经 <xliff:g id="NUMBER_0">%d</xliff:g> 次错误地绘制了解锁图案。如果再尝试 <xliff:g id="NUMBER_1">%d</xliff:g> 次后仍不成功,系统就会要求您使用自己的电子邮件帐户解锁手机。"\n\n"请在 <xliff:g id="NUMBER_2">%d</xliff:g> 秒后重试。"</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"删除"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"将音量调高到安全级别以上?"\n"长时间聆听高音量可能会损伤听力。"</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"持续按住双指即可启用辅助功能。"</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"辅助功能已启用。"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"已取消辅助功能。"</string>
diff --git a/core/res/res/values-zh-rTW/strings.xml b/core/res/res/values-zh-rTW/strings.xml
index c13cdf7..53f578a 100644
--- a/core/res/res/values-zh-rTW/strings.xml
+++ b/core/res/res/values-zh-rTW/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"直接使用麥克風錄音。"</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"相機"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"直接使用相機拍照或錄影。"</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"您的應用程式資訊"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"影響裝置上其他應用程式的行為。"</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"桌布"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"文字動作"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"儲存空間即將用盡"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"部分系統功能可能無法運作"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"確定"</string>
     <string name="cancel" msgid="6442560571259935130">"取消"</string>
     <string name="yes" msgid="5362982303337969312">"確定"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"收件者:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"請輸入必要的 PIN:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"手機與 <xliff:g id="DEVICE_NAME">%1$s</xliff:g> 連線期間將暫時中斷 WiFi 連線"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"手機與 <xliff:g id="DEVICE_NAME">%1$s</xliff:g> 連線期間將暫時中斷 WiFi 連線"</string>
     <string name="select_character" msgid="3365550120617701745">"插入字元"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"傳送 SMS 簡訊"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"&lt;b&gt;&lt;/b&gt;「<xliff:g id="APP_NAME">%1$s</xliff:g>」正在傳送大量簡訊。您要允許這個應用程式繼續傳送簡訊嗎?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"您的解鎖圖形已畫錯 <xliff:g id="NUMBER_0">%d</xliff:g> 次,如果再嘗試 <xliff:g id="NUMBER_1">%d</xliff:g> 次仍未成功,系統就會要求您透過電子郵件帳戶解除手機的鎖定狀態。"\n\n"請在 <xliff:g id="NUMBER_2">%d</xliff:g> 秒後再試一次。"</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"移除"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"要將音量調高到安全等級以上嗎?"\n"長時間聆聽偏高音量可能會損害您的聽力。"</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"持續用兩指按住即可啟用協助工具。"</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"協助工具已啟用。"</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"協助工具已取消。"</string>
diff --git a/core/res/res/values-zu/strings.xml b/core/res/res/values-zu/strings.xml
index 6dc9e68..18f603c 100644
--- a/core/res/res/values-zu/strings.xml
+++ b/core/res/res/values-zu/strings.xml
@@ -200,6 +200,10 @@
     <string name="permgroupdesc_microphone" msgid="7106618286905738408">"Ukufinyelela okuqondile ku-microphone ukuze uqophe umsindo."</string>
     <string name="permgrouplab_camera" msgid="4820372495894586615">"Ikhamela"</string>
     <string name="permgroupdesc_camera" msgid="2933667372289567714">"Ukufinyelela okuqondile kukhamera ekuthwebuleni isithombe noma ividiyo."</string>
+    <!-- no translation found for permgrouplab_screenlock (8275500173330718168) -->
+    <skip />
+    <!-- no translation found for permgroupdesc_screenlock (7067497128925499401) -->
+    <skip />
     <string name="permgrouplab_appInfo" msgid="8028789762634147725">"Ulwazi lezinhlelo zakho zokusebenza"</string>
     <string name="permgroupdesc_appInfo" msgid="3950378538049625907">"Amandla okuthinta ukuziphatha kwezinhlelo zokusebenza kudivayisi yakho."</string>
     <string name="permgrouplab_wallpaper" msgid="3850280158041175998">"Isithombe sangemuva"</string>
@@ -1046,6 +1050,10 @@
     <string name="editTextMenuTitle" msgid="4909135564941815494">"Izenzo zombhalo"</string>
     <string name="low_internal_storage_view_title" msgid="5576272496365684834">"Isikhala sokulondoloza siyaphela"</string>
     <string name="low_internal_storage_view_text" msgid="6640505817617414371">"Eminye imisebenzi yohlelo ingahle ingasebenzi"</string>
+    <!-- no translation found for app_running_notification_title (4625479411505090209) -->
+    <skip />
+    <!-- no translation found for app_running_notification_text (3368349329989620597) -->
+    <skip />
     <string name="ok" msgid="5970060430562524910">"KULUNGILE"</string>
     <string name="cancel" msgid="6442560571259935130">"Khansela"</string>
     <string name="yes" msgid="5362982303337969312">"KULUNGILE"</string>
@@ -1139,7 +1147,9 @@
     <string name="wifi_p2p_to_message" msgid="248968974522044099">"Ku:"</string>
     <string name="wifi_p2p_enter_pin_message" msgid="5920929550367828970">"Faka i-PIN edingekayo:"</string>
     <string name="wifi_p2p_show_pin_message" msgid="8530563323880921094">"PIN:"</string>
-    <string name="wifi_p2p_frequency_conflict_message" msgid="7363907213787469151">"Ifoni izonqamuka okwesikhashana ku-Wi-Fi ngenkathi ixhumeke ku-<xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
+    <!-- no translation found for wifi_p2p_frequency_conflict_message (8012981257742232475) -->
+    <skip />
+    <string name="wifi_p2p_frequency_conflict_message" product="default" msgid="7363907213787469151">"Ifoni izonqamuka okwesikhashana ku-Wi-Fi ngenkathi ixhumeke ku-<xliff:g id="DEVICE_NAME">%1$s</xliff:g>"</string>
     <string name="select_character" msgid="3365550120617701745">"Faka uhlamvu"</string>
     <string name="sms_control_title" msgid="7296612781128917719">"Ithumela imiyalezo ye-SMS"</string>
     <string name="sms_control_message" msgid="3867899169651496433">"I-&lt;b&gt;<xliff:g id="APP_NAME">%1$s</xliff:g>&lt;/b&gt; ithumela inombolo enkulu yemilayezo ye-SMS. Ufuna ukuvumela lolu hlelo lokusebenza ukuqhubeka ukuthumela imilayezo?"</string>
@@ -1465,7 +1475,8 @@
     <string name="kg_failed_attempts_almost_at_login" product="default" msgid="1437638152015574839">"Ukulayisha ungenisa iphathini yakho yokuvula ngendlela engalungile izikhathi ezi-<xliff:g id="NUMBER_0">%d</xliff:g> Emva kweminye imizamo engu-<xliff:g id="NUMBER_1">%d</xliff:g>, uzocelwa ukuvula ifoni yakho usebenzisa ukungena ngemvume ku-Google"\n\n" Zame futhi emumva kwengu- <xliff:g id="NUMBER_2">%d</xliff:g> imizuzwana."</string>
     <string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" — "</string>
     <string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Susa"</string>
-    <string name="safe_media_volume_warning" product="default" msgid="7382971871993371648">"Khulisa ivolomu ngaphezu kweleveli yokuphepha?"\n"Ukulalela ngevolomu ephezulu izikhathi ezide kungalimaza ukuzwa kwakho."</string>
+    <!-- no translation found for safe_media_volume_warning (7324161939475478066) -->
+    <skip />
     <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Gcina ucindezele iminwe yakho emibili ukuze unike amandla ukufinyelela."</string>
     <string name="accessibility_enabled" msgid="1381972048564547685">"Ukufinyelela kunikwe amandla."</string>
     <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Ukufinyelela kukhanseliwe."</string>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 4a1d12d..5282df3 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2709,6 +2709,16 @@
              below and above child items.) The height of this will be the same as
              the height of the normal list item divider. -->
         <attr name="childDivider" format="reference|color" />
+        <!-- The start bound for an item's indicator. To specify a start bound specific to children,
+             use childIndicatorStart. -->
+        <attr name="indicatorStart" format="dimension" />
+        <!-- The end bound for an item's indicator. To specify a right bound specific to children,
+             use childIndicatorEnd. -->
+        <attr name="indicatorEnd" format="dimension" />
+        <!-- The start bound for a child's indicator. -->
+        <attr name="childIndicatorStart" format="dimension" />
+        <!-- The end bound for a child's indicator. -->
+        <attr name="childIndicatorEnd" format="dimension" />
     </declare-styleable>
     <declare-styleable name="Gallery">
         <attr name="gravity" />
@@ -3081,12 +3091,12 @@
         <!-- Specifies the formatting pattern used to show the time and/or date
              in 12-hour mode. Please refer to {@link android.text.format.DateFormat}
              for a complete description of accepted formatting patterns.
-             The default pattern is "h:mm aa". -->
+             The default pattern is a locale-appropriate equivalent of "h:mm a". -->
         <attr name="format12Hour" format="string"/>
         <!-- Specifies the formatting pattern used to show the time and/or date
              in 24-hour mode. Please refer to {@link android.text.format.DateFormat}
              for a complete description of accepted formatting patterns.
-             The default pattern is "k:mm". -->
+             The default pattern is a locale-appropriate equivalent of "H:mm". -->
         <attr name="format24Hour" format="string"/>
         <!-- Specifies the time zone to use. When this attribute is specified, the
              TextClock will ignore the time zone of the system. To use the user's
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index f1d8c03..6f59817 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -254,7 +254,11 @@
          not normally be used by applications; it requires that the system keep
          your application running at all times. -->
     <attr name="persistent" format="boolean" />
-    
+
+    <!-- Flag to specify if this application needs to be present for all users. Only pre-installed
+         applications can request this feature. Default value is false. -->
+    <attr name="requiredForAllUsers" format="boolean" />
+
     <!-- Flag indicating whether the application can be debugged, even when
          running on a device that is running in user mode. -->
     <attr name="debuggable" format="boolean" />
@@ -844,6 +848,7 @@
              for normal behavior. -->
         <attr name="hasCode" format="boolean" />
         <attr name="persistent" />
+        <attr name="requiredForAllUsers" />
         <!-- Specify whether the components in this application are enabled or not (that is, can be
              instantiated by the system).
              If "false", it overrides any component specific values (a value of "true" will not
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 6a8407f..cc50d8a 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1041,4 +1041,11 @@
     <string name="config_chooseTypeAndAccountActivity"
             >android/android.accounts.ChooseTypeAndAccountActivity</string>
 
+    <!-- Apps that are authorized to access shared accounts, overridden by product overlays -->
+    <string name="config_appsAuthorizedForSharedAccounts"></string>
+
+    <!-- Flag indicating that the media framework should not allow changes or mute on any
+         stream or master volumes. -->
+    <bool name="config_useFixedVolume">false</bool>
+
 </resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 42e5cf1..489a947 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2033,15 +2033,15 @@
      =============================================================== -->
   <eat-comment />
 
-  <public type="attr" name="mipMap" id="0x010103cd" />
-  <public type="attr" name="mirrorForRtl" id="0x010103ce" />
-
-    <!-- ===============================================================
-         Resources added in version 19 of the platform
-         =============================================================== -->
-      <eat-comment />
-
+  <public type="attr" name="mipMap" />
+  <public type="attr" name="mirrorForRtl" />
   <public type="attr" name="windowOverscan" />
+  <public type="attr" name="requiredForAllUsers" />
+  <public type="attr" name="indicatorStart"  />
+  <public type="attr" name="indicatorEnd" />
+  <public type="attr" name="childIndicatorStart" />
+  <public type="attr" name="childIndicatorEnd" />
+
   <public type="style" name="Theme.NoTitleBar.Overscan" />
   <public type="style" name="Theme.Light.NoTitleBar.Overscan" />
   <public type="style" name="Theme.Black.NoTitleBar.Overscan" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 447d94c..9e10661 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -474,6 +474,11 @@
     <string name="permgroupdesc_camera">Direct access to camera for image or video capture.</string>
 
     <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permgrouplab_screenlock">Lock screen</string>
+    <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permgroupdesc_screenlock">Ability to affect behavior of the lock screen on your device.</string>
+
+    <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgrouplab_appInfo">Your applications information</string>
     <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permgroupdesc_appInfo">Ability to affect behavior of other applications on your device.</string>
@@ -2984,6 +2989,15 @@
     <!-- If the device is getting low on internal storage, a notification is shown to the user.  This is the message of that notification. -->
     <string name="low_internal_storage_view_text">Some system functions may not work</string>
 
+    <!-- [CHAR LIMIT=NONE] Stub notification title for an app running a service that has provided
+         a bad bad notification for itself. -->
+    <string name="app_running_notification_title"><xliff:g id="app_name">%1$s</xliff:g>
+        running</string>
+    <!-- [CHAR LIMIT=NONE] Stub notification text for an app running a service that has provided
+         a bad bad notification for itself. -->
+    <string name="app_running_notification_text"><xliff:g id="app_name">%1$s</xliff:g>
+        is currently running</string>
+
     <!-- Preference framework strings. -->
     <string name="ok">OK</string>
     <!-- Preference framework strings. -->
@@ -3188,7 +3202,8 @@
     <string name="wifi_p2p_enter_pin_message">Type the required PIN: </string>
     <string name="wifi_p2p_show_pin_message">PIN: </string>
 
-    <string name="wifi_p2p_frequency_conflict_message">The phone will temporarily disconnect from Wi-Fi while it\'s connected to <xliff:g id="device_name">%1$s</xliff:g></string>
+    <string name="wifi_p2p_frequency_conflict_message" product="tablet">The tablet will temporarily disconnect from Wi-Fi while it\'s connected to <xliff:g id="device_name">%1$s</xliff:g></string>
+    <string name="wifi_p2p_frequency_conflict_message" product="default">The phone will temporarily disconnect from Wi-Fi while it\'s connected to <xliff:g id="device_name">%1$s</xliff:g></string>
 
     <!-- Name of the dialog that lets the user choose an accented character to insert -->
     <string name="select_character">Insert character</string>
@@ -4035,7 +4050,7 @@
     <!-- Message shown in dialog when user is attempting to set the music volume above the
     recommended maximum level for headphones -->
     <string name="safe_media_volume_warning" product="default">
-       "Raise volume above safe level?\nListening at high volume for long periods may damage your hearing."
+       "Raise volume above recommended level?\nListening at high volume for long periods may damage your hearing."
     </string>
 
     <!-- Text spoken when the user is performing a gesture that will enable accessibility. [CHAR LIMIT=none] -->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index d57d56a..81baaf8 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -277,6 +277,7 @@
   <java-symbol type="bool" name="config_camera_sound_forced" />
   <java-symbol type="bool" name="config_dontPreferApn" />
   <java-symbol type="bool" name="config_speed_up_audio_on_mt_calls" />
+  <java-symbol type="bool" name="config_useFixedVolume" />
 
   <java-symbol type="integer" name="config_cursorWindowSize" />
   <java-symbol type="integer" name="config_longPressOnPowerBehavior" />
@@ -330,6 +331,8 @@
   <java-symbol type="string" name="addToDictionary" />
   <java-symbol type="string" name="action_bar_home_description" />
   <java-symbol type="string" name="action_bar_up_description" />
+  <java-symbol type="string" name="app_running_notification_title" />
+  <java-symbol type="string" name="app_running_notification_text" />
   <java-symbol type="string" name="delete" />
   <java-symbol type="string" name="deleteText" />
   <java-symbol type="string" name="ellipsis_two_dots" />
@@ -865,6 +868,7 @@
   <java-symbol type="string" name="owner_name" />
   <java-symbol type="string" name="config_chooseAccountActivity" />
   <java-symbol type="string" name="config_chooseTypeAndAccountActivity" />
+  <java-symbol type="string" name="config_appsAuthorizedForSharedAccounts" />
 
 
   <java-symbol type="plurals" name="abbrev_in_num_days" />
@@ -1136,6 +1140,7 @@
   <java-symbol type="xml" name="power_profile" />
   <java-symbol type="xml" name="time_zones_by_country" />
   <java-symbol type="xml" name="sms_short_codes" />
+  <java-symbol type="xml" name="audio_assets" />
 
   <java-symbol type="raw" name="accessibility_gestures" />
   <java-symbol type="raw" name="incognito_mode_start_page" />
@@ -1322,6 +1327,7 @@
   <java-symbol type="id" name="keyguard_bouncer_frame" />
   <java-symbol type="id" name="app_widget_container" />
   <java-symbol type="id" name="view_flipper" />
+  <java-symbol type="id" name="carrier_text" />
   <java-symbol type="id" name="emergency_call_button" />
   <java-symbol type="id" name="keyguard_host_view" />
   <java-symbol type="id" name="delete_button" />
diff --git a/core/res/res/xml/audio_assets.xml b/core/res/res/xml/audio_assets.xml
new file mode 100644
index 0000000..746dbab
--- /dev/null
+++ b/core/res/res/xml/audio_assets.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2012, 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.
+*/
+-->
+
+<!-- Mapping of UI sound effects to audio assets under /system/media/audio/ui.
+     Modify this file to override default sound assets.
+     Currently only touch sounds can be overridden. Other groups can be added
+     in the future for other UI sounds like camera, lock, dock...
+-->
+
+<audio_assets version="1.0">
+    <group name="touch_sounds">
+        <asset id="FX_KEY_CLICK" file="Effect_Tick.ogg"/>
+        <asset id="FX_FOCUS_NAVIGATION_UP" file="Effect_Tick.ogg"/>
+        <asset id="FX_FOCUS_NAVIGATION_DOWN" file="Effect_Tick.ogg"/>
+        <asset id="FX_FOCUS_NAVIGATION_LEFT" file="Effect_Tick.ogg"/>
+        <asset id="FX_FOCUS_NAVIGATION_RIGHT" file="Effect_Tick.ogg"/>
+        <asset id="FX_KEYPRESS_STANDARD" file="KeypressStandard.ogg"/>
+        <asset id="FX_KEYPRESS_SPACEBAR" file="KeypressSpacebar.ogg"/>
+        <asset id="FX_KEYPRESS_DELETE" file="KeypressDelete.ogg"/>
+        <asset id="FX_KEYPRESS_RETURN" file="KeypressReturn.ogg"/>
+    </group>
+</audio_assets>
diff --git a/core/tests/benchmarks/src/com/android/internal/util/IndentingPrintWriterBenchmark.java b/core/tests/benchmarks/src/com/android/internal/util/IndentingPrintWriterBenchmark.java
new file mode 100644
index 0000000..34c73e8
--- /dev/null
+++ b/core/tests/benchmarks/src/com/android/internal/util/IndentingPrintWriterBenchmark.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2013 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.util;
+
+import com.google.android.collect.Lists;
+import com.google.caliper.SimpleBenchmark;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+public class IndentingPrintWriterBenchmark extends SimpleBenchmark {
+
+    private PrintWriter mDirect;
+    private IndentingPrintWriter mIndenting;
+
+    private Node mSimple;
+    private Node mComplex;
+
+    @Override
+    protected void setUp() throws IOException {
+        final FileOutputStream os = new FileOutputStream(new File("/dev/null"));
+        mDirect = new PrintWriter(os);
+        mIndenting = new IndentingPrintWriter(mDirect, "  ");
+
+        final Node manyChildren = Node.build("ManyChildren", Node.build("1"), Node.build("2"),
+                Node.build("3"), Node.build("4"), Node.build("5"), Node.build("6"), Node.build("7"),
+                Node.build("8"), Node.build("9"), Node.build("10"));
+
+        mSimple = Node.build("RED");
+        mComplex = Node.build("PARENT", Node.build("RED"), Node.build("GREEN",
+                Node.build("BLUE", manyChildren, manyChildren), manyChildren, manyChildren),
+                manyChildren);
+    }
+
+    @Override
+    protected void tearDown() {
+        mIndenting.close();
+        mIndenting = null;
+        mDirect = null;
+    }
+
+    public void timeSimpleDirect(int reps) {
+        for (int i = 0; i < reps; i++) {
+            mSimple.dumpDirect(mDirect, 0);
+        }
+    }
+
+    public void timeSimpleIndenting(int reps) {
+        for (int i = 0; i < reps; i++) {
+            mSimple.dumpIndenting(mIndenting);
+        }
+    }
+
+    public void timeComplexDirect(int reps) {
+        for (int i = 0; i < reps; i++) {
+            mComplex.dumpDirect(mDirect, 0);
+        }
+    }
+
+    public void timeComplexIndenting(int reps) {
+        for (int i = 0; i < reps; i++) {
+            mComplex.dumpIndenting(mIndenting);
+        }
+    }
+
+    public void timePairRaw(int reps) {
+        final int value = 1024;
+        for (int i = 0; i < reps; i++) {
+            mDirect.print("key=");
+            mDirect.print(value);
+            mDirect.print(" ");
+        }
+    }
+
+    public void timePairIndenting(int reps) {
+        final int value = 1024;
+        for (int i = 0; i < reps; i++) {
+            mIndenting.printPair("key", value);
+        }
+    }
+
+    private static class Node {
+        public String name;
+        public ArrayList<Node> children;
+
+        private static String[] sIndents = new String[] { "", "  ", "    ", "      ", "        " };
+
+        public static Node build(String name, Node... children) {
+            Node node = new Node();
+            node.name = name;
+            if (children != null && children.length > 0) {
+                node.children = Lists.newArrayList(children);
+            }
+            return node;
+        }
+
+        private void dumpSelf(PrintWriter pw) {
+            pw.print("Node ");
+            pw.print(name);
+            pw.print(" first ");
+            pw.print(512);
+            pw.print(" second ");
+            pw.print(1024);
+            pw.print(" third ");
+            pw.println(2048);
+        }
+
+        public void dumpDirect(PrintWriter pw, int depth) {
+            pw.print(sIndents[depth]);
+            dumpSelf(pw);
+
+            if (children != null) {
+                for (Node child : children) {
+                    child.dumpDirect(pw, depth + 1);
+                }
+            }
+
+            pw.println();
+        }
+
+        public void dumpIndenting(IndentingPrintWriter pw) {
+            dumpSelf(pw);
+
+            if (children != null) {
+                pw.increaseIndent();
+                for (Node child : children) {
+                    child.dumpIndenting(pw);
+                }
+                pw.decreaseIndent();
+            }
+
+            pw.println();
+        }
+    }
+}
diff --git a/core/tests/coretests/src/android/animation/AutoCancelTest.java b/core/tests/coretests/src/android/animation/AutoCancelTest.java
new file mode 100644
index 0000000..b1f88db
--- /dev/null
+++ b/core/tests/coretests/src/android/animation/AutoCancelTest.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2013 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.animation;
+
+import android.os.Handler;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
+
+public class AutoCancelTest extends ActivityInstrumentationTestCase2<BasicAnimatorActivity> {
+
+    boolean mAnimX1Canceled = false;
+    boolean mAnimXY1Canceled = false;
+    boolean mAnimX2Canceled = false;
+    boolean mAnimXY2Canceled = false;
+
+    private static final long START_DELAY = 100;
+    private static final long DELAYED_START_DURATION = 200;
+    private static final long FUTURE_TIMEOUT = 1000;
+
+    HashMap<Animator, Boolean> mCanceledMap = new HashMap<Animator, Boolean>();
+
+    public AutoCancelTest() {
+        super(BasicAnimatorActivity.class);
+    }
+
+    ObjectAnimator setupAnimator(long startDelay, String... properties) {
+        ObjectAnimator returnVal;
+        if (properties.length == 1) {
+            returnVal = ObjectAnimator.ofFloat(this, properties[0], 0, 1);
+        } else {
+            PropertyValuesHolder[] pvhArray = new PropertyValuesHolder[properties.length];
+            for (int i = 0; i < properties.length; i++) {
+                pvhArray[i] = PropertyValuesHolder.ofFloat(properties[i], 0, 1);
+            }
+            returnVal = ObjectAnimator.ofPropertyValuesHolder(this, pvhArray);
+        }
+        returnVal.setAutoCancel(true);
+        returnVal.setStartDelay(startDelay);
+        returnVal.addListener(mCanceledListener);
+        return returnVal;
+    }
+
+    private void setupAnimators(long startDelay, boolean startLater, final FutureWaiter future)
+    throws Exception {
+        // Animators to be auto-canceled
+        final ObjectAnimator animX1 = setupAnimator(startDelay, "x");
+        final ObjectAnimator animY1 = setupAnimator(startDelay, "y");
+        final ObjectAnimator animXY1 = setupAnimator(startDelay, "x", "y");
+        final ObjectAnimator animXZ1 = setupAnimator(startDelay, "x", "z");
+
+        animX1.start();
+        animY1.start();
+        animXY1.start();
+        animXZ1.start();
+
+        final ObjectAnimator animX2 = setupAnimator(0, "x");
+        animX2.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationStart(Animator animation) {
+                // We expect only animX1 to be canceled at this point
+                if (mCanceledMap.get(animX1) == null ||
+                        mCanceledMap.get(animX1) != true ||
+                        mCanceledMap.get(animY1) != null ||
+                        mCanceledMap.get(animXY1) != null ||
+                        mCanceledMap.get(animXZ1) != null) {
+                    future.set(false);
+                }
+            }
+        });
+
+        final ObjectAnimator animXY2 = setupAnimator(0, "x", "y");
+        animXY2.addListener(new AnimatorListenerAdapter() {
+            @Override
+            public void onAnimationStart(Animator animation) {
+                // We expect only animXY1 to be canceled at this point
+                if (mCanceledMap.get(animXY1) == null ||
+                        mCanceledMap.get(animXY1) != true ||
+                        mCanceledMap.get(animY1) != null ||
+                        mCanceledMap.get(animXZ1) != null) {
+                    future.set(false);
+                }
+
+            }
+
+            @Override
+            public void onAnimationEnd(Animator animation) {
+                // Release future if not done already via failures during start
+                future.release();
+            }
+        });
+
+        if (startLater) {
+            Handler handler = new Handler();
+            handler.postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    animX2.start();
+                    animXY2.start();
+                }
+            }, DELAYED_START_DURATION);
+        } else {
+            animX2.start();
+            animXY2.start();
+        }
+    }
+
+    @SmallTest
+    public void testAutoCancel() throws Exception {
+        final FutureWaiter future = new FutureWaiter();
+        getActivity().runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    setupAnimators(0, false, future);
+                } catch (Exception e) {
+                    future.setException(e);
+                }
+            }
+        });
+        assertTrue(future.get(FUTURE_TIMEOUT, TimeUnit.MILLISECONDS));
+    }
+
+    @SmallTest
+    public void testAutoCancelDelayed() throws Exception {
+        final FutureWaiter future = new FutureWaiter();
+        getActivity().runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    setupAnimators(START_DELAY, false, future);
+                } catch (Exception e) {
+                    future.setException(e);
+                }
+            }
+        });
+        assertTrue(future.get(FUTURE_TIMEOUT, TimeUnit.MILLISECONDS));
+    }
+
+    @SmallTest
+    public void testAutoCancelTestLater() throws Exception {
+        final FutureWaiter future = new FutureWaiter();
+        getActivity().runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    setupAnimators(0, true, future);
+                } catch (Exception e) {
+                    future.setException(e);
+                }
+            }
+        });
+        assertTrue(future.get(FUTURE_TIMEOUT, TimeUnit.MILLISECONDS));
+    }
+
+    @SmallTest
+    public void testAutoCancelDelayedTestLater() throws Exception {
+        final FutureWaiter future = new FutureWaiter();
+        getActivity().runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    setupAnimators(START_DELAY, true, future);
+                } catch (Exception e) {
+                    future.setException(e);
+                }
+            }
+        });
+        assertTrue(future.get(FUTURE_TIMEOUT, TimeUnit.MILLISECONDS));
+    }
+
+    private AnimatorListenerAdapter mCanceledListener = new AnimatorListenerAdapter() {
+        @Override
+        public void onAnimationCancel(Animator animation) {
+            mCanceledMap.put(animation, true);
+        }
+    };
+
+    public void setX(float x) {}
+
+    public void setY(float y) {}
+
+    public void setZ(float z) {}
+}
+
+
diff --git a/core/tests/coretests/src/android/animation/FutureWaiter.java b/core/tests/coretests/src/android/animation/FutureWaiter.java
index 320a1c2..0c65e20 100644
--- a/core/tests/coretests/src/android/animation/FutureWaiter.java
+++ b/core/tests/coretests/src/android/animation/FutureWaiter.java
@@ -23,14 +23,21 @@
  * {@link com.google.common.util.concurrent.AbstractFuture#set(Object)} method internally. It
  * also exposes the protected {@link AbstractFuture#setException(Throwable)} method.
  */
-public class FutureWaiter extends AbstractFuture<Void> {
+public class FutureWaiter extends AbstractFuture<Boolean> {
 
     /**
      * Release the Future currently waiting on
      * {@link com.google.common.util.concurrent.AbstractFuture#get()}.
      */
     public void release() {
-        super.set(null);
+        super.set(true);
+    }
+
+    /**
+     * Used to indicate failure (when the result value is false).
+     */
+    public void set(boolean result) {
+        super.set(result);
     }
 
     @Override
diff --git a/core/tests/coretests/src/android/webkit/WebkitTest.java b/core/tests/coretests/src/android/webkit/WebkitTest.java
index 17b4088..4685e3c 100644
--- a/core/tests/coretests/src/android/webkit/WebkitTest.java
+++ b/core/tests/coretests/src/android/webkit/WebkitTest.java
@@ -52,7 +52,7 @@
             date.setTime(time);
             c.setTime(date);
             index = dateSorter.getIndex(time);
-            Log.i(LOGTAG, "time: " + DateFormat.format("yyyy/MM/dd kk:mm:ss", c).toString() +
+            Log.i(LOGTAG, "time: " + DateFormat.format("yyyy/MM/dd HH:mm:ss", c).toString() +
                     " " + index + " " + dateSorter.getLabel(index));
         }
     }
diff --git a/docs/html/design/building-blocks/buttons.jd b/docs/html/design/building-blocks/buttons.jd
index 82e2477c..9e82ed4 100644
--- a/docs/html/design/building-blocks/buttons.jd
+++ b/docs/html/design/building-blocks/buttons.jd
@@ -1,4 +1,5 @@
 page.title=Buttons
+page.tags="button"
 @jd:body
 
 <p>A button consists of text and/or an image that clearly communicates what action will occur when the
diff --git a/docs/html/design/building-blocks/dialogs.jd b/docs/html/design/building-blocks/dialogs.jd
index a2ece2e..2f6ca27 100644
--- a/docs/html/design/building-blocks/dialogs.jd
+++ b/docs/html/design/building-blocks/dialogs.jd
@@ -1,4 +1,5 @@
 page.title=Dialogs
+page.tags="dialog","alert","popup","toast"
 @jd:body
 
 <p>Dialogs prompt the user for decisions or additional information required by the app to continue a
diff --git a/docs/html/design/building-blocks/grid-lists.jd b/docs/html/design/building-blocks/grid-lists.jd
index 775ebcc..69a43b1 100644
--- a/docs/html/design/building-blocks/grid-lists.jd
+++ b/docs/html/design/building-blocks/grid-lists.jd
@@ -1,4 +1,5 @@
 page.title=Grid Lists
+page.tags="gridview","layout"
 @jd:body
 
 <img src="{@docRoot}design/media/gridview_overview.png">
diff --git a/docs/html/design/building-blocks/lists.jd b/docs/html/design/building-blocks/lists.jd
index aaa86b8..16927a6 100644
--- a/docs/html/design/building-blocks/lists.jd
+++ b/docs/html/design/building-blocks/lists.jd
@@ -1,4 +1,5 @@
 page.title=Lists
+page.tags="listview","layout"
 @jd:body
 
 <p>Lists present multiple line items in a vertical arrangement. They can be used for data selection as
diff --git a/docs/html/design/building-blocks/pickers.jd b/docs/html/design/building-blocks/pickers.jd
index b328df9..47363d0 100644
--- a/docs/html/design/building-blocks/pickers.jd
+++ b/docs/html/design/building-blocks/pickers.jd
@@ -1,4 +1,5 @@
 page.title=Pickers
+page.tags="datepicker","timepicker"
 @jd:body
 
 <p>Pickers provide a simple way to select a single value from a set. In addition to touching the
diff --git a/docs/html/design/building-blocks/progress.jd b/docs/html/design/building-blocks/progress.jd
index 7342387..96cc1af 100644
--- a/docs/html/design/building-blocks/progress.jd
+++ b/docs/html/design/building-blocks/progress.jd
@@ -1,4 +1,5 @@
 page.title=Progress &amp; Activity
+page.tags="progressbar"
 @jd:body
 
 <p>Progress bars and activity indicators signal to users that something is happening that will take a moment.</p>
diff --git a/docs/html/design/building-blocks/scrolling.jd b/docs/html/design/building-blocks/scrolling.jd
index 7695157..66999f9 100644
--- a/docs/html/design/building-blocks/scrolling.jd
+++ b/docs/html/design/building-blocks/scrolling.jd
@@ -1,4 +1,5 @@
 page.title=Scrolling
+page.tags="scrollview","listview"
 @jd:body
 
 <p>Scrolling allows the user to navigate to content in the overflow using a swipe gesture. The
diff --git a/docs/html/design/building-blocks/seek-bars.jd b/docs/html/design/building-blocks/seek-bars.jd
index 3407ddd..9d38e36 100644
--- a/docs/html/design/building-blocks/seek-bars.jd
+++ b/docs/html/design/building-blocks/seek-bars.jd
@@ -1,4 +1,5 @@
 page.title=Seek Bars and Sliders
+page.tags="seekbar","progressbar"
 @jd:body
 
 <p>Interactive sliders make it possible to select a value from a continuous or discrete range of values
diff --git a/docs/html/design/building-blocks/spinners.jd b/docs/html/design/building-blocks/spinners.jd
index 279565f..8c80b91 100644
--- a/docs/html/design/building-blocks/spinners.jd
+++ b/docs/html/design/building-blocks/spinners.jd
@@ -1,4 +1,5 @@
 page.title=Spinners
+page.tags="spinner","drop down"
 @jd:body
 
 <p>Spinners provide a quick way to select one value from a set. In the default state, a spinner shows
diff --git a/docs/html/design/building-blocks/switches.jd b/docs/html/design/building-blocks/switches.jd
index d9cfd07..6386bdf 100644
--- a/docs/html/design/building-blocks/switches.jd
+++ b/docs/html/design/building-blocks/switches.jd
@@ -1,4 +1,5 @@
 page.title=Switches
+page.tags="switch","checkbox","radiobutton"
 @jd:body
 
 <p>Switches allow the user to select options. There are three kinds of switches: checkboxes, radio
diff --git a/docs/html/design/building-blocks/tabs.jd b/docs/html/design/building-blocks/tabs.jd
index 0a0f907..1fe2c62 100644
--- a/docs/html/design/building-blocks/tabs.jd
+++ b/docs/html/design/building-blocks/tabs.jd
@@ -1,4 +1,5 @@
 page.title=Tabs
+page.tags="tabs","action bar","navigation"
 @jd:body
 
 <img src="{@docRoot}design/media/tabs_overview.png">
diff --git a/docs/html/design/building-blocks/text-fields.jd b/docs/html/design/building-blocks/text-fields.jd
index 563f247..c1bed78 100644
--- a/docs/html/design/building-blocks/text-fields.jd
+++ b/docs/html/design/building-blocks/text-fields.jd
@@ -1,4 +1,5 @@
 page.title=Text Fields
+page.tags="text","edittext","input",
 @jd:body
 
 <p>Text fields allow the user to type text into your app. They can be either single line or multi-line.
diff --git a/docs/html/design/patterns/accessibility.jd b/docs/html/design/patterns/accessibility.jd
index 2c3333f..edf3843 100644
--- a/docs/html/design/patterns/accessibility.jd
+++ b/docs/html/design/patterns/accessibility.jd
@@ -1,4 +1,5 @@
 page.title=Accessibility
+page.tags="accessibility","navigation"
 @jd:body
 
 <p>One of Android's missions is to organize the world's information and make it universally accessible and useful. Accessibility is the measure of how successfully a product can be used by people with varying abilities. Our mission applies to all users-including people with disabilities such as visual impairment, color deficiency, hearing loss, and limited dexterity.</p>
diff --git a/docs/html/design/patterns/actionbar.jd b/docs/html/design/patterns/actionbar.jd
index 265ccde..da9c3c3 100644
--- a/docs/html/design/patterns/actionbar.jd
+++ b/docs/html/design/patterns/actionbar.jd
@@ -1,4 +1,5 @@
 page.title=Action Bar
+page.tags="actionbar","navigation"
 @jd:body
 
 <img src="{@docRoot}design/media/action_bar_pattern_overview.png">
diff --git a/docs/html/design/patterns/app-structure.jd b/docs/html/design/patterns/app-structure.jd
index 04af57b..e1bb819 100644
--- a/docs/html/design/patterns/app-structure.jd
+++ b/docs/html/design/patterns/app-structure.jd
@@ -1,4 +1,5 @@
 page.title=Application Structure
+page.tags="navigation","layout"
 @jd:body
 
 <p>Apps come in many varieties that address very different needs. For example:</p>
diff --git a/docs/html/design/patterns/confirming-acknowledging.jd b/docs/html/design/patterns/confirming-acknowledging.jd
index ce0631b..f2e88ec 100644
--- a/docs/html/design/patterns/confirming-acknowledging.jd
+++ b/docs/html/design/patterns/confirming-acknowledging.jd
@@ -1,4 +1,5 @@
 page.title=Confirming &amp; Acknowledging
+page.tags="dialog","toast"
 @jd:body
 
 <p>In some situations, when a user invokes an action in your app, it's a good idea to <em>confirm</em> or <em>acknowledge</em> that action through text.</p>
diff --git a/docs/html/design/patterns/gestures.jd b/docs/html/design/patterns/gestures.jd
index e579cee..3ef133d 100644
--- a/docs/html/design/patterns/gestures.jd
+++ b/docs/html/design/patterns/gestures.jd
@@ -1,4 +1,5 @@
 page.title=Gestures
+page.tags="gesture","input"
 @jd:body
 
 <p>Gestures allow users to interact with your app by manipulating the screen objects you provide. The
diff --git a/docs/html/design/patterns/multi-pane-layouts.jd b/docs/html/design/patterns/multi-pane-layouts.jd
index e607676..cbf29cb 100644
--- a/docs/html/design/patterns/multi-pane-layouts.jd
+++ b/docs/html/design/patterns/multi-pane-layouts.jd
@@ -1,4 +1,5 @@
 page.title=Multi-pane Layouts
+page.tags="tablet","navigation","layout","fragment"
 @jd:body
 
 <p>When writing an app for Android, keep in mind that Android devices come in many different screen
diff --git a/docs/html/design/patterns/navigation.jd b/docs/html/design/patterns/navigation.jd
index 656e6e5..36debbe 100644
--- a/docs/html/design/patterns/navigation.jd
+++ b/docs/html/design/patterns/navigation.jd
@@ -1,4 +1,5 @@
 page.title=Navigation with Back and Up
+page.tags="navigation","activity"
 @jd:body
 
 <p>Consistent navigation is an essential component of the overall user experience. Few things frustrate
diff --git a/docs/html/design/patterns/notifications.jd b/docs/html/design/patterns/notifications.jd
index 0665774..3ae827e 100644
--- a/docs/html/design/patterns/notifications.jd
+++ b/docs/html/design/patterns/notifications.jd
@@ -1,4 +1,5 @@
 page.title=Notifications
+page.tags="notification"
 @jd:body
 
 <p>The notification system allows your app to keep the user informed about events, such as new chat messages or a calendar event. Think of notifications as a news channel that alerts the user to important events as they happen or a log that chronicles events while the user is not paying attention.</p>
diff --git a/docs/html/design/patterns/selection.jd b/docs/html/design/patterns/selection.jd
index e9d22e6..682ce56 100644
--- a/docs/html/design/patterns/selection.jd
+++ b/docs/html/design/patterns/selection.jd
@@ -1,4 +1,5 @@
 page.title=Selection
+page.tags="actionmode","navigation"
 @jd:body
 
 <p>Android 3.0 changed the <em>long press</em> gesture&mdash;that is, a touch that's held in the same position for a moment&mdash;to be the global gesture to select data.. This affects the way you should
diff --git a/docs/html/design/patterns/settings.jd b/docs/html/design/patterns/settings.jd
index fef7585..f86cd39 100644
--- a/docs/html/design/patterns/settings.jd
+++ b/docs/html/design/patterns/settings.jd
@@ -1,4 +1,5 @@
 page.title=Settings
+page.tags="settings","preferences"
 @jd:body
 
 <p>Settings is a place in your app where users indicate their preferences for how your app should
diff --git a/docs/html/design/patterns/swipe-views.jd b/docs/html/design/patterns/swipe-views.jd
index daddd31..b86d990 100644
--- a/docs/html/design/patterns/swipe-views.jd
+++ b/docs/html/design/patterns/swipe-views.jd
@@ -1,4 +1,5 @@
 page.title=Swipe Views
+page.tags="viewpager","navigation"
 @jd:body
 
 <p>Efficient navigation is one of the cornerstones of a well-designed app. While apps are generally
diff --git a/docs/html/design/patterns/widgets.jd b/docs/html/design/patterns/widgets.jd
index 54726b1..a5979ce 100644
--- a/docs/html/design/patterns/widgets.jd
+++ b/docs/html/design/patterns/widgets.jd
@@ -1,4 +1,5 @@
 page.title=Widgets
+page.tags="appwidget"
 @jd:body
 
 <p>Widgets are an essential aspect of home screen customization. You can imagine them as "at-a-glance" views of an app's most important data and functionality that is accessible right from the user's home screen. Users can move widgets across their home screen panels, and, if supported, resize them to tailor the amount of information within a widget to their preference.</p>
diff --git a/docs/html/google/gcm/gcm.jd b/docs/html/google/gcm/gcm.jd
index 09ce95e..f8ba7b4 100644
--- a/docs/html/google/gcm/gcm.jd
+++ b/docs/html/google/gcm/gcm.jd
@@ -149,7 +149,16 @@
 it to the 3rd-party application server, which uses it to identify each device 
 that has registered to receive messages for a given Android application. In other words,
 a registration ID is tied to a particular Android application running on a particular
-device.</td>
+device.
+<br/>
+<br/>
+<strong>Note:</strong> If you use 
+<a href="https://developer.android.com/google/backup/index.html">backup and restore</a>,
+you should explicitly avoid backing up registration IDs. When you back up
+a device, apps back up shared prefs indiscriminately. If you don't explicitly
+exclude the GCM registration ID, it could get reused on a new device,
+which would cause delivery errors.
+</td>
   </tr>
   <tr>
     <td><strong>Google User Account</strong></td>
@@ -295,6 +304,13 @@
   </li>
 </ul>
 
+<p class="note"><strong>Note:</strong> This section describes how to
+write an app without using the 
+<a href="{@docRoot}reference/com/google/android/gcm/package-summary.html">helper libraries</a>. 
+For details on writing
+an app that uses the helper libraries (which is the recommended and
+simpler approach), see <a href="gs.html">GCM: Getting Started</a>.
+
 <h3 id="manifest">Creating the Manifest</h3>
 
 <p>Every Android application must have an <code>AndroidManifest.xml</code> file (with
@@ -585,6 +601,7 @@
 could not run properly. </li>
 </ul>
 
+
 <h2 id="server">Role of the 3rd-party Application Server</h2>
 
 <p>Before you can write client Android applications that use the GCM feature, you must
@@ -758,9 +775,14 @@
   <pre class="prettyprint">collapse_key=score_update&amp;time_to_live=108&amp;delay_while_idle=1&amp;data.score=4x8&amp;data.time=15:16.2342&amp;registration_id=42
   </pre>
 
-  <p class="note"><strong>Note:</strong> If your organization has a firewall that restricts the traffic to or from the Internet, you'll need to configure it to allow connectivity with GCM. The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but it sometimes uses 5229 and 5230.
-GCM doesn't provide specific IPs. It changes IPs frequently. We recommend against using ACLs but if you must use them, take a broad approach such as the method suggested in <a href="http://support.google.com/code/bin/answer.py?hl=en&answer=62464">this support link</a>.
-</p>
+<p class="note"><strong>Note:</strong> If your organization has a firewall 
+that restricts the traffic to or 
+from the Internet, you need to configure it to allow connectivity with GCM. 
+The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but 
+it sometimes uses 5229 and 5230. GCM doesn't provide specific IPs, so you should 
+allow your server to accept incoming connections from all IP addresses 
+contained in the IP blocks listed in Google's ASN of 15169.</p>
+
 
 <h4 id="response">Response format</h4>
 
@@ -770,7 +792,7 @@
   <li>The GCM server rejects the request.</li>
 </ul>
 
-<p>When the messge is processed successfully, the HTTP response has a 200 status and the body contains more information about the status of the message (including possible errors). When the request is rejected, 
+<p>When the message is processed successfully, the HTTP response has a 200 status and the body contains more information about the status of the message (including possible errors). When the request is rejected, 
 the HTTP response contains a non-200 status code (such as 400, 401, or 503).</p>
 
 <p>The following table summarizes the statuses that the HTTP response header might contain. Click the troubleshoot link for advice on how to deal with each type of error.</p>
@@ -825,7 +847,7 @@
     <td>Array of objects representing the status of the messages processed. The objects are listed in the same order as the request (i.e., for each registration ID in the request, its result is listed in the same index in the response) and they can have these fields:<br>
       <ul>
         <li><code>message_id</code>: String representing the message when it was successfully processed.</li>
-        <li><code>registration_id</code>: If set,  means that GCM processed the message but it has another canonical registration ID for that device, so sender should replace the IDs on future requests (otherwise they might be rejected). This field is never set if there is an error in the request.<br />
+        <li><code>registration_id</code>: If set,  means that GCM processed the message but it has another canonical registration ID for that device, so sender should replace the IDs on future requests (otherwise they might be rejected). This field is never set if there is an error in the request.
         </li>
         <li><code>error</code>: String describing an error that occurred while processing the message for that recipient. The possible values are the same as documented in the above table, plus &quot;Unavailable&quot;  (meaning GCM servers were busy and could not process the message for that  particular recipient, so it could be retried).</li>
     </ul></td>
diff --git a/docs/html/google/gcm/gs.jd b/docs/html/google/gcm/gs.jd
index 37ef684..5d34641 100644
--- a/docs/html/google/gcm/gs.jd
+++ b/docs/html/google/gcm/gs.jd
@@ -86,8 +86,15 @@
 
 <h2 id="libs">Install the Helper Libraries</h2>
 <p>To perform the steps described in the following sections, you must first install the 
-<a href="{@docRoot}reference/com/google/android/gcm/package-summary.html">helper libraries</a>. 
-From the SDK Manager, install <strong>Extras &gt; Google Cloud Messaging for Android Library</strong>. This creates a <code>gcm</code> directory under <code><em>YOUR_SDK_ROOT</em>/extras/google/</code> containing these subdirectories: <code>gcm-client</code>, <code>gcm-server</code>, <code>samples/gcm-demo-client</code>, <code>samples/gcm-demo-server</code>, and <code>samples/gcm-demo-appengine</code>.</p>
+<a href="{@docRoot}reference/com/google/android/gcm/package-summary.html">helper libraries</a>. Note that while using the helper libraries is recommended, it is not required. See the <a href="gcm.html#writing_apps">GCM Architectural Overview</a> for a description of how to write apps without using the helper libraries.
+
+<p>To install the helper libraries, choose 
+<strong>Extras &gt; Google Cloud Messaging for Android Library</strong>
+from the SDK Manager. This creates a <code>gcm</code> directory under
+<code><em>YOUR_SDK_ROOT</em>/extras/google/</code> containing these
+subdirectories: <code>gcm-client</code>, <code>gcm-server</code>,
+<code>samples/gcm-demo-client</code>, <code>samples/gcm-demo-server</code>,
+and <code>samples/gcm-demo-appengine</code>.</p>
 
 <p class="note"><strong>Note:</strong> If you don't see <strong>Extras &gt; Google Cloud Messaging for Android Library</strong> in the SDK Manager, make sure you are running version 20 or higher. Be sure to restart the SDK Manager after updating it.</p>
 
diff --git a/docs/html/guide/components/activities.jd b/docs/html/guide/components/activities.jd
index 2897804..1cbaa79 100644
--- a/docs/html/guide/components/activities.jd
+++ b/docs/html/guide/components/activities.jd
@@ -1,4 +1,5 @@
 page.title=Activities
+page.tags="activity","intent"
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/docs/html/guide/topics/graphics/hardware-accel.jd b/docs/html/guide/topics/graphics/hardware-accel.jd
index 01dd79a..9859c28 100644
--- a/docs/html/guide/topics/graphics/hardware-accel.jd
+++ b/docs/html/guide/topics/graphics/hardware-accel.jd
@@ -512,6 +512,13 @@
         <td class="s7">&#10007;</td>
         <td class="s11">&#10007;</td>
     </tr>
+    <tr>
+        <td class="s10">Local matrix on ComposeShader</td>
+        <td class="s7">&#10007;</td>
+        <td class="s11">&#10007;</td>
+        <td class="s7">&#10007;</td>
+        <td class="s11">&#10003;</td>
+    </tr>
     </tbody>
   </table>
 
diff --git a/docs/html/guide/topics/manifest/data-element.jd b/docs/html/guide/topics/manifest/data-element.jd
index 8fd91de..766d2d7 100644
--- a/docs/html/guide/topics/manifest/data-element.jd
+++ b/docs/html/guide/topics/manifest/data-element.jd
@@ -85,6 +85,9 @@
 The subtype can be the asterisk wildcard ({@code *}) to indicate that any 
 subtype matches.
 
+<p>It's common for an intent filter to declare a {@code &lt;data>} that includes
+only the {@code android:mimeType} attribute.</p>
+
 <p class="note">Note: MIME type matching in the Android framework is
 case-sensitive, unlike formal RFC MIME types.  As a result, you should always
 specify MIME types using lowercase letters.</p>
diff --git a/docs/html/guide/topics/providers/calendar-provider.jd b/docs/html/guide/topics/providers/calendar-provider.jd
index f53b062..5adc68c 100644
--- a/docs/html/guide/topics/providers/calendar-provider.jd
+++ b/docs/html/guide/topics/providers/calendar-provider.jd
@@ -605,7 +605,7 @@
 Uri updateUri = null;
 // The new title for the event
 values.put(Events.TITLE, &quot;Kickboxing&quot;); 
-myUri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
+updateUri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
 int rows = getContentResolver().update(updateUri, values, null, null);
 Log.i(DEBUG_TAG, &quot;Rows updated: &quot; + rows);  </pre>
 
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd
index 3115c8f..678a512 100644
--- a/docs/html/guide/topics/ui/actionbar.jd
+++ b/docs/html/guide/topics/ui/actionbar.jd
@@ -1,4 +1,5 @@
 page.title=Action Bar
+page.tags="action bar","menu"
 parent.title=User Interface
 parent.link=index.html
 @jd:body
diff --git a/docs/html/guide/topics/ui/binding.jd b/docs/html/guide/topics/ui/binding.jd
index e8b49d5..a4fd25c 100644
--- a/docs/html/guide/topics/ui/binding.jd
+++ b/docs/html/guide/topics/ui/binding.jd
@@ -10,13 +10,6 @@
     <li><a href="#FillingTheLayout">Filling the Layout with Data</a></li>
     <li><a href="#HandlingUserSelections">Handling User Selections</a></li>
   </ol>
-  
-  <h2>Related tutorials</h2>
-  <ol>
-    <li><a href="{@docRoot}resources/tutorials/views/hello-spinner.html">Spinner</a></li>
-    <li><a href="{@docRoot}resources/tutorials/views/hello-listview.html">List View</a></li>
-    <li><a href="{@docRoot}resources/tutorials/views/hello-gridview.html">Grid View</a></li>
-  </ol>
 </div>
 </div>
 
@@ -81,8 +74,8 @@
 </pre>
 
 <div class="special">
-<p>For more discussion on how to create different AdapterViews, read the following tutorials:
-<a href="{@docRoot}resources/tutorials/views/hello-spinner.html">Hello Spinner</a>,
-<a href="{@docRoot}resources/tutorials/views/hello-listview.html">Hello ListView</a>, and
-<a href="{@docRoot}resources/tutorials/views/hello-gridview.html">Hello GridView</a>.
+<p>For more discussion on how to create different AdapterViews, read the following guides:
+<a href="{@docRoot}guide/topics/ui/controls/spinner.html">Spinner</a>,
+<a href="{@docRoot}guide/topics/ui/layout/listview.html">List View</a>, and
+<a href="{@docRoot}guide/topics/ui/layout/gridview.html">Grid View</a>.
 </div>
diff --git a/docs/html/guide/topics/ui/ui-events.jd b/docs/html/guide/topics/ui/ui-events.jd
index 707d4b1..6d41b15 100644
--- a/docs/html/guide/topics/ui/ui-events.jd
+++ b/docs/html/guide/topics/ui/ui-events.jd
@@ -13,10 +13,6 @@
     <li><a href="#HandlingFocus">Handling Focus</a></li>
   </ol>
 
-  <h2>Related tutorials</h2>
-  <ol>
-    <li><a href="{@docRoot}resources/tutorials/views/hello-formstuff.html">Form Stuff</a></li>
-  </ol>
 </div>
 </div>
 
diff --git a/docs/html/guide/webapps/webview.jd b/docs/html/guide/webapps/webview.jd
index d2b2532..c87be06 100644
--- a/docs/html/guide/webapps/webview.jd
+++ b/docs/html/guide/webapps/webview.jd
@@ -33,11 +33,6 @@
   <li>{@link android.webkit.WebViewClient}</li>
 </ol>
 
-<h2>Related tutorials</h2>
-<ol>
-  <li><a href="{@docRoot}resources/tutorials/views/hello-webview.html">Web View</a></li>
-</ol>
-
 </div>
 </div>
 
diff --git a/docs/html/tools/sdk/ndk/index.jd b/docs/html/tools/sdk/ndk/index.jd
index cb4954b..74caaf4 100644
--- a/docs/html/tools/sdk/ndk/index.jd
+++ b/docs/html/tools/sdk/ndk/index.jd
@@ -1,17 +1,29 @@
 ndk=true
 page.template=sdk
 
-ndk.win_download=android-ndk-r8d-windows.zip
-ndk.win_bytes=327014028
-ndk.win_checksum=d78ec3d4ec15ad3b18b9f488a5763c23
+ndk.mac64_download=android-ndk-r8e-darwin-x86_64.tar.bz2
+ndk.mac64_bytes=508419298
+ndk.mac64_checksum=efac96fab20e6ddb1311d6ba5648ce72
 
-ndk.mac_download=android-ndk-r8d-darwin-x86.tar.bz2
-ndk.mac_bytes=308328942
-ndk.mac_checksum=5cd9ef9fb7e03943ee8c9e147e42e571
+ndk.mac32_download=android-ndk-r8e-darwin-x86.tar.bz2
+ndk.mac32_bytes=496238878
+ndk.mac32_checksum=e17e707464c45c0d5615e4d0ae6a5cf7
 
-ndk.linux_download=android-ndk-r8d-linux-x86.tar.bz2
-ndk.linux_bytes=254644383
-ndk.linux_checksum=e1fa0379a3feb59f2f0865f1a90bd382
+ndk.linux64_download=android-ndk-r8e-linux-x86_64.tar.bz2
+ndk.linux64_bytes=466853553
+ndk.linux64_checksum=fa812352956067e7a9eefc0274675e9a
+
+ndk.linux32_download=android-ndk-r8e-linux-x86.tar.bz2
+ndk.linux32_bytes=461526099
+ndk.linux32_checksum=26d774b0884bcd98de08eb4de41ab532
+
+ndk.win64_download=android-ndk-r8e-windows-x86_64.zip
+ndk.win64_bytes=461298980
+ndk.win64_checksum=11eb99b3b56fc86d9d231ebff5c41db3
+
+ndk.win32_download=android-ndk-r8e-windows-x86.zip
+ndk.win32_bytes=434701805
+ndk.win32_checksum=fb41ed2bff5610b14a7b6f085ab86213
 
 page.title=Android NDK
 @jd:body
@@ -250,6 +262,222 @@
 <div class="toggle-content opened">
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img"
+      alt="">Android NDK, Revision 8e</a> <em>(March 2013)</em>
+  </p>
+
+  <div class="toggle-content-toggleme">
+    <dl>
+      <dt>Important changes:</dt>
+      <dd>
+        <ul>
+          <li>Added 64-bit host toolchain set (package name suffix {@code *-x86_64.*}). For more
+            information, see {@code CHANGES.HTML} and {@code NDK-BUILD.html}.</li>
+          <li>Added Clang 3.2 compiler. GCC 4.6 is still the default. For information on using the
+            Clang compiler, see {@code CHANGES.HTML}.</li>
+          <li>Added static code analyzer for Linux/MacOSX hosts. For information on using the
+            analyzer, see {@code CHANGES.HTML}.</li>
+          <li>Added MCLinker for Linux/MacOSX hosts as an experimental feature. The {@code ld.gold}
+            linker is the default where available, so you must explicitly enable it. For more
+            information, see {@code CHANGES.HTML}.</li>
+          <li>Updated ndk-build to use topological sort for module dependencies, which means the
+            build automatically sorts out the order of libraries specified in
+            {@code LOCAL_STATIC_LIBRARIES}, {@code LOCAL_WHOLE_STATIC_LIBRARIES} and
+            {@code LOCAL_SHARED_LIBRARIES}. For more information, see {@code CHANGES.HTML}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=39378">Issue 39378</a>)</li>
+        </ul>
+      </dd>
+
+      <dt>Important bug fixes:</dt>
+      <dd>
+        <ul>
+          <li>Fixed build script to build all toolchains in {@code -O2}. Toolchains in previous
+            releases were incorrectly built without optimization.</li>
+          <li>Fixed build script which unconditionally builds Clang/llvm for MacOSX in 64-bit.</li>
+          <li>Fixed GCC 4.6/4.7 internal compiler error:
+            {@code gen_thumb_movhi_clobber at config/arm/arm.md:5832}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=52732">Issue 52732</a>)</li>
+          <li>Fixed build problem where GCC/ARM 4.6/4.7 fails to link code using 64-bit atomic
+            built-in functions.
+            (<a href="http://code.google.com/p/android/issues/detail?id=41297">Issue 41297</a>)</li>
+          <li>Fixed GCC 4.7 linker DIV usage mismatch errors.
+          (<a href="http://sourceware.org/ml/binutils/2012-12/msg00202.html">Sourceware Issue</a>)
+          <li>Fixed GCC 4.7 internal compiler error {@code build_data_member_initialization, at
+            cp/semantics.c:5790}.</li>
+          <li>Fixed GCC 4.7 internal compiler error {@code redirect_eh_edge_1, at tree-eh.c:2214}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=52909">Issue 52909</a>)</li>
+          <li>Fixed a GCC 4.7 segfault.
+            (<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55245">GCC Issue</a>)</li>
+          <li>Fixed {@code &lt;chrono&gt;} clock resolution and enabled {@code steady_clock}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=39680">Issue 39680</a>)</li>
+          <li>Fixed toolchain to enable {@code _GLIBCXX_HAS_GTHREADS} for GCC 4.7 libstdc++.
+            (<a href="http://code.google.com/p/android/issues/detail?id=41770">Issue 41770</a>,
+             <a href="http://code.google.com/p/android/issues/detail?id=41859">Issue 41859</a>)</li>
+          <li>Fixed problem with the X86 MXX/SSE code failing to link due to missing
+            {@code posix_memalign}.
+            (<a href="https://android-review.googlesource.com/#/c/51872">Change 51872</a>)</li>
+          <li>Fixed GCC4.7/X86 segmentation fault in {@code i386.c}, function
+            {@code distance_non_agu_define_in_bb()}.
+            (<a href="https://android-review.googlesource.com/#/c/50383">Change 50383</a>)</li>
+          <li>Fixed GCC4.7/X86 to restore earlier {@code cmov} behavior.
+            (<a href="http://gcc.gnu.org/viewcvs?view=revision&revision=193554">GCC Issue</a>)</li>
+          <li>Fixed handling NULL return value of {@code setlocale()} in libstdc++/GCC4.7.
+            (<a href="http://code.google.com/p/android/issues/detail?id=46718">Issue 46718</a>)
+          <li>Fixed {@code ld.gold} runtime undefined reference to {@code __exidx_start} and
+            {@code __exidx_start_end}.
+            (<a href="https://android-review.googlesource.com/#/c/52134">Change 52134</a>)</li>
+          <li>Fixed Clang 3.1 internal compiler error when using Eigen library.
+            (<a href="http://code.google.com/p/android/issues/detail?id=41246">Issue 41246</a>)</li>
+          <li>Fixed Clang 3.1 internal compiler error including {@code &lt;chrono&gt;} in C++11 mode.
+            (<a href="http://code.google.com/p/android/issues/detail?id=39600">Issue 39600</a>)</li>
+          <li>Fixed Clang 3.1 internal compiler error when generating object code for a method
+            call to a uniform initialized {@code rvalue}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=41387">Issue 41387</a>)</li>
+          <li>Fixed Clang 3.1/X86 stack realignment.
+            (<a href="https://android-review.googlesource.com/#/c/52154">Change 52154</a>)</li>
+          <li>Fixed problem with GNU Debugger (GDB) SIGILL when debugging on Android 4.1.2.
+            (<a href="http://code.google.com/p/android/issues/detail?id=40941">Issue 40941</a>)</li>
+          <li>Fixed problem where GDB cannot set {@code source:line} breakpoints when symbols contain
+            long, indirect file paths.
+            (<a href="http://code.google.com/p/android/issues/detail?id=42448">Issue 42448</a>)</li>
+          <li>Fixed GDB {@code read_program_header} for MIPS PIE executables.
+            (<a href="https://android-review.googlesource.com/#/c/49592">Change 49592</a>)</li>
+          <li>Fixed {@code STLport} segmentation fault in {@code uncaught_exception()}.
+            (<a href="https://android-review.googlesource.com/#/c/50236">Change 50236</a>)</li>
+          <li>Fixed {@code STLport} bus error in exception handling due to unaligned access of
+            {@code DW_EH_PE_udata2}, {@code DW_EH_PE_udata4}, and {@code DW_EH_PE_udata8}.</li>
+          <li>Fixed Gabi++ infinite recursion problem with {@code nothrow new[]} operator.
+            (<a href="http://code.google.com/p/android/issues/detail?id=52833">Issue 52833</a>)</li>
+          <li>Fixed Gabi++ wrong offset to exception handler pointer.
+            (<a href="https://android-review.googlesource.com/#/c/53446">Change 53446</a>)</li>
+          <li>Removed Gabi++ redundant free on exception object
+            (<a href="https://android-review.googlesource.com/#/c/53447">Change 53447</a>)</li>
+        </ul>
+      </dd>
+
+      <dt>Other bug fixes:</dt>
+      <dd>
+        <ul>
+          <li>Fixed NDK headers:
+            <ul>
+              <li>Removed redundant definitions of {@code size_t}, {@code ssize_t}, and
+                {@code ptrdiff_t}.</li>
+              <li>Fixed MIPS and ARM {@code fenv.h} header.</li>
+              <li>Fixed {@code stddef.h} to not redefine {@code offsetof} since it already exists
+                in the toolchain.</li>
+              <li>Fixed {@code elf.h} to contain {@code Elf32_auxv_t} and {@code Elf64_auxv_t}.
+                (<a href="http://code.google.com/p/android/issues/detail?id=38441">Issue 38441</a>)
+                </li>
+              <li>Fixed the {@code #ifdef} C++ definitions in the
+                {@code OpenSLES_AndroidConfiguration.h} header file.
+                (<a href="http://code.google.com/p/android/issues/detail?id=53163">Issue 53163</a>)
+                </li>
+            </ul>
+          </li>
+          <li>Fixed {@code STLport} to abort after out of memory error instead of silently exiting.
+            </li>
+          <li>Fixed system and Gabi++ headers to be able to compile with API level 8 and lower.</li>
+          <li>Fixed {@code cpufeatures} to not parse {@code /proc/self/auxv}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=43055">Issue 43055</a>)</li>
+          <li>Fixed {@code ld.gold} to not depend on host libstdc++ and on Windows platforms,
+            to not depend on the {@code libgcc_sjlj_1.dll} library.</li>
+          <li>Fixed Clang 3.1 which emits inconsistent register list in {@code .vsave} and fails
+            assembler.
+            (<a href="https://android-review.googlesource.com/#/c/49930">Change 49930</a>)</li>
+          <li>Fixed Clang 3.1 to be able to compile libgabi++ and pass the {@code test-stlport}
+            tests for MIPS build targets.
+            (<a href="https://android-review.googlesource.com/#/c/51961">Change 51961</a>)</li>
+          <li>Fixed Clang 3.1 to only enable exception by default for C++, not for C.</li>
+          <li>Fixed several issues in Clang 3.1 to pass most GNU exception tests.</li>
+          <li>Fixed scripts {@code clang} and {@code clang++} in standalone NDK compiler to detect
+            {@code -cc1} and to not specify {@code -target} when found.</li>
+          <li>Fixed {@code ndk-build} to observe {@code NDK_APP_OUT} set in {@code Application.mk}.
+            </li>
+          <li>Fixed X86 {@code libc.so} and {@code lib.a} which were missing the {@code sigsetjmp}
+            and {@code siglongjmp} functions already declared in {@code setjmp.h}.
+            (<a href="http://code.google.com/p/android/issues/detail?id=19851">Issue 19851</a>)</li>
+          <li>Patched GCC 4.4.3/4.6/4.7 libstdc++ to work with Clang in C++ 11.
+            (<a href="http://clang.llvm.org/cxx_status.html">Clang Issue</a>)</li>
+          <li>Fixed cygwin path in argument passed to {@code HOST_AWK}.</li>
+          <li>Fixed {@code ndk-build} script warning in windows when running from project's JNI
+            directory.
+            (<a href="http://code.google.com/p/android/issues/detail?id=40192">Issue 40192</a>)</li>
+          <li>Fixed problem where the {@code ndk-build} script does not build if makefile has
+            trailing whitespace in the {@code LOCAL_PATH} definition.
+            (<a href="http://code.google.com/p/android/issues/detail?id=42841">Issue 42841</a>)</li>
+        </ul>
+      </dd>
+
+      <dt>Other changes:</dt>
+      <dd>
+        <ul>
+          <li>Enabled threading support in GCC/MIPS toolchain.</li>
+          <li>Updated GCC exception handling helpers {@code __cxa_begin_cleanup} and
+            {@code __cxa_type_match} to have <em>default</em> visibility from the previous
+            <em>hidden</em> visibility in GNU libstdc++. For more information, see
+            {@code CHANGES.HTML}.</li>
+          <li>Updated build scripts so that Gabi++ and STLport static libraries are now built with
+            hidden visibility except for exception handling helpers.</li>
+          <li>Updated build so that {@code STLport} is built for ARM in Thumb mode.</li>
+          <li>Added support for {@code std::set_new_handler} in Gabi++.
+            (<a href="http://code.google.com/p/android/issues/detail?id=52805">Issue 52805</a>)</li>
+          <li>Enabled {@code FUTEX} system call in GNU libstdc++.</li>
+          <li>Updated {@code ndk-build} so that it  no longer copies prebuilt static library to
+            a project's {@code obj/local/&lt;abi&gt;/} directory.
+            (<a href="http://code.google.com/p/android/issues/detail?id=40302">Issue 40302</a>)</li>
+          <li>Removed {@code __ARM_ARCH_5*__} from ARM {@code toolchains/*/setup.mk} script.
+            (<a href="http://code.google.com/p/android/issues/detail?id=21132">Issue 21132</a>)</li>
+          <li>Built additional GNU libstdc++ libraries in thumb for ARM.</li>
+          <li>Enabled MIPS floating-point {@code madd/msub/nmadd/nmsub/recip/rsqrt}
+            instructions with 32-bit FPU.</li>
+          <li>Enabled graphite loop optimizer in GCC 4.6 and 4.7 to allow more optimizations:
+            {@code -fgraphite}, {@code -fgraphite-identity}, {@code -floop-block}, {@code -floop-flatten},
+            {@code -floop-interchange}, {@code -floop-strip-mine}, {@code -floop-parallelize-all},
+            and {@code -ftree-loop-linear}.
+            (<a href="http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">info</a>)</li>
+          <li>Enabled {@code polly} for Clang 3.1 on Linux and Max OS X 32-bit hosts which analyzes
+            and optimizes memory access. (<a href="http://polly.llvm.org">info</a>)</li>
+          <li>Enabled {@code -flto} in GCC 4.7, 4.6, Clang 3.2 and Clang 3.1 on linux (Clang LTO
+            via LLVMgold.so). MIPS compiler targets are not supported because {@code ld.gold}
+            is not available.</li>
+          <li>Enabled {@code --plugin} and {@code --plugin-opt} for {@code ld.gold} in GCC 4.6/4.7.
+            </li>
+          <li>Enabled {@code --text-reorder} for {@code ld.gold} in GCC 4.7.</li>
+          <li>Configured GNU libstdc++ with {@code _GLIBCXX_USE_C99_MATH} which undefines the
+            {@code isinf} script in the bionic header. For more information, see
+            {@code CHANGES.html}.</li>
+          <li>Added {@code APP_LDFLAGS} to the build scripts. For more information, see
+            {@code ANDROID-MK.html}.</li>
+          <li>Updated build scripts to allow {@code NDK_LOG=0} to disable the {@code NDK_LOG}.</li>
+          <li>Updated build scripts to allow {@code NDK_HOST_32BIT=0} to disable the host developer
+            environment 32-bit toolchain.</li>
+          <li>Changed the default GCC/X86 flags {@code -march=} and {@code -mtune=} from
+            {@code pentiumpro} and {@code generic} to {@code i686} and {@code atom}.</li>
+          <li>Enhanced toolchain build scripts:
+            <ul>
+              <li>Fixed a race condition in {@code build-gcc.sh} for the {@code mingw} build type
+                which was preventing a significant amount of parallel build processing.</li>
+              <li>Updated {@code build-gabi++.sh} and {@code build-stlport.sh} so they can now run
+                from the NDK package.
+                (<a href="http://code.google.com/p/android/issues/detail?id=52835">Issue 52835</a>)
+                </li>
+              <li>Fixed {@code run-tests.sh} in the {@code MSys} utilities collection.</li>
+              <li>Improved 64-bit host toolchain and Canadian Cross build support.</li>
+              <li>Updated {@code build-mingw64-toolchain.sh} script to more recent version.</li>
+              <li>Added option to build {@code libgnustl_static.a} and {@code stlport_static.a}
+                without hidden visibility.</li>
+            </ul>
+          </li>
+        </ul>
+
+      </dd>
+    </dl>
+  </div>
+</div>
+
+
+<div class="toggle-content closed">
+  <p><a href="#" onclick="return toggleContent(this)">
+    <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
       alt="">Android NDK, Revision 8d</a> <em>(December 2012)</em>
   </p>
 
@@ -769,7 +997,7 @@
       <dd>
         <ul>
           <li>Added GCC 4.6 toolchain ({@code binutils} 2.21 with {@code gold} and GDB 7.3.x) to
-co-exist with the original GCC 4.4.3 toolchain ({@code binutils} 2.19 and GDB 6.6).</p>
+co-exist with the original GCC 4.4.3 toolchain ({@code binutils} 2.19 and GDB 6.6).
             <ul>
               <li>GCC 4.6 is now the default toolchain. You may set {@code
 NDK_TOOLCHAIN_VERSION=4.4.3} in {@code Application.mk} to select the original one.</li>
@@ -816,8 +1044,9 @@
 following options:
 <pre>
 LOCAL_DISABLE_NO_EXECUTE=true  # disable "--noexecstack" and "-z noexecstack"
-DISABLE_RELRO=true             # disable "-z relro" and "-z now"</li>
+DISABLE_RELRO=true             # disable "-z relro" and "-z now"
 </pre>
+                  </li>
                 </ol>
                 <p>See {@code docs/ANDROID-MK.html} for more details.</p>
               </li>
@@ -826,7 +1055,7 @@
 
           <li>Added branding for Android executables with the {@code .note.ABI-tag} section (in
 {@code crtbegin_static/dynamic.o}) so that debugging tools can act accordingly. The structure
-member and values are defined as follows:</p>
+member and values are defined as follows:
 <pre>
 static const struct {
   int32_t namesz;  /* = 4,  sizeof ("GNU") */
@@ -1621,10 +1850,11 @@
           <li>Fixed a bug that caused the build to fail if <code>LOCAL_ARM_NEON</code> was set to
           true (typo in <code>build/core/build-binary.mk</code>).</li>
 
-          <li>Fixed a bug that prevented the compilation of </code>.s</code> assembly files
+          <li>Fixed a bug that prevented the compilation of <code>.s</code> assembly files
           (<code>.S</code> files were okay).</li>
         </ul>
       </dd>
+    </dl>
   </div>
 </div>
 
diff --git a/docs/html/training/animation/index.jd b/docs/html/training/animation/index.jd
index 9cc7e6c..b2815fc 100644
--- a/docs/html/training/animation/index.jd
+++ b/docs/html/training/animation/index.jd
@@ -1,4 +1,5 @@
 page.title=Adding Animations
+page.tags="animation","views","layout","user interface"
 trainingnavtop=true
 startpage=true
 
diff --git a/docs/html/training/basics/data-storage/databases.jd b/docs/html/training/basics/data-storage/databases.jd
index 8b11983..9976bb1 100644
--- a/docs/html/training/basics/data-storage/databases.jd
+++ b/docs/html/training/basics/data-storage/databases.jd
@@ -1,6 +1,4 @@
 page.title=Saving Data in SQL Databases
-parent.title=Data Storage
-parent.link=index.html
 
 trainingnavtop=true
 previous.title=Saving Data in Files
diff --git a/docs/html/training/basics/data-storage/files.jd b/docs/html/training/basics/data-storage/files.jd
index dd081a6..52bea4c 100644
--- a/docs/html/training/basics/data-storage/files.jd
+++ b/docs/html/training/basics/data-storage/files.jd
@@ -1,6 +1,4 @@
 page.title=Saving Files
-parent.title=Data Storage
-parent.link=index.html
 
 trainingnavtop=true
 
diff --git a/docs/html/training/basics/data-storage/index.jd b/docs/html/training/basics/data-storage/index.jd
index 4334936..4ccad75 100644
--- a/docs/html/training/basics/data-storage/index.jd
+++ b/docs/html/training/basics/data-storage/index.jd
@@ -1,4 +1,5 @@
 page.title=Saving Data
+page.tags="data storage","files","sql","database","preferences"
 
 trainingnavtop=true
 startpage=true
diff --git a/docs/html/training/basics/data-storage/shared-preferences.jd b/docs/html/training/basics/data-storage/shared-preferences.jd
index 099da67..a6717c4 100644
--- a/docs/html/training/basics/data-storage/shared-preferences.jd
+++ b/docs/html/training/basics/data-storage/shared-preferences.jd
@@ -1,6 +1,4 @@
 page.title=Saving Key-Value Sets
-parent.title=Data Storage
-parent.link=index.html
 
 trainingnavtop=true
 
diff --git a/docs/html/training/basics/fragments/communicating.jd b/docs/html/training/basics/fragments/communicating.jd
index eb9b368..b30045d 100644
--- a/docs/html/training/basics/fragments/communicating.jd
+++ b/docs/html/training/basics/fragments/communicating.jd
@@ -1,10 +1,6 @@
 page.title=Communicating with Other Fragments
-parent.title=Building a Dynamic UI with Fragments
-parent.link=index.html
 
 trainingnavtop=true
-previous.title=Building a Flexible UI
-previous.link=fragment-ui.html
 
 @jd:body
 
diff --git a/docs/html/training/basics/fragments/creating.jd b/docs/html/training/basics/fragments/creating.jd
index 0646230..b5df4e1 100644
--- a/docs/html/training/basics/fragments/creating.jd
+++ b/docs/html/training/basics/fragments/creating.jd
@@ -1,12 +1,6 @@
 page.title=Creating a Fragment
-parent.title=Building a Dynamic UI with Fragments
-parent.link=index.html
 
 trainingnavtop=true
-previous.title=Using the Android Support Library
-previous.link=support-lib.html
-next.title=Building a Flexible UI
-next.link=fragment-ui.html
 
 @jd:body
 
diff --git a/docs/html/training/basics/fragments/fragment-ui.jd b/docs/html/training/basics/fragments/fragment-ui.jd
index 4ec4de5..d648938 100644
--- a/docs/html/training/basics/fragments/fragment-ui.jd
+++ b/docs/html/training/basics/fragments/fragment-ui.jd
@@ -1,12 +1,6 @@
 page.title=Building a Flexible UI
-parent.title=Building a Dynamic UI with Fragments
-parent.link=index.html
 
 trainingnavtop=true
-previous.title=Create a Fragment
-previous.link=creating.html
-next.title=Communicating with Other Fragments
-next.link=communicating.html
 
 @jd:body
 
diff --git a/docs/html/training/basics/fragments/index.jd b/docs/html/training/basics/fragments/index.jd
index bc93f43..1b82f2c 100644
--- a/docs/html/training/basics/fragments/index.jd
+++ b/docs/html/training/basics/fragments/index.jd
@@ -1,9 +1,8 @@
 page.title=Building a Dynamic UI with Fragments
+page.tags="fragments", "user interface", "support library"
 
 trainingnavtop=true
 startpage=true
-next.title=Using the Android Support Library
-next.link=support-lib.html
 
 @jd:body
 
diff --git a/docs/html/training/basics/fragments/support-lib.jd b/docs/html/training/basics/fragments/support-lib.jd
index cc867d3..b097de1 100644
--- a/docs/html/training/basics/fragments/support-lib.jd
+++ b/docs/html/training/basics/fragments/support-lib.jd
@@ -1,10 +1,7 @@
 page.title=Using the Support Library
-parent.title=Building a Dynamic UI with Fragments
-parent.link=index.html
+page.tags="support library"
 
 trainingnavtop=true
-next.title=Creating a Fragment
-next.link=creating.html
 
 @jd:body
 
diff --git a/docs/html/training/basics/intents/index.jd b/docs/html/training/basics/intents/index.jd
index d94ff015..8876a33 100644
--- a/docs/html/training/basics/intents/index.jd
+++ b/docs/html/training/basics/intents/index.jd
@@ -1,9 +1,8 @@
 page.title=Interacting with Other Apps
+page.tags="intents","activity"
 
 trainingnavtop=true
 startpage=true
-next.title=Sending the User to Another App
-next.link=sending.html
 
 @jd:body
 
diff --git a/docs/html/training/basics/network-ops/index.jd b/docs/html/training/basics/network-ops/index.jd
index b213c03..cb3a390 100644
--- a/docs/html/training/basics/network-ops/index.jd
+++ b/docs/html/training/basics/network-ops/index.jd
@@ -1,4 +1,5 @@
 page.title=Performing Network Operations
+page.tags="network","wireless"
 
 trainingnavtop=true
 startpage=true
diff --git a/docs/html/training/basics/supporting-devices/index.jd b/docs/html/training/basics/supporting-devices/index.jd
index 49ea81d..1e3eb42 100644
--- a/docs/html/training/basics/supporting-devices/index.jd
+++ b/docs/html/training/basics/supporting-devices/index.jd
@@ -1,9 +1,8 @@
 page.title=Supporting Different Devices
+page.tags="resources","screens","versions","localization"
 
 trainingnavtop=true
 startpage=true
-next.title=Supporting Multiple Languages
-next.link=languages.html
 
 @jd:body
 
diff --git a/docs/html/training/camera/index.jd b/docs/html/training/camera/index.jd
index 282bed8..fa754a0 100644
--- a/docs/html/training/camera/index.jd
+++ b/docs/html/training/camera/index.jd
@@ -1,4 +1,5 @@
 page.title=Capturing Photos
+page.tags="camera","video"
 
 trainingnavtop=true
 startpage=true
diff --git a/docs/html/training/cloudsync/index.jd b/docs/html/training/cloudsync/index.jd
index 91885e8..55b275b 100644
--- a/docs/html/training/cloudsync/index.jd
+++ b/docs/html/training/cloudsync/index.jd
@@ -1,9 +1,8 @@
 page.title=Syncing to the Cloud
+page.tags="cloud","sync","backup"
 
 trainingnavtop=true
 startpage=true
-next.title=Making the Most of Google Cloud Messaging
-next.link=gcm.html
 
 @jd:body
 
diff --git a/docs/html/training/connect-devices-wirelessly/index.jd b/docs/html/training/connect-devices-wirelessly/index.jd
index 37cf633..f27b9c3 100644
--- a/docs/html/training/connect-devices-wirelessly/index.jd
+++ b/docs/html/training/connect-devices-wirelessly/index.jd
@@ -1,9 +1,8 @@
 page.title=Connecting Devices Wirelessly
+page.tags="wifi","network","wireless"
 
 trainingnavtop=true
 startpage=true
-next.title=Using Network Service Discovery
-next.link=nsd.html
 
 @jd:body
 
diff --git a/docs/html/training/contacts-provider/ContactsList.zip b/docs/html/training/contacts-provider/ContactsList.zip
new file mode 100644
index 0000000..d2a5cfb
--- /dev/null
+++ b/docs/html/training/contacts-provider/ContactsList.zip
Binary files differ
diff --git a/docs/html/training/contacts-provider/display-contact-badge.jd b/docs/html/training/contacts-provider/display-contact-badge.jd
new file mode 100644
index 0000000..f08935d
--- /dev/null
+++ b/docs/html/training/contacts-provider/display-contact-badge.jd
@@ -0,0 +1,635 @@
+page.title=Displaying the Quick Contact Badge
+
+trainingnavtop=true
+@jd:body
+
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+    <li>
+        <a href="#AddView">Add a QuickContactBadge View</a>
+    </li>
+    <li>
+        <a href="#SetURIThumbnail">Set the Contact URI and Thumbnail</a>
+    </li>
+    <li>
+        <a href="#ListView">
+            Add a QuickContactBadge to a ListView
+        </a>
+    </li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+<ul>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/content-provider-basics.html">
+        Content Provider Basics
+        </a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/contacts-provider.html">
+        Contacts Provider
+        </a>
+    </li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+    <a href="http://developer.android.com/shareables/training/ContactsList.zip" class="button">
+    Download the sample
+    </a>
+ <p class="filename">ContactsList.zip</p>
+</div>
+
+</div>
+</div>
+<p>
+    This lesson shows you how to add a {@link android.widget.QuickContactBadge} to your UI
+    and how to bind data to it. A {@link android.widget.QuickContactBadge} is a widget that
+    initially appears as a thumbnail image. Although you can use any {@link android.graphics.Bitmap}
+    for the thumbnail image, you usually use a {@link android.graphics.Bitmap} decoded from the
+    contact's photo thumbnail image.
+</p>
+<p>
+    The small image acts as a control; when users click on the image, the
+    {@link android.widget.QuickContactBadge} expands into a dialog containing the following:
+</p>
+<dl>
+    <dt>A large image</dt>
+    <dd>
+        The large image associated with the contact, or no image is available, a placeholder
+        graphic.
+    </dd>
+    <dt>
+        App icons
+    </dt>
+    <dd>
+        An app icon for each piece of detail data that can be handled by a built-in app. For
+        example, if the contact's details include one or more email addresses, an email icon
+        appears. When users click the icon, all of the contact's email addresses appear. When users
+        click one of the addresses, the email app displays a screen for composing a message to the
+        selected email address.
+    </dd>
+</dl>
+<p>
+    The {@link android.widget.QuickContactBadge} view provides instant access to a contact's
+    details, as well as a fast way of communicating with the contact. Users don't have to look up
+    a contact, find and copy information, and then paste it into the appropriate app. Instead, they
+    can click on the {@link android.widget.QuickContactBadge}, choose the communication method they
+    want to use, and send the information for that method directly to the appropriate app.
+</p>
+<h2 id="AddView">Add a QuickContactBadge View</h2>
+<p>
+    To add a {@link android.widget.QuickContactBadge}, insert a
+    <code>&lt;QuickContactBadge&gt;</code> element in your layout. For example:
+</p>
+<pre>
+&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"&gt;
+...
+    &lt;QuickContactBadge
+               android:id=&#64;+id/quickbadge
+               android:layout_height="wrap_content"
+               android:layout_width="wrap_content"
+               android:scaleType="centerCrop"/&gt;
+    ...
+&lt;/RelativeLayout&gt;
+</pre>
+<h2 id="">Retrieve provider data</h2>
+<p>
+    To display a contact in the {@link android.widget.QuickContactBadge}, you need a content URI
+    for the contact and a {@link android.graphics.Bitmap} for the small image. You generate
+    both the content URI and the {@link android.graphics.Bitmap} from columns retrieved from the
+    Contacts Provider. Specify these columns as part of the projection you use to load data into
+    your {@link android.database.Cursor}.
+</p>
+<p>
+    For Android 3.0 (API level 11) and later, include the following columns in your projection:</p>
+<ul>
+    <li>{@link android.provider.ContactsContract.Contacts#_ID Contacts._ID}</li>
+    <li>{@link android.provider.ContactsContract.Contacts#LOOKUP_KEY Contacts.LOOKUP_KEY}</li>
+    <li>
+        {@link android.provider.ContactsContract.Contacts#PHOTO_THUMBNAIL_URI
+        Contacts.PHOTO_THUMBNAIL_URI}
+    </li>
+</ul>
+<p>
+    For Android 2.3.3 (API level 10) and earlier, use the following columns:
+</p>
+<ul>
+    <li>{@link android.provider.ContactsContract.Contacts#_ID Contacts._ID}</li>
+    <li>{@link android.provider.ContactsContract.Contacts#LOOKUP_KEY Contacts.LOOKUP_KEY}</li>
+</ul>
+<p>
+    The remainder of this lesson assumes that you've already loaded a
+    {@link android.database.Cursor} that contains these columns as well as others you may have
+    chosen. To learn how to retrieve this columns in a {@link android.database.Cursor}, read the
+    lesson <a href="retrieve-names.html">Retrieving a List of Contacts</a>.
+</p>
+<h2 id="SetURIThumbnail">Set the Contact URI and Thumbnail</h2>
+<p>
+    Once you have the necessary columns, you can bind data to the
+    {@link android.widget.QuickContactBadge}.
+</p>
+<h3>Set the Contact URI</h3>
+<p>
+    To set the content URI for the contact, call
+    {@link android.provider.ContactsContract.Contacts#getLookupUri getLookupUri(id,lookupKey)} to
+    get a {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}, then
+    call {@link android.widget.QuickContactBadge#assignContactUri assignContactUri()} to set the
+    contact. For example:
+</p>
+<pre>
+    // The Cursor that contains contact rows
+    Cursor mCursor;
+    // The index of the _ID column in the Cursor
+    int mIdColumn;
+    // The index of the LOOKUP_KEY column in the Cursor
+    int mLookupKeyColumn;
+    // A content URI for the desired contact
+    Uri mContactUri;
+    // A handle to the QuickContactBadge view
+    QuickContactBadge mBadge;
+    ...
+    mBadge = (QuickContactBadge) findViewById(R.id.quickbadge);
+    /*
+     * Insert code here to move to the desired cursor row
+     */
+    // Gets the _ID column index
+    mIdColumn = mCursor.getColumnIndex(Contacts._ID);
+    // Gets the LOOKUP_KEY index
+    mLookupKeyColumn = mCursor.getColumnIndex(Contacts.LOOKUP_KEY);
+    // Gets a content URI for the contact
+    mContactUri =
+            Contacts.getLookupUri(
+                Cursor.getLong(mIdColumn),
+                Cursor.getString(mLookupKeyColumn)
+            );
+    mBadge.assignContactUri(mContactUri);
+</pre>
+<p>
+    When users click the {@link android.widget.QuickContactBadge} icon, the contact's
+    details automatically appear in the dialog.
+</p>
+<h3>Set the photo thumbnail</h3>
+<p>
+    Setting the contact URI for the {@link android.widget.QuickContactBadge} does not automatically
+    load the contact's thumbnail photo. To load the photo, get a URI for the photo from the
+    contact's {@link android.database.Cursor} row, use it to open the file containing the compressed
+    thumbnail photo, and read the file into a {@link android.graphics.Bitmap}.
+</p>
+<p class="note">
+    <strong>Note:</strong> The
+    {@link android.provider.ContactsContract.Contacts#PHOTO_THUMBNAIL_URI} column isn't available
+    in platform versions prior to 3.0. For those versions, you must retrieve the URI
+    from the {@link android.provider.ContactsContract.Contacts.Photo Contacts.Photo} subtable.
+</p>
+<p>
+    First, set up variables for accessing the {@link android.database.Cursor} containing the
+    {@link android.provider.ContactsContract.Contacts#_ID Contacts._ID} and
+    {@link android.provider.ContactsContract.Contacts#LOOKUP_KEY Contacts.LOOKUP_KEY} columns, as
+    described previously:
+</p>
+<pre>
+    // The column in which to find the thumbnail ID
+    int mThumbnailColumn;
+    /*
+     * The thumbnail URI, expressed as a String.
+     * Contacts Provider stores URIs as String values.
+     */
+    String mThumbnailUri;
+    ...
+    /*
+     * Gets the photo thumbnail column index if
+     * platform version &gt;= Honeycomb
+     */
+    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
+        mThumbnailColumn =
+                mCursor.getColumnIndex(Contacts.PHOTO_THUMBNAIL_URI);
+    // Otherwise, sets the thumbnail column to the _ID column
+    } else {
+        mThumbnailColumn = mIdColumn;
+    }
+    /*
+     * Assuming the current Cursor position is the contact you want,
+     * gets the thumbnail ID
+     */
+    mThumbnailUri = Cursor.getString(mThumbnailColumn);
+    ...
+</pre>
+<p>
+    Define a method that takes photo-related data for the contact and dimensions for the
+    destination view,  and returns the properly-sized thumbnail in a
+    {@link android.graphics.Bitmap}. Start by constructing a URI that points to the
+    thumbnail:
+<p>
+<pre>
+    /**
+     * Load a contact photo thumbnail and return it as a Bitmap,
+     * resizing the image to the provided image dimensions as needed.
+     * @param photoData photo ID Prior to Honeycomb, the contact's _ID value.
+     * For Honeycomb and later, the value of PHOTO_THUMBNAIL_URI.
+     * @return A thumbnail Bitmap, sized to the provided width and height.
+     * Returns null if the thumbnail is not found.
+     */
+    private Bitmap loadContactPhotoThumbnail(String photoData) {
+        // Creates an asset file descriptor for the thumbnail file.
+        AssetFileDescriptor afd = null;
+        // try-catch block for file not found
+        try {
+            // Creates a holder for the URI.
+            Uri thumbUri;
+            // If Android 3.0 or later
+            if (Build.VERSION.SDK_INT
+                    &gt;=
+                Build.VERSION_CODES.HONEYCOMB) {
+                // Sets the URI from the incoming PHOTO_THUMBNAIL_URI
+                thumbUri = Uri.parse(photoData);
+            } else {
+            // Prior to Android 3.0, constructs a photo Uri using _ID
+                /*
+                 * Creates a contact URI from the Contacts content URI
+                 * incoming photoData (_ID)
+                 */
+                final Uri contactUri = Uri.withAppendedPath(
+                        Contacts.CONTENT_URI, photoData);
+                /*
+                 * Creates a photo URI by appending the content URI of
+                 * Contacts.Photo.
+                 */
+                thumbUri =
+                        Uri.withAppendedPath(
+                                contactUri, Photo.CONTENT_DIRECTORY);
+            }
+    
+        /*
+         * Retrieves an AssetFileDescriptor object for the thumbnail
+         * URI
+         * using ContentResolver.openAssetFileDescriptor
+         */
+        afd = getActivity().getContentResolver().
+                openAssetFileDescriptor(thumbUri, "r");
+        /*
+         * Gets a file descriptor from the asset file descriptor.
+         * This object can be used across processes.
+         */
+        FileDescriptor fileDescriptor = afd.getFileDescriptor();
+        // Decode the photo file and return the result as a Bitmap
+        // If the file descriptor is valid
+        if (fileDescriptor != null) {
+            // Decodes the bitmap
+            return BitmapFactory.decodeFileDescriptor(
+                    fileDescriptor, null, null);
+            }
+        // If the file isn't found
+        } catch (FileNotFoundException e) {
+            /*
+             * Handle file not found errors
+             */
+        }
+        // In all cases, close the asset file descriptor
+        } finally {
+            if (afd != null) {
+                try {
+                    afd.close();
+                } catch (IOException e) {}
+            }
+        }
+        return null;
+    }
+</pre>
+<p>
+    Call the <code>loadContactPhotoThumbnail()</code> method in your code to get the
+    thumbnail {@link android.graphics.Bitmap}, and use the result to set the photo thumbnail in
+    your {@link android.widget.QuickContactBadge}:
+</p>
+<pre>
+    ...
+    /*
+     * Decodes the thumbnail file to a Bitmap.
+     */
+    Bitmap mThumbnail =
+            loadContactPhotoThumbnail(mThumbnailUri);
+    /*
+     * Sets the image in the QuickContactBadge
+     * QuickContactBadge inherits from ImageView, so
+     */
+    mBadge.setImageBitmap(mThumbnail);
+</pre>
+<h2 id="ListView">Add a QuickContactBadge to a ListView</h2>
+<p>
+    A {@link android.widget.QuickContactBadge} is a useful addition to a
+    {@link android.widget.ListView} that displays a list of contacts. Use the
+    {@link android.widget.QuickContactBadge} to display a thumbnail photo for each contact; when
+    users click the thumbnail, the {@link android.widget.QuickContactBadge} dialog appears.
+</p>
+<h3>Add the QuickContactBadge element</h3>
+<p>
+    To start, add a {@link android.widget.QuickContactBadge} view element to your item layout
+    For example, if you want to display a {@link android.widget.QuickContactBadge} and a name for
+    each contact you retrieve, put the following XML into a layout file:
+</p>
+<pre>
+&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"&gt;
+    &lt;QuickContactBadge
+        android:id="&#64;+id/quickcontact"
+        android:layout_height="wrap_content"
+        android:layout_width="wrap_content"
+        android:scaleType="centerCrop"/&gt;
+    &lt;TextView android:id="&#64;+id/displayname"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:layout_toRightOf="&#64;+id/quickcontact"
+              android:gravity="center_vertical"
+              android:layout_alignParentRight="true"
+              android:layout_alignParentTop="true"/&gt;
+&lt;/RelativeLayout&gt;
+</pre>
+<p>
+    In the following sections, this file is referred to as <code>contact_item_layout.xml</code>.
+</p>
+<h3>Set up a custom CursorAdapter</h3>
+<p>
+    To bind a {@link android.support.v4.widget.CursorAdapter} to a {@link android.widget.ListView}
+    containing a {@link android.widget.QuickContactBadge}, define a custom adapter that
+    extends {@link android.support.v4.widget.CursorAdapter}. This approach allows you to process the
+    data in the {@link android.database.Cursor} before you bind it to the
+    {@link android.widget.QuickContactBadge}. This approach also allows you to bind multiple
+    {@link android.database.Cursor} columns to the {@link android.widget.QuickContactBadge}. Neither
+    of these operations is possible in a regular {@link android.support.v4.widget.CursorAdapter}.
+</p>
+<p>
+    The subclass of {@link android.support.v4.widget.CursorAdapter} that you define must
+    override the following methods:
+</p>
+<dl>
+    <dt>{@link android.support.v4.widget.CursorAdapter#newView CursorAdapter.newView()}</dt>
+    <dd>
+        Inflates a new {@link android.view.View} object to hold the item layout. In the override
+        of this method, store handles to the child {@link android.view.View} objects of the layout,
+        including the child {@link android.widget.QuickContactBadge}. By taking this approach, you
+        avoid having to get handles to the child {@link android.view.View} objects each time you
+        inflate a new layout.
+        <p>
+            You must override this method so you can get handles to the individual child
+            {@link android.view.View} objects. This technique allows you to control their binding in
+            {@link android.support.v4.widget.CursorAdapter#bindView CursorAdapter.bindView()}.
+        </p>
+    </dd>
+    <dt>{@link android.support.v4.widget.CursorAdapter#bindView CursorAdapter.bindView()}</dt>
+    <dd>
+        Moves data from the current {@link android.database.Cursor} row to the child
+        {@link android.view.View} objects of the item layout. You must override this method so
+        you can bind both the contact's URI and thumbnail to the
+        {@link android.widget.QuickContactBadge}. The default implementation only allows a 1-to-1
+        mapping between a column and a {@link android.view.View}
+    </dd>
+</dl>
+<p>
+    The following code snippet contains an example of a custom subclass of
+    {@link android.support.v4.widget.CursorAdapter}:
+</p>
+<h3>Define the custom list adapter</h3>
+<p>
+    Define the subclass of {@link android.support.v4.widget.CursorAdapter} including its
+    constructor, and override
+    {@link android.support.v4.widget.CursorAdapter#newView newView()} and
+    {@link android.support.v4.widget.CursorAdapter#bindView bindView()}:
+</p>
+<pre>
+    /**
+     *
+     *
+     */
+    private class ContactsAdapter extends CursorAdapter {
+        private LayoutInflater mInflater;
+        ...
+        public ContactsAdapter(Context context) {
+            super(context, null, 0);
+
+            /*
+             * Gets an inflater that can instantiate
+             * the ListView layout from the file.
+             */
+            mInflater = LayoutInflater.from(context);
+            ...
+        }
+        ...
+        /**
+         * Defines a class that hold resource IDs of each item layout
+         * row to prevent having to look them up each time data is
+         * bound to a row.
+         */
+        private class ViewHolder {
+            TextView displayname;
+            QuickContactBadge quickcontact;
+        }
+        ..
+        &#64;Override
+        public View newView(
+                Context context,
+                Cursor cursor,
+                ViewGroup viewGroup) {
+            /* Inflates the item layout. Stores resource IDs in a
+             * in a ViewHolder class to prevent having to look
+             * them up each time bindView() is called.
+             */
+            final View itemView =
+                    mInflater.inflate(
+                            R.layout.contact_list_layout,
+                            viewGroup,
+                            false
+                    );
+            final ViewHolder holder = new ViewHolder();
+            holder.displayname =
+                    (TextView) view.findViewById(R.id.displayname);
+            holder.quickcontact =
+                    (QuickContactBadge)
+                            view.findViewById(R.id.quickcontact);
+            view.setTag(holder);
+            return view;
+        }
+        ...
+        &#64;Override
+        public void bindView(
+                View view,
+                Context context,
+                Cursor cursor) {
+            final ViewHolder holder = (ViewHolder) view.getTag();
+            final String photoData =
+                    cursor.getString(mPhotoDataIndex);
+            final String displayName =
+                    cursor.getString(mDisplayNameIndex);
+            ...
+            // Sets the display name in the layout
+            holder.displayname = cursor.getString(mDisplayNameIndex);
+            ...
+            /*
+             * Generates a contact URI for the QuickContactBadge.
+             */
+            final Uri contactUri = Contacts.getLookupUri(
+                    cursor.getLong(mIdIndex),
+                    cursor.getString(mLookupKeyIndex));
+            holder.quickcontact.assignContactUri(contactUri);
+            String photoData = cursor.getString(mPhotoDataIndex);
+            /*
+             * Decodes the thumbnail file to a Bitmap.
+             * The method loadContactPhotoThumbnail() is defined
+             * in the section "Set the Contact URI and Thumbnail"
+             */
+            Bitmap thumbnailBitmap =
+                    loadContactPhotoThumbnail(photoData);
+            /*
+             * Sets the image in the QuickContactBadge
+             * QuickContactBadge inherits from ImageView
+             */
+            holder.quickcontact.setImageBitmap(thumbnailBitmap);
+    }
+</pre>
+
+<h3>Set up variables</h3>
+<p>
+    In your code, set up variables, including a {@link android.database.Cursor} projection that
+    includes the necessary columns.
+</p>
+<p class="note">
+    <strong>Note:</strong> The following code snippets use the method
+    <code>loadContactPhotoThumbnail()</code>, which is defined in the section
+    <a href="#SetURIThumbnail">Set the Contact URI and Thumbnail</a>
+</p>
+<p>
+    For example:
+</p>
+<pre>
+public class ContactsFragment extends Fragment implements
+        LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
+...
+    // Defines a ListView
+    private ListView mListView;
+    // Defines a ContactsAdapter
+    private ContactsAdapter mAdapter;
+    ...
+    // Defines a Cursor to contain the retrieved data
+    private Cursor mCursor;
+    /*
+     * Defines a projection based on platform version. This ensures
+     * that you retrieve the correct columns.
+     */
+    private static final String[] PROJECTION =
+            {
+                Contacts._ID,
+                Contacts.LOOKUP_KEY,
+                (Build.VERSION.SDK_INT &gt;=
+                 Build.VERSION_CODES.HONEYCOMB) ?
+                        Contacts.DISPLAY_NAME_PRIMARY :
+                        Contacts.DISPLAY_NAME
+                (Build.VERSION.SDK_INT &gt;=
+                 Build.VERSION_CODES.HONEYCOMB) ?
+                        Contacts.PHOTO_THUMBNAIL_ID :
+                        /*
+                         * Although it's not necessary to include the
+                         * column twice, this keeps the number of
+                         * columns the same regardless of version
+                         */
+                        Contacts_ID
+                ...
+            };
+    /*
+     * As a shortcut, defines constants for the
+     * column indexes in the Cursor. The index is
+     * 0-based and always matches the column order
+     * in the projection.
+     */
+    // Column index of the _ID column
+    private int mIdIndex = 0;
+    // Column index of the LOOKUP_KEY column
+    private int mLookupKeyIndex = 1;
+    // Column index of the display name column
+    private int mDisplayNameIndex = 3;
+    /*
+     * Column index of the photo data column.
+     * It's PHOTO_THUMBNAIL_URI for Honeycomb and later,
+     * and _ID for previous versions.
+     */
+    private int mPhotoDataIndex =
+            Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB ?
+            3 :
+            0;
+    ...
+</pre>
+<h3>Set up the ListView</h3>
+<p>
+    In {@link android.support.v4.app.Fragment#onCreate Fragment.onCreate()}, instantiate the custom
+    cursor adapter and get a handle to the {@link android.widget.ListView}:
+</p>
+<pre>
+    &#64;Override
+    public void onCreate(Bundle savedInstanceState) {
+        ...
+        /*
+         * Instantiates the subclass of
+         * CursorAdapter
+         */
+        ContactsAdapter mContactsAdapter =
+                new ContactsAdapter(getActivity());
+        /*
+         * Gets a handle to the ListView in the file
+         * contact_list_layout.xml
+         */
+        mListView = (ListView) findViewById(R.layout.contact_list_layout);
+        ...
+    }
+    ...
+</pre>
+<p>
+    In {@link android.support.v4.app.Fragment#onActivityCreated onActivityCreated()}, bind the
+    <code>ContactsAdapter</code> to the {@link android.widget.ListView}:
+</p>
+<pre>
+    &#64;Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        ...
+        // Sets up the adapter for the ListView
+        mListView.setAdapter(mAdapter);
+        ...
+    }
+    ...
+</pre>
+<p>
+    When you get back a {@link android.database.Cursor} containing the contacts data, usually in
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished onLoadFinished()},
+    call {@link android.support.v4.widget.CursorAdapter#swapCursor swapCursor()} to move the
+    {@link android.database.Cursor} data to the {@link android.widget.ListView}. This displays the
+    {@link android.widget.QuickContactBadge} for each entry in the list of contacts:
+</p>
+<pre>
+    public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) {
+        // When the loader has completed, swap the cursor into the adapter.
+        mContactsAdapter.swapCursor(cursor);
+    }
+</pre>
+<p>
+    When you bind a {@link android.database.Cursor} to a
+    {@link android.widget.ListView} with a {@link android.support.v4.widget.CursorAdapter}
+    (or subclass), and you use a {@link android.support.v4.content.CursorLoader} to load the
+    {@link android.database.Cursor}, always clear references to the {@link android.database.Cursor}
+    in your implementation of
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoaderReset onLoaderReset()}.
+    For example:
+</p>
+<pre>
+    &#64;Override
+    public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
+        // Removes remaining reference to the previous Cursor
+        mContactsAdapter.swapCursor(null);
+    }
+</pre>
diff --git a/docs/html/training/contacts-provider/index.jd b/docs/html/training/contacts-provider/index.jd
new file mode 100644
index 0000000..f380d95
--- /dev/null
+++ b/docs/html/training/contacts-provider/index.jd
@@ -0,0 +1,97 @@
+page.title=Accessing Contacts Data
+
+trainingnavtop=true
+startpage=true
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
+<h2>Dependencies and prerequisites</h2>
+<ul>
+  <li>Android 2.0 (API Level 5) or higher</li>
+  <li>Experience in using {@link android.content.Intent} objects</li>
+  <li>Experience in using content providers</li>
+</ul>
+
+<!-- related docs (NOT javadocs) -->
+<h2>You should also read</h2>
+<ul>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/content-provider-basics.html">
+        Content Provider Basics</a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/contacts-provider.html">
+        Contacts Provider</a>
+    </li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+    <a href="http://developer.android.com/shareables/training/ContactsList.zip" class="button">
+    Download the sample
+    </a>
+ <p class="filename">ContactsList.zip</p>
+</div>
+
+</div>
+</div>
+
+<p>
+    The <a href="{@docRoot}guide/topics/providers/contacts-provider.html">Contacts Provider</a> is
+    the central repository of the user's contacts information, including data from contacts apps and
+    social networking apps. In your apps, you can access Contacts Provider information directly by
+    calling {@link android.content.ContentResolver} methods or by sending intents to a contacts app.
+</p>
+<p>
+    This class focuses on retrieving lists of contacts, displaying the details for a particular
+    contact, and modifying contacts using intents. The basic techniques described
+    here can be extended to perform more complex tasks. In addition, this class helps you
+    understand the overall structure and operation of the
+    <a href="{@docRoot}guide/topics/providers/contacts-provider.html">Contacts Provider</a>.
+</p>
+<h2>Lessons</h2>
+ 
+<dl>
+    <dt>
+        <b><a href="retrieve-names.html">Retrieving a List of Contacts</a></b>
+    </dt>
+    <dd>
+        Learn how to retrieve a list of contacts for which the data matches all or part of a search
+        string, using the following techniques:
+        <ul>
+            <li>Match by contact name</li>
+            <li>Match any type of contact data</li>
+            <li>Match a specific type of contact data, such as a phone number</li>
+        </ul>
+    </dd>
+    <dt>
+        <b><a href="retrieve-details.html">Retrieving Details for a Contact</a></b>
+    </dt>
+    <dd>
+        Learn how to retrieve the details for a single contact. A contact's details are data
+        such as phone numbers and email addresses. You can retrieve all details, or you can
+        retrieve details of a specific type, such as all email addresses.
+    </dd>
+    <dt>
+        <b><a href="modify-data.html">Modifying Contacts Using Intents</a></b>
+    </dt>
+    <dd>
+        Learn how to modify a contact by sending an intent to the People app.
+    </dd>
+    <dt>
+        <b>
+            <a href="display-contact-badge.html">Displaying the Quick Contact Badge</a>
+        </b>
+    </dt>
+    <dd>
+        Learn how to display the {@link android.widget.QuickContactBadge} widget. When the user
+        clicks the contact badge widget, a dialog opens that displays the contact's details and
+        action buttons for apps that can handle the details. For example, if the contact has an
+        email address, the dialog displays an action button for the default email app.
+    </dd>
+</dl>
diff --git a/docs/html/training/contacts-provider/modify-data.jd b/docs/html/training/contacts-provider/modify-data.jd
new file mode 100644
index 0000000..64853ef
--- /dev/null
+++ b/docs/html/training/contacts-provider/modify-data.jd
@@ -0,0 +1,305 @@
+page.title=Modifying Contacts Using Intents
+trainingnavtop=true
+@jd:body
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+  <li><a href="#InsertContact">Insert a New Contact Using an Intent</a></li>
+  <li><a href="#EditContact">Edit an Existing Contact Using an Intent</a></li>
+  <li><a href="#InsertEdit">Let Users Choose to Insert or Edit Using an Intent</a>
+</ol>
+<h2>You should also read</h2>
+<ul>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/content-provider-basics.html">
+        Content Provider Basics
+        </a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/contacts-provider.html">
+        Contacts Provider
+        </a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a>
+    </li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+    <a href="http://developer.android.com/shareables/training/ContactsList.zip" class="button">
+    Download the sample
+    </a>
+ <p class="filename">ContactsList.zip</p>
+</div>
+
+</div>
+</div>
+<p>
+    This lesson shows you how to use an {@link android.content.Intent} to insert a new contact or
+    modify a contact's data. Instead of accessing the Contacts Provider directly, an
+    {@link android.content.Intent} starts the contacts app, which runs the appropriate
+    {@link android.app.Activity}. For the modification actions described in this lesson,
+    if you send extended data in the {@link android.content.Intent} it's entered into the UI of the
+    {@link android.app.Activity} that is started.
+</p>
+<p>
+    Using an {@link android.content.Intent} to insert or update a single contact is the preferred
+    way of modifying the Contacts Provider, for the following reasons:
+</p>
+<ul>
+    <li>It saves you the time and and effort of developing your own UI and code.</li>
+    <li>
+        It avoids introducing errors caused by modifications that don't follow the
+        Contacts Provider's rules.
+    </li>
+    <li>
+        It reduces the number of permissions you need to request. Your app doesn't need permission
+        to write to the Contacts Provider, because it delegates modifications to the contacts app,
+        which already has that permission.
+    </li>
+</ul>
+<h2 id="InsertContact">Insert a New Contact Using an Intent</h2>
+<p>
+    You often want to allow the user to insert a new contact when your app receives new data. For
+    example, a restaurant review app can allow users to add the restaurant as a contact as they're
+    reviewing it. To do this using an intent, create the intent using as much data as you have
+    available, and then send the intent to the contacts app.
+</p>
+<p>
+    Inserting a contact using the contacts app inserts a new <em>raw</em> contact into the Contacts
+    Provider's {@link android.provider.ContactsContract.RawContacts} table.  If necessary,
+    the contacts app prompts users for the account type and account to use when creating the raw
+    contact. The contacts app also notifies users if the raw contact already exists. Users then have
+    option of canceling the insertion, in which case no contact is created. To learn
+    more about raw contacts, see the
+    <a href="{@docRoot}guide/topics/providers/contacts-provider.html">Contacts Provider</a>
+    API guide.
+</p>
+
+<h3>Create an Intent</h3>
+<p>
+    To start, create a new {@link android.content.Intent} object with the action
+    {@link android.provider.ContactsContract.Intents.Insert#ACTION Intents.Insert.ACTION}.
+    Set the MIME type to {@link android.provider.ContactsContract.RawContacts#CONTENT_TYPE
+    RawContacts.CONTENT_TYPE}. For example:
+</p>
+<pre>
+...
+// Creates a new Intent to insert a contact
+Intent intent = new Intent(Intents.Insert.ACTION);
+// Sets the MIME type to match the Contacts Provider
+intent.setType(ContactsContract.RawContacts.CONTENT_TYPE);
+</pre>
+<p>
+    If you already have details for the contact, such as a phone number or email address, you can
+    insert them into the intent as extended data. For a key value, use the appropriate constant from
+    {@link android.provider.ContactsContract.Intents.Insert Intents.Insert}. The contacts app
+    displays the data in its insert screen, allowing users to make further edits and additions.
+</p>
+<pre>
+/* Assumes EditText fields in your UI contain an email address
+ * and a phone number.
+ *
+ */
+private EditText mEmailAddress = (EditText) findViewById(R.id.email);
+private EditText mPhoneNumber = (EditText) findViewById(R.id.phone);
+...
+/*
+ * Inserts new data into the Intent. This data is passed to the
+ * contacts app's Insert screen
+ */
+// Inserts an email address
+intent.putExtra(Intents.Insert.EMAIL, mEmailAddress.getText())
+/*
+ * In this example, sets the email type to be a work email.
+ * You can set other email types as necessary.
+ */
+      .putExtra(Intents.Insert.EMAIL_TYPE, CommonDataKinds.Email.TYPE_WORK)
+// Inserts a phone number
+      .putExtra(Intents.Insert.PHONE, mPhoneNumber.getText())
+/*
+ * In this example, sets the phone type to be a work phone.
+ * You can set other phone types as necessary.
+ */
+      .putExtra(Intents.Insert.PHONE_TYPE, Phone.TYPE_WORK);
+
+</pre>
+<p>
+    Once you've created the {@link android.content.Intent}, send it by calling
+    {@link android.support.v4.app.Fragment#startActivity startActivity()}.
+</p>
+<pre>
+    /* Sends the Intent
+     */
+    startActivity(intent);
+</pre>
+<p>
+    This call opens a screen in the contacts app that allows users to enter a new contact. The
+    account type and account name for the contact is listed at the top of the screen. Once users
+    enter the data and click <i>Done</i>, the contacts app's contact list appears. Users return to
+    your app by clicking <i>Back</i>.
+</p>
+<h2 id="EditContact">Edit an Existing Contact Using an Intent</h2>
+<p>
+    Editing an existing contact using an {@link android.content.Intent} is useful if the user
+    has already chosen a contact of interest. For example, an app that finds contacts that have
+    postal addresses but lack a postal code could give users the option of looking up the code and
+    then adding it to the contact.
+</p>
+<p>
+    To edit an existing contact using an intent, use a procedure similar to
+    inserting a contact. Create an intent as described in the section
+    <a href="#InsertContact">Insert a New Contact Using an Intent</a>, but add the contact's
+    {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI
+    Contacts.CONTENT_LOOKUP_URI} and the MIME type
+    {@link android.provider.ContactsContract.Contacts#CONTENT_ITEM_TYPE
+    Contacts.CONTENT_ITEM_TYPE} to the intent. If you want to edit the contact with details you
+    already have, you can put them in the intent's extended data. Notice that some
+    name columns can't be edited using an intent; these columns are listed in the summary
+    section of the API reference for the class {@link android.provider.ContactsContract.Contacts}
+    under the heading "Update".
+</p>
+<p>
+    Finally, send the intent. In response, the contacts app displays an edit screen. When the user
+    finishes editing and saves the edits, the contacts app displays a contact list. When the user
+    clicks <i>Back</i>, your app is displayed.
+</p>
+<div class="sidebox-wrapper">
+<div class="sidebox">
+    <h2>Contacts Lookup Key</h2>
+    <p>
+        A contact's {@link android.provider.ContactsContract.ContactsColumns#LOOKUP_KEY} value is
+        the identifier that you should use to retrieve a contact. It remains constant,
+        even if the provider changes the contact's row ID to handle internal operations.
+    </p>
+</div>
+</div>
+<h3>Create the Intent</h3>
+<p>
+    To edit a contact, call {@link android.content.Intent#Intent Intent(action)} to
+    create an intent with the action {@link android.content.Intent#ACTION_EDIT}. Call
+    {@link android.content.Intent#setDataAndType setDataAndType()} to set the data value for the
+    intent to the contact's {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI
+    Contacts.CONTENT_LOOKUP_URI} and the MIME type to
+    {@link android.provider.ContactsContract.Contacts#CONTENT_ITEM_TYPE
+    Contacts.CONTENT_ITEM_TYPE} MIME type; because a call to
+    {@link android.content.Intent#setType setType()} overwrites the current data value for the
+    {@link android.content.Intent}, you must set the data and the MIME type at the same time.
+</p>
+<p>
+    To get a contact's {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI
+    Contacts.CONTENT_LOOKUP_URI}, call
+    {@link android.provider.ContactsContract.Contacts#getLookupUri
+    Contacts.getLookupUri(id, lookupkey)} with the contact's
+    {@link android.provider.ContactsContract.Contacts#_ID Contacts._ID} and
+    {@link android.provider.ContactsContract.Contacts#LOOKUP_KEY Contacts.LOOKUP_KEY} values as
+    arguments.
+</p>
+<p>
+    The following snippet shows you how to create an intent:
+</p>
+<pre>
+    // The Cursor that contains the Contact row
+    public Cursor mCursor;
+    // The index of the lookup key column in the cursor
+    public int mLookupKeyIndex;
+    // The index of the contact's _ID value
+    public int mIdIndex;
+    // The lookup key from the Cursor
+    public String mCurrentLookupKey;
+    // The _ID value from the Cursor
+    public long mCurrentId;
+    // A content URI pointing to the contact
+    Uri mSelectedContactUri;
+    ...
+    /*
+     * Once the user has selected a contact to edit,
+     * this gets the contact's lookup key and _ID values from the
+     * cursor and creates the necessary URI.
+     */
+    // Gets the lookup key column index
+    mLookupKeyIndex = mCursor.getColumnIndex(Contacts.LOOKUP_KEY);
+    // Gets the lookup key value
+    mCurrentLookupKey = mCursor.getString(mLookupKeyIndex);
+    // Gets the _ID column index
+    mIdIndex = mCursor.getColumnIndex(Contacts._ID);
+    mCurrentId = mCursor.getLong(mIdIndex);
+    mSelectedContactUri =
+            Contacts.getLookupUri(mCurrentId, mCurrentLookupKey);
+    ...
+    // Creates a new Intent to edit a contact
+    Intent editIntent = new Intent(Intent.ACTION_EDIT);
+    /*
+     * Sets the contact URI to edit, and the data type that the
+     * Intent must match
+     */
+    editIntent.setDataAndType(mSelectedContactUri,Contacts.CONTENT_ITEM_TYPE);
+</pre>
+<h3>Add the navigation flag</h3>
+<p>
+    In Android 4.0 (API version 14) and later, a problem in the contacts app causes incorrect
+    navigation. When your app sends an edit intent to the contacts app, and users edit and save a
+    contact, when they click <i>Back</i> they see the contacts list screen. To navigate back to
+    your app, they have to click <i>Recents</i> and choose your app.
+</p>
+<p>
+    To work around this problem in Android 4.0.3 (API version 15) and later, add the extended
+    data key {@code finishActivityOnSaveCompleted} to the intent, with a value of {@code true}.
+    Android versions prior to Android 4.0 accept this key, but it has no effect. To set the
+    extended data, do the following:
+</p>
+<pre>
+    // Sets the special extended data for navigation
+    editIntent.putExtra("finishActivityOnSaveCompleted", true);
+</pre>
+<h3>Add other extended data</h3>
+<p>
+    To add additional extended data to the {@link android.content.Intent}, call
+    {@link android.content.Intent#putExtra putExtra()} as desired.
+    You can add extended data for common contact fields by using the key values specified in
+    {@link android.provider.ContactsContract.Intents.Insert Intents.Insert}. Remember that some
+    columns in the {@link android.provider.ContactsContract.Contacts} table can't be modified.
+    These columns are listed in the summary section of the API reference for the class
+    {@link android.provider.ContactsContract.Contacts} under the heading "Update".
+</p>
+
+<h3>Send the Intent</h3>
+<p>
+    Finally, send the intent you've constructed. For example:
+</p>
+<pre>
+    // Sends the Intent
+    startActivity(editIntent);
+</pre>
+<h2 id="InsertEdit">Let Users Choose to Insert or Edit Using an Intent</h2>
+<p>
+    You can allow users to choose whether to insert a contact or edit an existing one by sending
+    an {@link android.content.Intent} with the action
+    {@link android.content.Intent#ACTION_INSERT_OR_EDIT}. For example, an email client app could
+    allow users to add an incoming email address to a new contact, or add it as an additional
+    address for an existing contact. Set the MIME type for this intent to
+    {@link android.provider.ContactsContract.Contacts#CONTENT_ITEM_TYPE Contacts.CONTENT_ITEM_TYPE},
+    but don't set the data URI.
+</p>
+<p>
+    When you send this intent, the contacts app displays a list of contacts.
+    Users can either insert a new contact or pick an existing contact and edit it.
+    Any extended data fields you add to the intent populates the screen that appears. You can use
+    any of the key values specified in {@link android.provider.ContactsContract.Intents.Insert
+    Intents.Insert}. The following code snippet shows how to construct and send the intent:
+</p>
+<pre>
+    // Creates a new Intent to insert or edit a contact
+    Intent intentInsertEdit = new Intent(Intent.ACTION_INSERT_OR_EDIT);
+    // Sets the MIME type
+    intentInsertEdit.setType(Contacts.CONTENT_ITEM_TYPE);
+    // Add code here to insert extended data, if desired
+    ...
+    // Sends the Intent with an request ID
+    startActivity(intentInsertEdit);
+</pre>
diff --git a/docs/html/training/contacts-provider/retrieve-details.jd b/docs/html/training/contacts-provider/retrieve-details.jd
new file mode 100644
index 0000000..0de3b67
--- /dev/null
+++ b/docs/html/training/contacts-provider/retrieve-details.jd
@@ -0,0 +1,378 @@
+page.title=Retrieving Details for a Contact
+
+trainingnavtop=true
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+  <li><a href="#RetrieveAll">Retrieve All Details for a Contact</a></li>
+  <li><a href="#RetrieveSpecific">Retrieve Specific Details for a Contact</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+<ul>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/content-provider-basics.html">
+        Content Provider Basics</a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/contacts-provider.html">
+        Contacts Provider</a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/components/loaders.html">Loaders</a>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+    <a href="http://developer.android.com/shareables/training/ContactsList.zip" class="button">
+    Download the sample
+    </a>
+ <p class="filename">ContactsList.zip</p>
+</div>
+
+</div>
+</div>
+<p>
+    This lesson shows how to retrieve detail data for a contact, such as email addresses, phone
+    numbers, and so forth. It's the details that users are looking for when they retrieve a contact.
+    You can give them all the details for a contact, or only display details of a particular type,
+    such as email addresses.
+</p>
+<p>
+    The steps in this lesson assume that you already have a
+    {@link android.provider.ContactsContract.Contacts} row for a contact the user has picked.
+    The <a href="retrieve-names.html">Retrieving Contact Names</a> lesson shows how to
+    retrieve a list of contacts.
+</p>
+<h2 id="RetrieveAll">Retrieve All Details for a Contact</h2>
+<p>
+    To retrieve all the details for a contact, search the
+    {@link android.provider.ContactsContract.Data} table for any rows that contain the contact's
+    {@link android.provider.ContactsContract.Data#LOOKUP_KEY}. This column is available in
+    the {@link android.provider.ContactsContract.Data} table, because the Contacts
+    Provider makes an implicit join between the {@link android.provider.ContactsContract.Contacts}
+    table and the {@link android.provider.ContactsContract.Data} table. The
+    {@link android.provider.ContactsContract.Contacts#LOOKUP_KEY} column is described
+    in more detail in the <a href="retrieve-names.html">Retrieving Contact Names</a> lesson.
+</p>
+<p class="note">
+    <strong>Note:</strong> Retrieving all the details for a contact reduces the performance of a
+    device, because it needs to retrieve all of the columns in the
+    {@link android.provider.ContactsContract.Data} table. Consider the performance impact before
+    you use this technique.
+</p>
+<h3>Request permissions</h3>
+<p>
+    To read from the Contacts Provider, your app must have
+    {@link android.Manifest.permission#READ_CONTACTS READ_CONTACTS} permission.
+    To request this permission, add the following child element of
+    <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">
+    &lt;manifest&gt;</a></code> to your manifest file:
+</p>
+<pre>
+    &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
+</pre>
+<h3>Set up a projection</h3>
+<p>
+    Depending on the data type a row contains, it may use only a few columns or many. In addition,
+    the data is in different columns depending on the data type.
+    To ensure you get all the possible columns for all possible data types, you need to add all the
+    column names to your projection. Always retrieve
+    {@link android.provider.ContactsContract.Data#_ID Data._ID} if you're binding the result
+    {@link android.database.Cursor} to a {@link android.widget.ListView}; otherwise, the binding
+    won't work. Also retrieve {@link android.provider.ContactsContract.Data#MIMETYPE Data.MIMETYPE}
+    so you can identify the data type of each row you retrieve. For example:
+</p>
+<pre>
+    private static final String PROJECTION =
+            {
+                Data._ID,
+                Data.MIMETYPE,
+                Data.DATA1,
+                Data.DATA2,
+                Data.DATA3,
+                Data.DATA4,
+                Data.DATA5,
+                Data.DATA6,
+                Data.DATA7,
+                Data.DATA8,
+                Data.DATA9,
+                Data.DATA10,
+                Data.DATA11,
+                Data.DATA12,
+                Data.DATA13,
+                Data.DATA14,
+                Data.DATA15
+            };
+</pre>
+<p>
+    This projection retrieves all the columns for a row in the
+    {@link android.provider.ContactsContract.Data} table, using the column names defined in
+    the {@link android.provider.ContactsContract.Data} class.
+</p>
+<p>
+    Optionally, you can also use any other column constants defined in or inherited by the
+    {@link android.provider.ContactsContract.Data} class. Notice, however, that the columns
+    {@link android.provider.ContactsContract.DataColumns#SYNC1} through
+    {@link android.provider.ContactsContract.DataColumns#SYNC4} are meant to be used by sync
+    adapters, so their data is not useful.
+</p>
+<h3>Define the selection criteria</h3>
+<p>
+    Define a constant for your selection clause, an array to hold selection arguments, and a
+    variable to hold the selection value. Use
+    the {@link android.provider.ContactsContract.Contacts#LOOKUP_KEY Contacts.LOOKUP_KEY} column to
+    find the contact. For example:
+</p>
+<pre>
+    // Defines the selection clause
+    private static final String SELECTION = Data.LOOKUP_KEY + " = ?";
+    // Defines the array to hold the search criteria
+    private String[] mSelectionArgs = { "" };
+    /*
+     * Defines a variable to contain the selection value. Once you
+     * have the Cursor from the Contacts table, and you've selected
+     * the desired row, move the row's LOOKUP_KEY value into this
+     * variable.
+     */
+    private String mLookupKey;
+</pre>
+<p>
+    Using "?" as a placeholder in your selection text expression ensures that the resulting search
+    is generated by binding rather than SQL compilation. This approach eliminates the
+    possibility of malicious SQL injection.
+</p>
+<h3>Define the sort order</h3>
+<p>
+    Define the sort order you want in the resulting {@link android.database.Cursor}. To
+    keep all rows for a particular data type together, sort by
+    {@link android.provider.ContactsContract.Data#MIMETYPE Data.MIMETYPE}. This query argument
+    groups all email rows together, all phone rows together, and so forth. For example:
+</p>
+<pre>
+    /*
+     * Defines a string that specifies a sort order of MIME type
+     */
+    private static final String SORT_ORDER = Data.MIMETYPE;
+</pre>
+<p class="note">
+    <strong>Note:</strong> Some data types don't use a subtype, so you can't sort on subtype.
+    Instead, you have to iterate through the returned {@link android.database.Cursor},
+    determine the data type of the current row, and store data for rows that use a subtype. When
+    you finish reading the cursor, you can then sort each data type by subtype and display the
+    results.
+</p>
+<h3>Initialize the Loader</h3>
+<p>
+   Always do retrievals from the Contacts Provider (and all other content providers) in a
+   background thread. Use the Loader framework defined by the
+   {@link android.support.v4.app.LoaderManager} class and the
+   {@link android.support.v4.app.LoaderManager.LoaderCallbacks} interface to do background
+   retrievals.
+</p>
+<p>
+    When you're ready to retrieve the rows, initialize the loader framework by
+    calling {@link android.support.v4.app.LoaderManager#initLoader initLoader()}. Pass an
+    integer identifier to the method; this identifier is passed to
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks} methods. The identifier helps you
+    use multiple loaders in an app by allowing you to differentiate between them.
+</p>
+<p>
+    The following snippet shows how to initialize the loader framework:
+</p>
+<pre>
+public class DetailsFragment extends Fragment implements
+        LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
+    ...
+    // Defines a constant that identifies the loader
+    DETAILS_QUERY_ID = 0;
+    ...
+    /*
+     * Invoked when the parent Activity is instantiated
+     * and the Fragment's UI is ready. Put final initialization
+     * steps here.
+     */
+    &#64;Override
+    onActivityCreated(Bundle savedInstanceState) {
+        ...
+        // Initializes the loader framework
+        getLoaderManager().initLoader(DETAILS_QUERY_ID, null, this);
+</pre>
+<h3>Implement onCreateLoader()</h3>
+<p>
+    Implement the {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onCreateLoader
+    onCreateLoader()} method, which is called by the loader framework immediately after you call
+    {@link android.support.v4.app.LoaderManager#initLoader initLoader()}. Return a
+    {@link android.support.v4.content.CursorLoader} from this method. Since you're searching
+    the {@link android.provider.ContactsContract.Data} table, use the constant
+    {@link android.provider.ContactsContract.Data#CONTENT_URI Data.CONTENT_URI} as the content URI.
+    For example:
+</p>
+<pre>
+    &#64;Override
+    public Loader&lt;Cursor&gt; onCreateLoader(int loaderId, Bundle args) {
+        // Choose the proper action
+        switch (loaderId) {
+            case DETAILS_QUERY_ID:
+            // Assigns the selection parameter
+            mSelectionArgs[0] = mLookupKey;
+            // Starts the query
+            CursorLoader mLoader =
+                    new CursorLoader(
+                            getActivity(),
+                            Data.CONTENT_URI,
+                            PROJECTION,
+                            SELECTION,
+                            mSelectionArgs,
+                            SORT_ORDER
+                    );
+            ...
+    }
+</pre>
+<h3>Implement onLoadFinished() and onLoaderReset()</h3>
+<p>
+    Implement the
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished onLoadFinished()}
+    method. The loader framework calls
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished onLoadFinished()}
+    when the Contacts Provider returns the results of the query. For example:
+</p>
+<pre>
+    public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) {
+        switch (loader.getId()) {
+            case DETAILS_QUERY_ID:
+                    /*
+                     * Process the resulting Cursor here.
+                     */
+                }
+                break;
+            ...
+        }
+    }
+</pre>
+<p>
+<p>
+    The method {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoaderReset
+    onLoaderReset()} is invoked when the loader framework detects that the data backing the result
+    {@link android.database.Cursor} has changed. At this point, remove any existing references
+    to the {@link android.database.Cursor} by setting them to null. If you don't, the loader
+    framework won't destroy the old {@link android.database.Cursor}, and you'll get a memory
+    leak. For example:
+<pre>
+    &#64;Override
+    public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
+        switch (loader.getId()) {
+            case DETAILS_QUERY_ID:
+                /*
+                 * If you have current references to the Cursor,
+                 * remove them here.
+                 */
+                }
+                break;
+    }
+</pre>
+<h2 id="RetrieveSpecific">Retrieve Specific Details for a Contact</h2>
+<p>
+    Retrieving a specific data type for a contact, such as all the emails, follows the same pattern
+    as retrieving all details. These are the only changes you need to make to the code
+    listed in <a href="#RetrieveAll">Retrieve All Details for a Contact</a>:
+</p>
+<dl>
+    <dt>
+        Projection
+    </dt>
+    <dd>
+        Modify your projection to retrieve the columns that are specific to the
+        data type. Also modify the projection to use the column name constants defined in the
+        {@link android.provider.ContactsContract.CommonDataKinds} subclass corresponding to the
+        data type.
+    </dd>
+    <dt>
+        Selection
+    </dt>
+    <dd>
+        Modify the selection text to search for the
+        {@link android.provider.ContactsContract.Data#MIMETYPE MIMETYPE} value that's specific to
+        your data type.
+    </dd>
+    <dt>
+        Sort order
+    </dt>
+    <dd>
+        Since you're only selecting a single detail type, don't group the returned
+        {@link android.database.Cursor} by {@link android.provider.ContactsContract.Data#MIMETYPE
+        Data.MIMETYPE}.
+    </dd>
+</dl>
+<p>
+    These modifications are described in the following sections.
+</p>
+<h3>Define a projection</h3>
+<p>
+    Define the columns you want to retrieve, using the column name constants in the subclass
+    of {@link android.provider.ContactsContract.CommonDataKinds} for the data type.
+    If you plan to bind your {@link android.database.Cursor} to a {@link android.widget.ListView},
+    be sure to retrieve the <code>_ID</code> column. For example, to retrieve email data, define the
+    following projection:
+</p>
+<pre>
+    private static final String[] PROJECTION =
+            {
+                Email._ID,
+                Email.ADDRESS,
+                Email.TYPE,
+                Email.LABEL
+            };
+</pre>
+<p>
+    Notice that this projection uses the column names defined in the class
+    {@link android.provider.ContactsContract.CommonDataKinds.Email}, instead of the column names
+    defined in the class {@link android.provider.ContactsContract.Data}. Using the email-specific
+    column names makes the code more readable.
+</p>
+<p>
+    In the projection, you can also use any of the other columns defined in the
+    {@link android.provider.ContactsContract.CommonDataKinds} subclass.
+</p>
+<h3>Define selection criteria</h3>
+<p>
+    Define a search text expression that retrieves rows for a specific contact's
+    {@link android.provider.ContactsContract.Data#LOOKUP_KEY} and the
+    {@link android.provider.ContactsContract.Data#MIMETYPE Data.MIMETYPE} of the details you
+    want. Enclose the {@link android.provider.ContactsContract.Data#MIMETYPE MIMETYPE} value in
+    single quotes by concatenating a "<code>'</code>" (single-quote) character to the start and end
+    of the constant; otherwise, the provider interprets the constant as a variable name rather
+    than as a string value. You don't need to use a placeholder for this value, because you're
+    using a constant rather than a user-supplied value. For example:
+</p>
+<pre>
+    /*
+     * Defines the selection clause. Search for a lookup key
+     * and the Email MIME type
+     */
+    private static final String SELECTION =
+            Data.LOOKUP_KEY + " = ?" +
+            " AND " +
+            Data.MIMETYPE + " = " +
+            "'" + Email.CONTENT_ITEM_TYPE + "'";
+    // Defines the array to hold the search criteria
+    private String[] mSelectionArgs = { "" };
+</pre>
+<h3>Define a sort order</h3>
+<p>
+    Define a sort order for the returned {@link android.database.Cursor}. Since you're retrieving a
+    specific data type, omit the sort on {@link android.provider.ContactsContract.Data#MIMETYPE}.
+    Instead, if the type of detail data you're searching includes a subtype, sort on it.
+    For example, for email data you can sort on
+    {@link android.provider.ContactsContract.CommonDataKinds.Email#TYPE Email.TYPE}:
+</p>
+<pre>
+    private static final String SORT_ORDER = Email.TYPE + " ASC ";
+</pre>
diff --git a/docs/html/training/contacts-provider/retrieve-names.jd b/docs/html/training/contacts-provider/retrieve-names.jd
new file mode 100644
index 0000000..b034a6a
--- /dev/null
+++ b/docs/html/training/contacts-provider/retrieve-names.jd
@@ -0,0 +1,815 @@
+page.title=Retrieving a List of Contacts
+
+trainingnavtop=true
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<!-- table of contents -->
+<h2>This lesson teaches you to</h2>
+<ol>
+  <li><a href="#Permissions">Request Permission to Read the Provider</a>
+  <li><a href="#NameMatch">Match a Contact by Name and List the Results</a></li>
+  <li><a href="#TypeMatch">Match a Contact By a Specific Type of Data</a></li>
+  <li><a href="#GeneralMatch">Match a Contact By Any Type of Data</a></li>
+</ol>
+
+<!-- other docs (NOT javadocs) -->
+<h2>You should also read</h2>
+<ul>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/content-provider-basics.html">
+        Content Provider Basics</a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/topics/providers/contacts-provider.html">
+        Contacts Provider</a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/components/loaders.html">Loaders</a>
+    </li>
+    <li>
+        <a href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</a>
+    </li>
+</ul>
+
+<h2>Try it out</h2>
+
+<div class="download-box">
+    <a href="http://developer.android.com/shareables/training/ContactsList.zip" class="button">
+    Download the sample
+    </a>
+ <p class="filename">ContactsList.zip</p>
+</div>
+
+</div>
+</div>
+<p>
+    This lesson shows you how to retrieve a list of contacts whose data matches all or part of a
+    search string, using the following techniques:
+</p>
+<dl>
+    <dt>Match contact names</dt>
+    <dd>
+        Retrieve a list of contacts by matching the search string to all or part of the contact
+        name data. The Contacts Provider allows multiple instances of the same name, so this
+        technique can return a list of matches.
+    </dd>
+    <dt>Match a specific type of data, such as a phone number</dt>
+    <dd>
+        Retrieve a list of contacts by matching the search string to a particular type of detail
+        data such as an email address. For example, this technique allows you to list all of the
+        contacts whose email address matches the search string.
+    </dd>
+    <dt>Match any type of data</dt>
+    <dd>
+        Retrieve a list of contacts by matching the search string to any type of detail data,
+        including name, phone number, street address, email address, and so forth. For example,
+        this technique allows you to accept any type of data for a search string and then list the
+        contacts for which the data matches the string.
+    </dd>
+</dl>
+<p class="note">
+    <strong>Note:</strong> All the examples in this lesson use a
+    {@link android.support.v4.content.CursorLoader} to retrieve data from the Contacts
+    Provider. A {@link android.support.v4.content.CursorLoader} runs its query on a
+    thread that's separate from the UI thread. This ensures that the query doesn't slow down UI
+    response times and cause a poor user experience. For more information, see the Android
+    training class <a href="{@docRoot}training/load-data-background/index.html">
+    Loading Data in the Background</a>.
+</p>
+<h2 id="Permissions">Request Permission to Read the Provider</h2>
+<p>
+    To do any type of search of the Contacts Provider, your app must have
+    {@link android.Manifest.permission#READ_CONTACTS READ_CONTACTS} permission.
+    To request this, add this
+<code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
+    element to your manifest file as a child element of
+<code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code>:
+</p>
+<pre>
+    &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
+</pre>
+<h2 id="NameMatch">Match a Contact by Name and List the Results</h2>
+<p>
+    This technique tries to match a search string to the name of a contact or contacts in the
+    Contact Provider's {@link android.provider.ContactsContract.Contacts} table. You usually want
+    to display the results in a {@link android.widget.ListView}, to allow the user to choose among
+    the matched contacts.
+</p>
+<h3 id="DefineListView">Define ListView and item layouts</h3>
+<p>
+    To display the search results in a {@link android.widget.ListView}, you need a main layout file
+    that defines the entire UI including the {@link android.widget.ListView}, and an item layout
+    file that defines one line of the {@link android.widget.ListView}. For example, you can define
+    the main layout file <code>res/layout/contacts_list_view.xml</code> that contains the
+    following XML:
+</p>
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;ListView xmlns:android="http://schemas.android.com/apk/res/android"
+          android:id="&#64;android:id/list"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"/&gt;
+</pre>
+<p>
+    This XML uses the built-in Android {@link android.widget.ListView} widget
+    {@link android.R.id#list android:id/list}.
+</p>
+<p>
+    Define the item layout file <code>contacts_list_item.xml</code> with the following XML:
+</p>
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
+&lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
+          android:id="&#64;android:id/text1"
+          android:layout_width="match_parent"
+          android:layout_height="wrap_content"
+          android:clickable="true"/&gt;
+</pre>
+<p>
+    This XML uses the built-in Android {@link android.widget.TextView} widget
+    {@link android.R.id#text1 android:text1}.
+</p>
+<p class="note">
+    <strong>Note:</strong> This lesson doesn't describe the UI for getting a search string from the
+    user, because you may want to get the string indirectly. For example, you can give the user
+    an option to search for contacts whose name matches a string in an incoming text message.
+</p>
+<p>
+    The two layout files you've written define a user interface that shows a
+    {@link android.widget.ListView}. The next step is to write code that uses this UI to display a
+    list of contacts.
+</p>
+<h3 id="Fragment">Define a Fragment that displays the list of contacts</h3>
+<p>
+    To display the list of contacts, start by defining a {@link android.support.v4.app.Fragment}
+    that's loaded by an {@link android.app.Activity}. Using a
+    {@link android.support.v4.app.Fragment} is a more flexible technique, because you can use
+    one {@link android.support.v4.app.Fragment} to display the list and a second
+    {@link android.support.v4.app.Fragment} to display the details for a contact that the user
+    chooses from the list. Using this approach, you can combine one of the techniques presented in
+    this lesson with one from the lesson <a href="retrieve-details.html">
+    Retrieving Details for a Contact</a>.
+</p>
+<p>
+    To learn how to use one or more {@link android.support.v4.app.Fragment} objects from an
+    an {@link android.app.Activity}, read the training class
+    <a href="{@docRoot}training/basics/fragments/index.html">
+    Building a Dynamic UI with Fragments</a>.
+</p>
+<p>
+    To help you write queries against the Contacts Provider, the Android framework provides a
+    contracts class called {@link android.provider.ContactsContract}, which defines useful
+    constants and methods for accessing the provider. When you use this class, you don't have to
+    define your own constants for content URIs, table names, or columns. To use this class,
+    include the following statement:
+</p>
+<pre>
+import android.provider.ContactsContract;
+</pre>
+<p>
+    Since the code uses a {@link android.support.v4.content.CursorLoader} to retrieve data
+    from the provider, you must specify that it implements the loader interface
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks}. Also, to help detect which contact
+    the user selects from the list of search results, implement the adapter interface
+    {@link android.widget.AdapterView.OnItemClickListener}. For example:
+</p>
+<pre>
+...
+import android.support.v4.app.Fragment;
+import android.support.v4.app.LoaderManager.LoaderCallbacks;
+import android.widget.AdapterView;
+...
+public class ContactsFragment extends Fragment implements
+        LoaderManager.LoaderCallbacks&lt;Cursor&gt;,
+        AdapterView.OnItemClickListener {
+</pre>
+<h3 id="DefineVariables">Define global variables</h3>
+<p>
+    Define global variables that are used in other parts of the code:
+</p>
+<pre>
+    ...
+    /*
+     * Defines an array that contains column names to move from
+     * the Cursor to the ListView.
+     */
+    &#64;SuppressLint("InlinedApi")
+    private final static String[] FROM_COLUMNS = {
+            Build.VERSION.SDK_INT
+                    &gt;= Build.VERSION_CODES.HONEYCOMB ?
+                    Contacts.DISPLAY_NAME_PRIMARY :
+                    Contacts.DISPLAY_NAME
+    };
+    /*
+     * Defines an array that contains resource ids for the layout views
+     * that get the Cursor column contents. The id is pre-defined in
+     * the Android framework, so it is prefaced with "android.R.id"
+     */
+    private final static int[] TO_IDS = {
+           android.R.id.text1
+    };
+    // Define global mutable variables
+    // Define a ListView object
+    ListView mContactsList;
+    // Define variables for the contact the user selects
+    // The contact's _ID value
+    long mContactId;
+    // The contact's LOOKUP_KEY
+    String mContactKey;
+    // A content URI for the selected contact
+    Uri mContactUri;
+    // An adapter that binds the result Cursor to the ListView
+    private SimpleCursorAdapter mCursorAdapter;
+    ...
+</pre>
+<p class="note">
+    <strong>Note:</strong> Since
+    {@link android.provider.ContactsContract.Contacts#DISPLAY_NAME_PRIMARY
+    Contacts.DISPLAY_NAME_PRIMARY} requires Android 3.0 (API version 11) or later, setting your
+    app's <code>minSdkVersion</code> to 10 or below generates an Android Lint warning in
+    Eclipse with ADK. To turn off this warning, add the annotation
+    <code>@SuppressLint("InlinedApi")</code> before the definition of <code>FROM_COLUMNS</code>.
+</p>
+<h3 id="InitializeFragment">Initialize the Fragment</h3>
+<p>
+
+    Initialize the {@link android.support.v4.app.Fragment}. Add the empty, public constructor
+    required by the Android system, and inflate the {@link android.support.v4.app.Fragment} object's
+    UI in the callback method {@link android.support.v4.app.Fragment#onCreateView onCreateView()}.
+    For example:
+</p>
+<pre>
+    // Empty public constructor, required by the system
+    public ContactsFragment() {}
+
+    // A UI Fragment must inflate its View
+    &#64;Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+            Bundle savedInstanceState) {
+        // Inflate the fragment layout
+        return inflater.inflate(R.layout.contacts_list_layout, container, false);
+    }
+</pre>
+<h3 id="DefineAdapter">Set up the CursorAdapter for the ListView</h3>
+<p>
+    Set up the {@link android.support.v4.widget.SimpleCursorAdapter} that binds the results of the
+    search to the {@link android.widget.ListView}. To get the {@link android.widget.ListView} object
+    that displays the contacts, you need to call {@link android.app.Activity#findViewById
+    Activity.findViewById()} using the parent activity of the
+    {@link android.support.v4.app.Fragment}. Use the {@link android.content.Context} of the
+    parent activity when you call {@link android.widget.ListView#setAdapter setAdapter()}.
+    For example:
+</p>
+<pre>
+    public void onActivityCreated(Bundle savedInstanceState) {
+        super.onActivityCreated(savedInstanceState);
+        ...
+        // Gets the ListView from the View list of the parent activity
+        mContactsList = (ListView) getActivity().findViewById(R.layout.contact_list_view);
+        // Gets a CursorAdapter
+        mCursorAdapter = new SimpleCursorAdapter(
+                getActivity(),
+                R.layout.contact_list_item,
+                null,
+                FROM_COLUMNS, TO_IDS,
+                0);
+        // Sets the adapter for the ListView
+        mContactsList.setAdapter(mCursorAdapter);
+    }
+</pre>
+<h3 id="SetListener">Set the selected contact listener</h3>
+<p>
+    When you display the results of a search, you usually want to allow the user to select a
+    single contact for further processing. For example, when the user clicks a contact you can
+    display the contact's address on a map. To provide this feature, you first defined the current
+    {@link android.support.v4.app.Fragment} as the click listener by specifying that the class
+    implements {@link android.widget.AdapterView.OnItemClickListener}, as shown in the section
+    <a href="#Fragment">Define a Fragment that displays the list of contacts</a>.
+</p>
+<p>
+    To continue setting up the listener, bind it to the {@link android.widget.ListView} by
+    calling the method {@link android.widget.ListView#setOnItemClickListener
+    setOnItemClickListener()} in {@link android.support.v4.app.Fragment#onActivityCreated
+    onActivityCreated()}. For example:
+</p>
+<pre>
+    public void onActivityCreated(Bundle savedInstanceState) {
+        ...
+        // Set the item click listener to be the current fragment.
+        mContactsList.setOnItemClickListener(this);
+        ...
+    }
+</pre>
+<p>
+    Since you specified that the current {@link android.support.v4.app.Fragment} is the
+    {@link android.widget.AdapterView.OnItemClickListener OnItemClickListener} for the
+    {@link android.widget.ListView}, you now need to implement its required method
+    {@link android.widget.AdapterView.OnItemClickListener#onItemClick onItemClick()}, which
+    handles the click event. This is described in a succeeding section.
+</p>
+<h3 id="DefineProjection">Define a projection</h3>
+<p>
+    Define a constant that contains the columns you want to return from your query. Each item in
+    the {@link android.widget.ListView} displays the contact's display name,
+    which contains the main form of the contact's name. In Android 3.0 (API version 11) and later,
+    the name of this column is
+    {@link android.provider.ContactsContract.Contacts#DISPLAY_NAME_PRIMARY
+    Contacts.DISPLAY_NAME_PRIMARY}; in versions previous to that, its name is
+    {@link android.provider.ContactsContract.Contacts#DISPLAY_NAME Contacts.DISPLAY_NAME}.
+</p>
+<p>
+    The column {@link android.provider.ContactsContract.Contacts#_ID Contacts._ID} is used by the
+    {@link android.support.v4.widget.SimpleCursorAdapter} binding process.
+    {@link android.provider.ContactsContract.Contacts#_ID Contacts._ID} and
+    {@link android.provider.ContactsContract.Contacts#LOOKUP_KEY} are used together to
+    construct a content URI for the contact the user selects.
+</p>
+<pre>
+...
+&#64;SuppressLint("InlinedApi")
+private static final String[] PROJECTION =
+        {
+            Contacts._ID,
+            Contacts.LOOKUP_KEY,
+            Build.VERSION.SDK_INT
+                    &gt;= Build.VERSION_CODES.HONEYCOMB ?
+                    Contacts.DISPLAY_NAME_PRIMARY :
+                    Contacts.DISPLAY_NAME
+
+        };
+</pre>
+<h3 id="DefineConstants">Define constants for the Cursor column indexes</h3>
+<p>
+    To get data from an individual column in a {@link android.database.Cursor}, you need
+    the column's index within the {@link android.database.Cursor}. You can define constants
+    for the indexes of the {@link android.database.Cursor} columns, because the indexes are
+    the same as the order of the column names in your projection. For example:
+</p>
+<pre>
+// The column index for the _ID column
+private static final int CONTACT_ID_INDEX = 0;
+// The column index for the LOOKUP_KEY column
+private static final int LOOKUP_KEY_INDEX = 1;
+</pre>
+<h3 id="SelectionCriteria">Specify the selection criteria</h3>
+<p>
+    To specify the data you want, create a combination of text expressions and variables
+    that tell the provider the data columns to search and the values to find.
+</p>
+<p>
+    For the text expression, define a constant that lists the search columns. Although this
+    expression can contain values as well, the preferred practice is to represent the values with
+    a "?" placeholder. During retrieval, the placeholder is replaced with values from an
+    array. Using "?" as a placeholder ensures that the search specification is generated by binding
+    rather than by SQL compilation. This practice eliminates the possibility of malicious SQL
+    injection. For example:
+</p>
+<pre>
+    // Defines the text expression
+    &#64;SuppressLint("InlinedApi")
+    private static final String SELECTION =
+            Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB ?
+            Contacts.DISPLAY_NAME_PRIMARY + " LIKE ?" :
+            Contacts.DISPLAY_NAME + " LIKE ?";
+    // Defines a variable for the search string
+    private String mSearchString;
+    // Defines the array to hold values that replace the ?
+    private String[] mSelectionArgs = { mSearchString };
+</pre>
+<h3 id="OnItemClick">Define the onItemClick() method</h3>
+<p>
+    In a previous section, you set the item click listener for the {@link android.widget.ListView}.
+    Now implement the action for the listener by defining the method
+    {@link android.widget.AdapterView.OnItemClickListener#onItemClick
+    AdapterView.OnItemClickListener.onItemClick()}:
+</p>
+<pre>
+    &#64;Override
+    public void onItemClick(
+        AdapterView&lt;?&gt; parent, View item, int position, long rowID) {
+        // Get the Cursor
+        Cursor cursor = parent.getAdapter().getCursor();
+        // Move to the selected contact
+        cursor.moveToPosition(position);
+        // Get the _ID value
+        mContactId = getLong(CONTACT_ID_INDEX);
+        // Get the selected LOOKUP KEY
+        mContactKey = getString(CONTACT_KEY_INDEX);
+        // Create the contact's content Uri
+        mContactUri = Contacts.getLookupUri(mContactId, mContactKey);
+        /*
+         * You can use mContactUri as the content URI for retrieving
+         * the details for a contact.
+         */
+    }
+</pre>
+<h3 id="InitializeLoader">Initialize the loader</h3>
+<p>
+    Since you're using a {@link android.support.v4.content.CursorLoader} to retrieve data,
+    you must initialize the background thread and other variables that control asynchronous
+    retrieval. Do the initialization in
+    {@link android.support.v4.app.Fragment#onActivityCreated onActivityCreated()}, which
+    is invoked immediately before the {@link android.support.v4.app.Fragment} UI appears, as
+    shown in the following example:
+</p>
+<pre>
+public class ContactsFragment extends Fragment implements
+        LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
+    ...
+    // Called just before the Fragment displays its UI
+    &#64;Override
+    public void onActivityCreated(Bundle savedInstanceState) {
+        // Always call the super method first
+        super.onActivityCreated(savedInstanceState);
+        ...
+        // Initializes the loader
+        getLoaderManager().initLoader(0, null, this);
+</pre>
+<h3 id="OnCreateLoader">Implement onCreateLoader()</h3>
+<p>
+    Implement the method
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onCreateLoader onCreateLoader()},
+    which is called by the loader framework immediately after you call
+    {@link android.support.v4.app.LoaderManager#initLoader initLoader()}.
+<p>
+    In {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onCreateLoader onCreateLoader()},
+    set up the search string pattern. To make a string into a pattern, insert "%"
+    (percent) characters to represent a sequence of zero or more characters, or "_" (underscore)
+    characters to represent a single character, or both. For example, the pattern "%Jefferson%"
+    would match both "Thomas Jefferson" and "Jefferson Davis".
+</p>
+<p>
+    Return a new {@link android.support.v4.content.CursorLoader} from the method. For the content
+    URI, use {@link android.provider.ContactsContract.Contacts#CONTENT_URI Contacts.CONTENT_URI}.
+    This URI refers to the entire table, as shown in the following example:
+</p>
+<pre>
+    ...
+    &#64;Override
+    public Loader&lt;Cursor&gt; onCreateLoader(int loaderId, Bundle args) {
+        /*
+         * Makes search string into pattern and
+         * stores it in the selection array
+         */
+        mSelectionArgs[0] = "%" + mSearchString + "%";
+        // Starts the query
+        return new CursorLoader(
+                getActivity(),
+                Contacts.CONTENT_URI,
+                PROJECTION,
+                SELECTION,
+                mSelectionArgs,
+                null
+        );
+    }
+</pre>
+<h3 id="FinishedReset">Implement onLoadFinished() and onLoaderReset()</h3>
+<p>
+    Implement the
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished onLoadFinished()}
+    method. The loader framework calls
+    {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished onLoadFinished()}
+    when the Contacts Provider returns the results of the query. In this method, put the
+    result {@link android.database.Cursor} in the
+    {@link android.support.v4.widget.SimpleCursorAdapter}. This automatically updates the
+    {@link android.widget.ListView} with the search results:
+</p>
+<pre>
+    public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) {
+        // Put the result Cursor in the adapter for the ListView
+        mCursorAdapter.swapCursor(cursor);
+    }
+</pre>
+<p>
+    The method {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onLoaderReset
+    onLoaderReset()} is invoked when the loader framework detects that the
+    result {@link android.database.Cursor} contains stale data. Delete the
+    {@link android.support.v4.widget.SimpleCursorAdapter} reference to the existing
+    {@link android.database.Cursor}. If you don't, the loader framework will not
+    recycle the {@link android.database.Cursor}, which causes a memory leak. For example:
+</p>
+<pre>
+    &#64;Override
+    public void onLoaderReset(Loader&lt;Cursor&gt; loader) {
+        // Delete the reference to the existing Cursor
+        mCursorAdapter.swapCursor(null);
+
+    }
+</pre>
+
+<p>
+    You now have the key pieces of an app that matches a search string to contact names and returns
+    the result in a {@link android.widget.ListView}. The user can click a contact name to select it.
+    This triggers a listener, in which you can work further with the contact's data. For example,
+    you can retrieve the contact's details. To learn how to do this, continue with the next
+    lesson, <a href="#retrieve-details.html">Retrieving Details for a Contact</a>.
+</p>
+<p>
+    To learn more about search user interfaces, read the API guide
+    <a href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface</a>.
+</p>
+<p>
+    The remaining sections in this lesson demonstrate other ways of finding contacts in the
+    Contacts Provider.
+</p>
+<h2 id="TypeMatch">Match a Contact By a Specific Type of Data</h2>
+<p>
+    This technique allows you to specify the type of data you want to match. Retrieving
+    by name is a specific example of this type of query, but you can also do it for any of the types
+    of detail data associated with a contact. For example, you can retrieve contacts that have a
+    specific postal code; in this case, the search string has to match data stored in a postal code
+    row.
+</p>
+<p>
+    To implement this type of retrieval, first implement the following code, as listed in
+    previous sections:
+</p>
+<ul>
+    <li>
+        Request Permission to Read the Provider.
+    </li>
+    <li>
+        Define ListView and item layouts.
+    </li>
+    <li>
+        Define a Fragment that displays the list of contacts.
+    </li>
+    <li>
+        Define global variables.
+    </li>
+    <li>
+        Initialize the Fragment.
+    </li>
+    <li>
+        Set up the CursorAdapter for the ListView.
+    </li>
+    <li>
+        Set the selected contact listener.
+    </li>
+    <li>
+        Define constants for the Cursor column indexes.
+        <p>
+            Although you're retrieving data from a different table, the order of the columns in
+            the projection is the same, so you can use the same indexes for the Cursor.
+        </p>
+    </li>
+    <li>
+        Define the onItemClick() method.
+    </li>
+    <li>
+        Initialize the loader.
+    </li>
+    <li>
+
+        Implement onLoadFinished() and onLoaderReset().
+    </li>
+</ul>
+<p>
+    The following steps show you the additional code you need to match a search string to
+    a particular type of detail data and display the results.
+</p>
+<h3>Choose the data type and table</h3>
+<p>
+    To search for a particular type of detail data, you have to know the custom MIME type value
+    for the data type. Each data type has a unique MIME type
+    value defined by a constant <code>CONTENT_ITEM_TYPE</code> in the subclass of
+    {@link android.provider.ContactsContract.CommonDataKinds} associated with the data type.
+    The subclasses have names that indicate their data type; for example, the subclass for email
+    data is {@link android.provider.ContactsContract.CommonDataKinds.Email}, and the custom MIME
+    type for email data is defined by the constant
+    {@link android.provider.ContactsContract.CommonDataKinds.Email#CONTENT_ITEM_TYPE
+    Email.CONTENT_ITEM_TYPE}.
+</p>
+<p>
+    Use the {@link android.provider.ContactsContract.Data} table for your search. All of the
+    constants you need for your projection, selection clause, and sort order are defined in or
+    inherited by this table.
+</p>
+<h3 id="SpecificProjection">Define a projection</h3>
+<p>
+    To define a projection, choose one or more of the columns defined in
+    {@link android.provider.ContactsContract.Data} or the classes from which it inherits. The
+    Contacts Provider does an implicit join between {@link android.provider.ContactsContract.Data}
+    and other tables before it returns rows. For example:
+</p>
+<pre>
+    &#64;SuppressLint("InlinedApi")
+    private static final String[] PROJECTION =
+        {
+            /*
+             * The detail data row ID. To make a ListView work,
+             * this column is required.
+             */
+            Data._ID,
+            // The primary display name
+            Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB ?
+                    Data.DISPLAY_NAME_PRIMARY :
+                    Data.DISPLAY_NAME,
+            // The contact's _ID, to construct a content URI
+            Data.CONTACT_ID
+            // The contact's LOOKUP_KEY, to construct a content URI
+            Data.LOOKUP_KEY (a permanent link to the contact
+        };
+</pre>
+<h3 id="SpecificCriteria">Define search criteria</h3>
+<p>
+    To search for a string within a particular type of data, construct a selection clause from
+    the following:
+</p>
+<ul>
+    <li>
+        The name of the column that contains your search string. This name varies by data type,
+        so you need to find the subclass of
+        {@link android.provider.ContactsContract.CommonDataKinds} that corresponds to the data type
+        and then choose the column name from that subclass. For example, to search for
+        email addresses, use the column
+        {@link android.provider.ContactsContract.CommonDataKinds.Email#ADDRESS Email.ADDRESS}.
+    </li>
+    <li>
+        The search string itself, represented as the "?" character in the selection clause.
+    </li>
+    <li>
+        The name of the column that contains the custom MIME type value. This name is always
+        {@link android.provider.ContactsContract.Data#MIMETYPE Data.MIMETYPE}.
+    </li>
+    <li>
+        The custom MIME type value for the data type. As described previously, this is the constant
+        <code>CONTENT_ITEM_TYPE</code> in the
+        {@link android.provider.ContactsContract.CommonDataKinds} subclass. For example, the MIME
+        type value for email data is
+        {@link android.provider.ContactsContract.CommonDataKinds.Email#CONTENT_ITEM_TYPE
+        Email.CONTENT_ITEM_TYPE}. Enclose the value in single quotes by concatenating a
+        "<code>'</code>" (single quote) character to the start and end of the constant; otherwise,
+        the provider interprets the value as a variable name rather than as a string value.
+        You don't need to use a placeholder for this value, because you're using a constant
+        rather than a user-supplied value.
+    </li>
+</ul>
+<p>
+    For example:
+</p>
+<pre>
+    /*
+     * Constructs search criteria from the search string
+     * and email MIME type
+     */
+    private static final String SELECTION =
+            /*
+             * Searches for an email address
+             * that matches the search string
+             */
+            Email.ADDRESS + " LIKE ? " + "AND " +
+            /*
+             * Searches for a MIME type that matches
+             * the value of the constant
+             * Email.CONTENT_ITEM_TYPE. Note the
+             * single quotes surrounding Email.CONTENT_ITEM_TYPE.
+             */
+            Data.MIMETYPE + " = '" + Email.CONTENT_ITEM_TYPE + "'";
+</pre>
+<p>
+    Next, define variables to contain the selection argument:
+</p>
+<pre>
+    String mSearchString;
+    String[] mSelectionArgs = { "" };
+</pre>
+<h3 id="SpecificLoader">Implement onCreateLoader()</h3>
+<p>
+    Now that you've specified the data you want and how to find it, define a query in your
+    implementation of {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onCreateLoader
+    onCreateLoader()}. Return a new {@link android.support.v4.content.CursorLoader} from this
+    method, using your projection, selection text expression, and selection array as
+    arguments. For a content URI, use
+    {@link android.provider.ContactsContract.Data#CONTENT_URI Data.CONTENT_URI}. For example:
+</p>
+<pre>
+    &#64;Override
+    public Loader&lt;Cursor&gt; onCreateLoader(int loaderId, Bundle args) {
+        // OPTIONAL: Makes search string into pattern
+        mSearchString = "%" + mSearchString + "%";
+        // Puts the search string into the selection criteria
+        mSelectionArgs[0] = mSearchString;
+        // Starts the query
+        return new CursorLoader(
+                getActivity(),
+                Data.CONTENT_URI,
+                PROJECTION,
+                SELECTION,
+                mSelectionArgs,
+                null
+        );
+    }
+</pre>
+<p>
+    These code snippets are the basis of a simple reverse lookup based on a specific type of detail
+    data. This is the best technique to use if your app focuses on a particular type of data, such
+    as emails, and you want allow users to get the names associated with a piece of data.
+</p>
+<h2 id="GeneralMatch">Match a Contact By Any Type of Data</h2>
+<p>
+    Retrieving a contact based on any type of data returns contacts if any of their data matches a
+    the search string, including name, email address, postal address, phone number, and so forth.
+    This results in a broad set of search results. For example, if the search string
+    is "Doe", then searching for any data type returns the contact "John Doe"; it also returns
+    contacts who live on "Doe Street".
+</p>
+<p>
+    To implement this type of retrieval, first implement the following code, as listed in
+    previous sections:
+</p>
+<ul>
+    <li>
+        Request Permission to Read the Provider.
+    </li>
+    <li>
+        Define ListView and item layouts.
+    </li>
+    <li>
+    <li>
+        Define a Fragment that displays the list of contacts.
+    </li>
+    <li>
+        Define global variables.
+    </li>
+    <li>
+        Initialize the Fragment.
+    </li>
+    <li>
+        Set up the CursorAdapter for the ListView.
+    </li>
+    <li>
+        Set the selected contact listener.
+    </li>
+    <li>
+        Define a projection.
+    </li>
+    <li>
+        Define constants for the Cursor column indexes.
+        <p>
+            For this type of retrieval, you're using the same table you used in the section
+            <a href="#NameMatch">Match a Contact by Name and List the Results</a>. Use the
+            same column indexes as well.
+        </p>
+    </li>
+    <li>
+        Define the onItemClick() method.
+    </li>
+    <li>
+        Initialize the loader.
+    </li>
+    <li>
+
+        Implement onLoadFinished() and onLoaderReset().
+    </li>
+</ul>
+<p>
+    The following steps show you the additional code you need to match a search string to
+    any type of data and display the results.
+</p>
+<h3 id="NoSelection">Remove selection criteria</h3>
+<p>
+    Don't define the <code>SELECTION</code> constants or the <code>mSelectionArgs</code> variable.
+    These aren't used in this type of retrieval.
+</p>
+<h3 id="CreateLoaderAny">Implement onCreateLoader()</h3>
+<p>
+    Implement the {@link android.support.v4.app.LoaderManager.LoaderCallbacks#onCreateLoader
+    onCreateLoader()} method, returning a new {@link android.support.v4.content.CursorLoader}.
+    You don't need to convert the search string into a pattern, because the Contacts Provider does
+    that automatically. Use
+    {@link android.provider.ContactsContract.Contacts#CONTENT_FILTER_URI
+    Contacts.CONTENT_FILTER_URI} as the base URI, and append your search string to it by calling
+    {@link android.net.Uri#withAppendedPath Uri.withAppendedPath()}. Using this URI
+    automatically triggers searching for any data type, as shown in the following example:
+</p>
+<pre>
+    &#64;Override
+    public Loader&lt;Cursor&gt; onCreateLoader(int loaderId, Bundle args) {
+        /*
+         * Appends the search string to the base URI. Always
+         * encode search strings to ensure they're in proper
+         * format.
+         */
+        Uri contentUri = Uri.withAppendedPath(
+                Contacts.CONTENT_FILTER_URI,
+                Uri.encode(mSearchString));
+        // Starts the query
+        return new CursorLoader(
+                getActivity(),
+                contentUri,
+                PROJECTION,
+                null,
+                null,
+                null
+        );
+    }
+</pre>
+<p>
+    These code snippets are the basis of an app that does a broad search of the Contacts Provider.
+    The technique is useful for apps that want to implement functionality similar to the
+    People app's contact list screen.
+</p>
diff --git a/docs/html/training/displaying-bitmaps/index.jd b/docs/html/training/displaying-bitmaps/index.jd
index a828291..857edee 100644
--- a/docs/html/training/displaying-bitmaps/index.jd
+++ b/docs/html/training/displaying-bitmaps/index.jd
@@ -1,9 +1,8 @@
 page.title=Displaying Bitmaps Efficiently
+page.tags="bitmaps","images","graphics"
 
 trainingnavtop=true
 startpage=true
-next.title=Loading Large Bitmaps Efficiently
-next.link=load-bitmap.html
 
 @jd:body
 
diff --git a/docs/html/training/efficient-downloads/index.jd b/docs/html/training/efficient-downloads/index.jd
index a29be91..2ab93ae 100644
--- a/docs/html/training/efficient-downloads/index.jd
+++ b/docs/html/training/efficient-downloads/index.jd
@@ -1,9 +1,8 @@
 page.title=Transferring Data Without Draining the Battery
+page.tags="battery","network","wireless"
 
 trainingnavtop=true
 startpage=true
-next.title=Optimizing Downloads for Efficient Network Access
-next.link=efficient-network-access.html
 
 @jd:body
 
diff --git a/docs/html/training/graphics/opengl/index.jd b/docs/html/training/graphics/opengl/index.jd
index 23a734a..cf33d80 100644
--- a/docs/html/training/graphics/opengl/index.jd
+++ b/docs/html/training/graphics/opengl/index.jd
@@ -1,7 +1,6 @@
 page.title=Displaying Graphics with OpenGL ES
+page=tags="open gl","graphics"
 trainingnavtop=true
-next.title=Building an OpenGL ES Environment
-next.link=environment.html
 
 @jd:body
 
diff --git a/docs/html/training/implementing-navigation/lateral.jd b/docs/html/training/implementing-navigation/lateral.jd
index 9a31d7a..c8f57a2 100644
--- a/docs/html/training/implementing-navigation/lateral.jd
+++ b/docs/html/training/implementing-navigation/lateral.jd
@@ -43,7 +43,8 @@
 
 <p>Tabs allow the user to navigate between sibling screens by selecting the appropriate tab indicator available at the top of the display. In Android 3.0 and later, tabs are implemented using the {@link android.app.ActionBar} class, and are generally set up in {@link android.app.Activity#onCreate Activity.onCreate()}. In some cases, such as when horizontal space is limited and/or the number of tabs is large, an appropriate alternate presentation for tabs is a dropdown list (sometimes implemented using a {@link android.widget.Spinner}).</p>
 
-<p>In previous versions of Android, tabs could be implemented using a {@link android.widget.TabWidget} and {@link android.widget.TabHost}. For details, see the <a href="{@docRoot}resources/tutorials/views/hello-tabwidget.html">Hello, Views</a> tutorial.</p>
+<p>In previous versions of Android, tabs could be implemented using a
+{@link android.widget.TabWidget} and {@link android.widget.TabHost}.</p>
 
 <p>As of Android 3.0, however, you should use either {@link android.app.ActionBar#NAVIGATION_MODE_TABS} or {@link android.app.ActionBar#NAVIGATION_MODE_LIST} along with the {@link android.app.ActionBar} class.</p>
 
diff --git a/docs/html/training/managing-audio/index.jd b/docs/html/training/managing-audio/index.jd
index 0f7bbfd..3e3bcf0 100644
--- a/docs/html/training/managing-audio/index.jd
+++ b/docs/html/training/managing-audio/index.jd
@@ -1,9 +1,8 @@
 page.title=Managing Audio Playback
+page.tags="audio","media"
 
 trainingnavtop=true
 startpage=true
-next.title=Controlling Your App's Volume and Playback
-next.link=volume-playback.html
 
 @jd:body
 
diff --git a/docs/html/training/notify-user/build-notification.jd b/docs/html/training/notify-user/build-notification.jd
index ba66028..80f2cd5 100644
--- a/docs/html/training/notify-user/build-notification.jd
+++ b/docs/html/training/notify-user/build-notification.jd
@@ -149,12 +149,14 @@
 <p>For example:</p>
 
 <pre>
+NotificationCompat.Builder mBuilder;
+...
 // Sets an ID for the notification
 int mNotificationId = 001;
 // Gets an instance of the NotificationManager service
 NotificationManager mNotifyMgr = 
         (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 // Builds the notification and issues it.
-mNotifyMgr.notify(mNotificationId, builder.build());
+mNotifyMgr.notify(mNotificationId, mBuilder.build());
 </pre>
 
diff --git a/docs/html/training/sharing/index.jd b/docs/html/training/sharing/index.jd
index c2e8dbc..2aa22b6 100644
--- a/docs/html/training/sharing/index.jd
+++ b/docs/html/training/sharing/index.jd
@@ -1,9 +1,8 @@
 page.title=Sharing Content
+page.tags="intents","share"
 
 trainingnavtop=true
 startpage=true
-next.title=Sending Content to Other Apps
-next.link=send.html
 
 @jd:body
 
diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs
index 985fc44..7a3f2ca 100644
--- a/docs/html/training/training_toc.cs
+++ b/docs/html/training/training_toc.cs
@@ -484,7 +484,37 @@
       </a>
     </div>
     <ul>
-    
+      <li class="nav-section">
+        <div class="nav-section-header">
+          <a href="<?cs var:toroot ?>training/contacts-provider/index.html"
+             description=
+             "How to use Android's central address book, the Contacts Provider, to
+             display contacts and their details and modify contact information.">
+          Accessing Contacts Data</a>
+        </div>
+        <ul>
+          <li>
+                <a href="<?cs var:toroot ?>training/contacts-provider/retrieve-names.html">
+                Retrieving a List of Contacts
+                </a>
+          </li>
+          <li>
+                <a href="<?cs var:toroot ?>training/contacts-provider/retrieve-details.html">
+                Retrieving Details for a Contact
+                </a>
+          </li>
+          <li>
+                <a href="<?cs var:toroot ?>training/contacts-provider/modify-data.html">
+                Modifying Contacts Using Intents
+                </a>
+          </li>
+          <li>
+                <a href="<?cs var:toroot ?>training/contacts-provider/display-contact-badge.html">
+                Displaying the Quick Contact Badge
+                </a>
+          </li>
+        </ul>
+      </li>
       <li class="nav-section">
         <div class="nav-section-header">
           <a href="<?cs var:toroot ?>training/id-auth/index.html"
@@ -879,7 +909,7 @@
         </ul>
       </li>
     </ul>
-  </li> <!-- end of User Input -->    
+  </li> <!-- end of User Input -->
 
   <li class="nav-section">
     <div class="nav-section-header">
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 216dc6c..d5cee3a 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -1717,20 +1717,6 @@
     public float getTextRunAdvances(char[] chars, int index, int count,
             int contextIndex, int contextCount, int flags, float[] advances,
             int advancesIndex) {
-        return getTextRunAdvances(chars, index, count, contextIndex, contextCount, flags,
-                advances, advancesIndex, 0 /* use Harfbuzz*/);
-    }
-
-    /**
-     * Convenience overload that takes a char array instead of a
-     * String.
-     *
-     * @see #getTextRunAdvances(String, int, int, int, int, int, float[], int, int)
-     * @hide
-     */
-    public float getTextRunAdvances(char[] chars, int index, int count,
-            int contextIndex, int contextCount, int flags, float[] advances,
-            int advancesIndex, int reserved) {
 
         if (chars == null) {
             throw new IllegalArgumentException("text cannot be null");
@@ -1752,13 +1738,13 @@
         }
         if (!mHasCompatScaling) {
             return native_getTextRunAdvances(mNativePaint, chars, index, count,
-                    contextIndex, contextCount, flags, advances, advancesIndex, reserved);
+                    contextIndex, contextCount, flags, advances, advancesIndex);
         }
 
         final float oldSize = getTextSize();
         setTextSize(oldSize * mCompatScaling);
         float res = native_getTextRunAdvances(mNativePaint, chars, index, count,
-                contextIndex, contextCount, flags, advances, advancesIndex, reserved);
+                contextIndex, contextCount, flags, advances, advancesIndex);
         setTextSize(oldSize);
 
         if (advances != null) {
@@ -1779,20 +1765,6 @@
     public float getTextRunAdvances(CharSequence text, int start, int end,
             int contextStart, int contextEnd, int flags, float[] advances,
             int advancesIndex) {
-        return getTextRunAdvances(text, start, end, contextStart, contextEnd, flags,
-                advances, advancesIndex, 0 /* use Harfbuzz */);
-    }
-
-    /**
-     * Convenience overload that takes a CharSequence instead of a
-     * String.
-     *
-     * @see #getTextRunAdvances(String, int, int, int, int, int, float[], int)
-     * @hide
-     */
-    public float getTextRunAdvances(CharSequence text, int start, int end,
-            int contextStart, int contextEnd, int flags, float[] advances,
-            int advancesIndex, int reserved) {
 
         if (text == null) {
             throw new IllegalArgumentException("text cannot be null");
@@ -1807,12 +1779,12 @@
 
         if (text instanceof String) {
             return getTextRunAdvances((String) text, start, end,
-                    contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+                    contextStart, contextEnd, flags, advances, advancesIndex);
         }
         if (text instanceof SpannedString ||
             text instanceof SpannableString) {
             return getTextRunAdvances(text.toString(), start, end,
-                    contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+                    contextStart, contextEnd, flags, advances, advancesIndex);
         }
         if (text instanceof GraphicsOperations) {
             return ((GraphicsOperations) text).getTextRunAdvances(start, end,
@@ -1827,7 +1799,7 @@
         char[] buf = TemporaryBuffer.obtain(contextLen);
         TextUtils.getChars(text, contextStart, contextEnd, buf, 0);
         float result = getTextRunAdvances(buf, start - contextStart, len,
-                0, contextLen, flags, advances, advancesIndex, reserved);
+                0, contextLen, flags, advances, advancesIndex);
         TemporaryBuffer.recycle(buf);
         return result;
     }
@@ -1876,55 +1848,6 @@
      */
     public float getTextRunAdvances(String text, int start, int end, int contextStart,
             int contextEnd, int flags, float[] advances, int advancesIndex) {
-        return getTextRunAdvances(text, start, end, contextStart, contextEnd, flags,
-                advances, advancesIndex, 0 /* use Harfbuzz*/);
-    }
-
-    /**
-     * Returns the total advance width for the characters in the run
-     * between start and end, and if advances is not null, the advance
-     * assigned to each of these characters (java chars).
-     *
-     * <p>The trailing surrogate in a valid surrogate pair is assigned
-     * an advance of 0.  Thus the number of returned advances is
-     * always equal to count, not to the number of unicode codepoints
-     * represented by the run.
-     *
-     * <p>In the case of conjuncts or combining marks, the total
-     * advance is assigned to the first logical character, and the
-     * following characters are assigned an advance of 0.
-     *
-     * <p>This generates the sum of the advances of glyphs for
-     * characters in a reordered cluster as the width of the first
-     * logical character in the cluster, and 0 for the widths of all
-     * other characters in the cluster.  In effect, such clusters are
-     * treated like conjuncts.
-     *
-     * <p>The shaping bounds limit the amount of context available
-     * outside start and end that can be used for shaping analysis.
-     * These bounds typically reflect changes in bidi level or font
-     * metrics across which shaping does not occur.
-     *
-     * @param text the text to measure. Cannot be null.
-     * @param start the index of the first character to measure
-     * @param end the index past the last character to measure
-     * @param contextStart the index of the first character to use for shaping context,
-     * must be <= start
-     * @param contextEnd the index past the last character to use for shaping context,
-     * must be >= end
-     * @param flags the flags to control the advances, either {@link #DIRECTION_LTR}
-     * or {@link #DIRECTION_RTL}
-     * @param advances array to receive the advances, must have room for all advances,
-     * can be null if only total advance is needed
-     * @param advancesIndex the position in advances at which to put the
-     * advance corresponding to the character at start
-     * @param reserved int reserved value
-     * @return the total advance
-     *
-     * @hide
-     */
-    public float getTextRunAdvances(String text, int start, int end, int contextStart,
-            int contextEnd, int flags, float[] advances, int advancesIndex, int reserved) {
 
         if (text == null) {
             throw new IllegalArgumentException("text cannot be null");
@@ -1946,13 +1869,13 @@
 
         if (!mHasCompatScaling) {
             return native_getTextRunAdvances(mNativePaint, text, start, end,
-                    contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+                    contextStart, contextEnd, flags, advances, advancesIndex);
         }
 
         final float oldSize = getTextSize();
         setTextSize(oldSize * mCompatScaling);
         float totalAdvance = native_getTextRunAdvances(mNativePaint, text, start, end,
-                contextStart, contextEnd, flags, advances, advancesIndex, reserved);
+                contextStart, contextEnd, flags, advances, advancesIndex);
         setTextSize(oldSize);
 
         if (advances != null) {
@@ -2227,10 +2150,10 @@
 
     private static native float native_getTextRunAdvances(int native_object,
             char[] text, int index, int count, int contextIndex, int contextCount,
-            int flags, float[] advances, int advancesIndex, int reserved);
+            int flags, float[] advances, int advancesIndex);
     private static native float native_getTextRunAdvances(int native_object,
             String text, int start, int end, int contextStart, int contextEnd,
-            int flags, float[] advances, int advancesIndex, int reserved);
+            int flags, float[] advances, int advancesIndex);
 
     private native int native_getTextRunCursor(int native_object, char[] text,
             int contextStart, int contextLength, int flags, int offset, int cursorOpt);
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 37f2250..c90f400 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -146,6 +146,10 @@
 
         if (oldBounds.left != left || oldBounds.top != top ||
                 oldBounds.right != right || oldBounds.bottom != bottom) {
+            if (!oldBounds.isEmpty()) {
+                // first invalidate the previous bounds
+                invalidateSelf();
+            }
             mBounds.set(left, top, right, bottom);
             onBoundsChange(mBounds);
         }
diff --git a/graphics/java/android/renderscript/Type.java b/graphics/java/android/renderscript/Type.java
index 9507030..d7c8255 100644
--- a/graphics/java/android/renderscript/Type.java
+++ b/graphics/java/android/renderscript/Type.java
@@ -110,6 +110,16 @@
     }
 
     /**
+     * Get the YUV format
+     *
+     * @hide
+     * @return int
+     */
+    public int getYuv() {
+        return mDimYuv;
+    }
+
+    /**
      * Return if the Type has a mipmap chain.
      *
      * @return boolean
diff --git a/keystore/java/android/security/AndroidKeyStore.java b/keystore/java/android/security/AndroidKeyStore.java
index 65d7b8f..8a9826b 100644
--- a/keystore/java/android/security/AndroidKeyStore.java
+++ b/keystore/java/android/security/AndroidKeyStore.java
@@ -453,17 +453,19 @@
          * convention.
          */
         final String[] certAliases = mKeyStore.saw(Credentials.USER_CERTIFICATE);
-        for (String alias : certAliases) {
-            final byte[] certBytes = mKeyStore.get(Credentials.USER_CERTIFICATE + alias);
-            if (certBytes == null) {
-                continue;
-            }
+        if (certAliases != null) {
+            for (String alias : certAliases) {
+                final byte[] certBytes = mKeyStore.get(Credentials.USER_CERTIFICATE + alias);
+                if (certBytes == null) {
+                    continue;
+                }
 
-            final Certificate c = toCertificate(certBytes);
-            nonCaEntries.add(alias);
+                final Certificate c = toCertificate(certBytes);
+                nonCaEntries.add(alias);
 
-            if (cert.equals(c)) {
-                return alias;
+                if (cert.equals(c)) {
+                    return alias;
+                }
             }
         }
 
@@ -472,19 +474,22 @@
          * PrivateKeyEntry we looked at above.
          */
         final String[] caAliases = mKeyStore.saw(Credentials.CA_CERTIFICATE);
-        for (String alias : caAliases) {
-            if (nonCaEntries.contains(alias)) {
-                continue;
-            }
+        if (certAliases != null) {
+            for (String alias : caAliases) {
+                if (nonCaEntries.contains(alias)) {
+                    continue;
+                }
 
-            final byte[] certBytes = mKeyStore.get(Credentials.CA_CERTIFICATE + alias);
-            if (certBytes == null) {
-                continue;
-            }
+                final byte[] certBytes = mKeyStore.get(Credentials.CA_CERTIFICATE + alias);
+                if (certBytes == null) {
+                    continue;
+                }
 
-            final Certificate c = toCertificate(mKeyStore.get(Credentials.CA_CERTIFICATE + alias));
-            if (cert.equals(c)) {
-                return alias;
+                final Certificate c =
+                        toCertificate(mKeyStore.get(Credentials.CA_CERTIFICATE + alias));
+                if (cert.equals(c)) {
+                    return alias;
+                }
             }
         }
 
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index 4b69317..12c0ed8 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -87,9 +87,22 @@
         }
     }
 
-    public boolean put(String key, byte[] value) {
+    public boolean put(String key, byte[] value, int uid) {
         try {
-            return mBinder.insert(key, value, -1) == NO_ERROR;
+            return mBinder.insert(key, value, uid) == NO_ERROR;
+        } catch (RemoteException e) {
+            Log.w(TAG, "Cannot connect to keystore", e);
+            return false;
+        }
+    }
+
+    public boolean put(String key, byte[] value) {
+        return put(key, value, -1);
+    }
+
+    public boolean delete(String key, int uid) {
+        try {
+            return mBinder.del(key, uid) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -97,8 +110,12 @@
     }
 
     public boolean delete(String key) {
+        return delete(key, -1);
+    }
+
+    public boolean contains(String key, int uid) {
         try {
-            return mBinder.del(key, -1) == NO_ERROR;
+            return mBinder.exist(key, uid) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -106,23 +123,22 @@
     }
 
     public boolean contains(String key) {
-        try {
-            return mBinder.exist(key, -1) == NO_ERROR;
-        } catch (RemoteException e) {
-            Log.w(TAG, "Cannot connect to keystore", e);
-            return false;
-        }
+        return contains(key, -1);
     }
 
-    public String[] saw(String prefix) {
+    public String[] saw(String prefix, int uid) {
         try {
-            return mBinder.saw(prefix, -1);
+            return mBinder.saw(prefix, uid);
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return null;
         }
     }
 
+    public String[] saw(String prefix) {
+        return saw(prefix, -1);
+    }
+
     public boolean reset() {
         try {
             return mBinder.reset() == NO_ERROR;
@@ -169,9 +185,22 @@
         }
     }
 
-    public boolean generate(String key) {
+    public boolean generate(String key, int uid) {
         try {
-            return mBinder.generate(key, -1) == NO_ERROR;
+            return mBinder.generate(key, uid) == NO_ERROR;
+        } catch (RemoteException e) {
+            Log.w(TAG, "Cannot connect to keystore", e);
+            return false;
+        }
+    }
+
+    public boolean generate(String key) {
+        return generate(key, -1);
+    }
+
+    public boolean importKey(String keyName, byte[] key, int uid) {
+        try {
+            return mBinder.import_key(keyName, key, uid) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
@@ -179,12 +208,7 @@
     }
 
     public boolean importKey(String keyName, byte[] key) {
-        try {
-            return mBinder.import_key(keyName, key, -1) == NO_ERROR;
-        } catch (RemoteException e) {
-            Log.w(TAG, "Cannot connect to keystore", e);
-            return false;
-        }
+        return importKey(keyName, key, -1);
     }
 
     public byte[] getPubkey(String key) {
@@ -196,15 +220,19 @@
         }
     }
 
-    public boolean delKey(String key) {
+    public boolean delKey(String key, int uid) {
         try {
-            return mBinder.del_key(key, -1) == NO_ERROR;
+            return mBinder.del_key(key, uid) == NO_ERROR;
         } catch (RemoteException e) {
             Log.w(TAG, "Cannot connect to keystore", e);
             return false;
         }
     }
 
+    public boolean delKey(String key) {
+        return delKey(key, -1);
+    }
+
     public byte[] sign(String key, byte[] data) {
         try {
             return mBinder.sign(key, data);
@@ -259,6 +287,15 @@
         }
     }
 
+    public boolean duplicate(String srcKey, int srcUid, String destKey, int destUid) {
+        try {
+            return mBinder.duplicate(srcKey, srcUid, destKey, destUid) == NO_ERROR;
+        } catch (RemoteException e) {
+            Log.w(TAG, "Cannot connect to keystore", e);
+            return false;
+        }
+    }
+
     public int getLastError() {
         return mError;
     }
diff --git a/keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java b/keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java
index cd031b4..69007c4 100644
--- a/keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java
+++ b/keystore/tests/src/android/security/AndroidKeyPairGeneratorTest.java
@@ -67,7 +67,9 @@
         assertTrue(mAndroidKeyStore.password("1111"));
         assertTrue(mAndroidKeyStore.isUnlocked());
 
-        assertEquals(0, mAndroidKeyStore.saw("").length);
+        String[] aliases = mAndroidKeyStore.saw("");
+        assertNotNull(aliases);
+        assertEquals(0, aliases.length);
 
         mGenerator = java.security.KeyPairGenerator.getInstance(AndroidKeyPairGenerator.NAME);
     }
diff --git a/keystore/tests/src/android/security/KeyStoreTest.java b/keystore/tests/src/android/security/KeyStoreTest.java
index 07a2d7b..1de1eaf 100644
--- a/keystore/tests/src/android/security/KeyStoreTest.java
+++ b/keystore/tests/src/android/security/KeyStoreTest.java
@@ -17,6 +17,7 @@
 package android.security;
 
 import android.app.Activity;
+import android.os.Process;
 import android.security.KeyStore;
 import android.test.ActivityUnitTestCase;
 import android.test.AssertionFailedError;
@@ -128,7 +129,7 @@
         super.tearDown();
     }
 
-    public void teststate() throws Exception {
+    public void testState() throws Exception {
         assertEquals(KeyStore.State.UNINITIALIZED, mKeyStore.state());
     }
 
@@ -154,6 +155,24 @@
         assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME)));
     }
 
+    public void testPut_grantedUid_Wifi() throws Exception {
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        mKeyStore.password(TEST_PASSWD);
+        assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+    }
+
+    public void testPut_ungrantedUid_Bluetooth() throws Exception {
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        mKeyStore.password(TEST_PASSWD);
+        assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+    }
+
     public void testI18n() throws Exception {
         assertFalse(mKeyStore.put(TEST_I18N_KEY, TEST_I18N_VALUE));
         assertFalse(mKeyStore.contains(TEST_I18N_KEY));
@@ -167,22 +186,64 @@
         mKeyStore.password(TEST_PASSWD);
         assertFalse(mKeyStore.delete(TEST_KEYNAME));
 
-        mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE);
+        assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE));
         assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME)));
         assertTrue(mKeyStore.delete(TEST_KEYNAME));
         assertNull(mKeyStore.get(TEST_KEYNAME));
     }
 
+    public void testDelete_grantedUid_Wifi() throws Exception {
+        assertFalse(mKeyStore.delete(TEST_KEYNAME, Process.WIFI_UID));
+        mKeyStore.password(TEST_PASSWD);
+        assertFalse(mKeyStore.delete(TEST_KEYNAME, Process.WIFI_UID));
+
+        assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertTrue(mKeyStore.delete(TEST_KEYNAME, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+    }
+
+    public void testDelete_ungrantedUid_Bluetooth() throws Exception {
+        assertFalse(mKeyStore.delete(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        mKeyStore.password(TEST_PASSWD);
+        assertFalse(mKeyStore.delete(TEST_KEYNAME, Process.BLUETOOTH_UID));
+
+        assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.delete(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+    }
+
     public void testContains() throws Exception {
         assertFalse(mKeyStore.contains(TEST_KEYNAME));
 
-        mKeyStore.password(TEST_PASSWD);
+        assertTrue(mKeyStore.password(TEST_PASSWD));
         assertFalse(mKeyStore.contains(TEST_KEYNAME));
 
-        mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE);
+        assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE));
         assertTrue(mKeyStore.contains(TEST_KEYNAME));
     }
 
+    public void testContains_grantedUid_Wifi() throws Exception {
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+
+        assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+    }
+
+    public void testContains_grantedUid_Bluetooth() throws Exception {
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+
+        assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+    }
+
     public void testSaw() throws Exception {
         String[] emptyResult = mKeyStore.saw(TEST_KEYNAME);
         assertNotNull(emptyResult);
@@ -198,6 +259,48 @@
                      new HashSet(Arrays.asList(results)));
     }
 
+    public void testSaw_ungrantedUid_Bluetooth() throws Exception {
+        String[] results1 = mKeyStore.saw(TEST_KEYNAME, Process.BLUETOOTH_UID);
+        assertNull(results1);
+
+        mKeyStore.password(TEST_PASSWD);
+        mKeyStore.put(TEST_KEYNAME1, TEST_KEYVALUE);
+        mKeyStore.put(TEST_KEYNAME2, TEST_KEYVALUE);
+
+        String[] results2 = mKeyStore.saw(TEST_KEYNAME, Process.BLUETOOTH_UID);
+        assertNull(results2);
+    }
+
+    public void testSaw_grantedUid_Wifi() throws Exception {
+        String[] results1 = mKeyStore.saw(TEST_KEYNAME, Process.WIFI_UID);
+        assertNotNull(results1);
+        assertEquals(0, results1.length);
+
+        mKeyStore.password(TEST_PASSWD);
+        mKeyStore.put(TEST_KEYNAME1, TEST_KEYVALUE, Process.WIFI_UID);
+        mKeyStore.put(TEST_KEYNAME2, TEST_KEYVALUE, Process.WIFI_UID);
+
+        String[] results2 = mKeyStore.saw(TEST_KEYNAME, Process.WIFI_UID);
+        assertEquals(new HashSet(Arrays.asList(TEST_KEYNAME1.substring(TEST_KEYNAME.length()),
+                                               TEST_KEYNAME2.substring(TEST_KEYNAME.length()))),
+                     new HashSet(Arrays.asList(results2)));
+    }
+
+    public void testSaw_grantedUid_Vpn() throws Exception {
+        String[] results1 = mKeyStore.saw(TEST_KEYNAME, Process.VPN_UID);
+        assertNotNull(results1);
+        assertEquals(0, results1.length);
+
+        mKeyStore.password(TEST_PASSWD);
+        mKeyStore.put(TEST_KEYNAME1, TEST_KEYVALUE, Process.VPN_UID);
+        mKeyStore.put(TEST_KEYNAME2, TEST_KEYVALUE, Process.VPN_UID);
+
+        String[] results2 = mKeyStore.saw(TEST_KEYNAME, Process.VPN_UID);
+        assertEquals(new HashSet(Arrays.asList(TEST_KEYNAME1.substring(TEST_KEYNAME.length()),
+                                               TEST_KEYNAME2.substring(TEST_KEYNAME.length()))),
+                     new HashSet(Arrays.asList(results2)));
+    }
+
     public void testLock() throws Exception {
         assertFalse(mKeyStore.lock());
 
@@ -239,17 +342,57 @@
     }
 
     public void testGenerate_Success() throws Exception {
-        mKeyStore.password(TEST_PASSWD);
+        assertTrue(mKeyStore.password(TEST_PASSWD));
 
         assertTrue("Should be able to generate key when unlocked",
                 mKeyStore.generate(TEST_KEYNAME));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+    }
+
+    public void testGenerate_grantedUid_Wifi_Success() throws Exception {
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+
+        assertTrue("Should be able to generate key when unlocked",
+                mKeyStore.generate(TEST_KEYNAME, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
+    }
+
+    public void testGenerate_ungrantedUid_Bluetooth_Failure() throws Exception {
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+
+        assertFalse(mKeyStore.generate(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
     }
 
     public void testImport_Success() throws Exception {
-        mKeyStore.password(TEST_PASSWD);
+        assertTrue(mKeyStore.password(TEST_PASSWD));
 
         assertTrue("Should be able to import key when unlocked",
                 mKeyStore.importKey(TEST_KEYNAME, PRIVKEY_BYTES));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+    }
+
+    public void testImport_grantedUid_Wifi_Success() throws Exception {
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+
+        assertTrue("Should be able to import key when unlocked",
+                mKeyStore.importKey(TEST_KEYNAME, PRIVKEY_BYTES, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
+    }
+
+    public void testImport_ungrantedUid_Bluetooth_Failure() throws Exception {
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+
+        assertFalse(mKeyStore.importKey(TEST_KEYNAME, PRIVKEY_BYTES, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
     }
 
     public void testImport_Failure_BadEncoding() throws Exception {
@@ -257,12 +400,15 @@
 
         assertFalse("Invalid DER-encoded key should not be imported",
                 mKeyStore.importKey(TEST_KEYNAME, TEST_DATA));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
     }
 
     public void testSign_Success() throws Exception {
         mKeyStore.password(TEST_PASSWD);
 
         assertTrue(mKeyStore.generate(TEST_KEYNAME));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
         final byte[] signature = mKeyStore.sign(TEST_KEYNAME, TEST_DATA);
 
         assertNotNull("Signature should not be null", signature);
@@ -272,6 +418,7 @@
         mKeyStore.password(TEST_PASSWD);
 
         assertTrue(mKeyStore.generate(TEST_KEYNAME));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
         final byte[] signature = mKeyStore.sign(TEST_KEYNAME, TEST_DATA);
 
         assertNotNull("Signature should not be null", signature);
@@ -406,6 +553,62 @@
                 mKeyStore.ungrant(TEST_KEYNAME, 0));
     }
 
+    public void testDuplicate_grantedUid_Wifi_Success() throws Exception {
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
+
+        assertTrue(mKeyStore.generate(TEST_KEYNAME));
+
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+
+        // source doesn't exist
+        assertFalse(mKeyStore.duplicate(TEST_KEYNAME1, -1, TEST_KEYNAME1, Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME1, Process.WIFI_UID));
+
+        // Copy from current UID to granted UID
+        assertTrue(mKeyStore.duplicate(TEST_KEYNAME, -1, TEST_KEYNAME1, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME1));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME1, Process.WIFI_UID));
+        assertFalse(mKeyStore.duplicate(TEST_KEYNAME, -1, TEST_KEYNAME1, Process.WIFI_UID));
+
+        // Copy from granted UID to same granted UID
+        assertTrue(mKeyStore.duplicate(TEST_KEYNAME1, Process.WIFI_UID, TEST_KEYNAME2,
+                Process.WIFI_UID));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME1, Process.WIFI_UID));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME2, Process.WIFI_UID));
+        assertFalse(mKeyStore.duplicate(TEST_KEYNAME1, Process.WIFI_UID, TEST_KEYNAME2,
+                Process.WIFI_UID));
+
+        assertTrue(mKeyStore.duplicate(TEST_KEYNAME, -1, TEST_KEYNAME2, -1));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME1));
+        assertTrue(mKeyStore.contains(TEST_KEYNAME2));
+        assertFalse(mKeyStore.duplicate(TEST_KEYNAME, -1, TEST_KEYNAME2, -1));
+    }
+
+    public void testDuplicate_ungrantedUid_Bluetooth_Failure() throws Exception {
+        assertTrue(mKeyStore.password(TEST_PASSWD));
+
+        assertFalse(mKeyStore.contains(TEST_KEYNAME));
+
+        assertTrue(mKeyStore.generate(TEST_KEYNAME));
+
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+
+        assertFalse(mKeyStore.duplicate(TEST_KEYNAME, -1, TEST_KEYNAME2, Process.BLUETOOTH_UID));
+        assertFalse(mKeyStore.duplicate(TEST_KEYNAME, Process.BLUETOOTH_UID, TEST_KEYNAME2,
+                Process.BLUETOOTH_UID));
+
+        assertTrue(mKeyStore.contains(TEST_KEYNAME));
+        assertFalse(mKeyStore.contains(TEST_KEYNAME, Process.BLUETOOTH_UID));
+    }
+
     /**
      * The amount of time to allow before and after expected time for variance
      * in timing tests.
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index 1618110..06e658d 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -34,7 +34,6 @@
 		ProgramCache.cpp \
 		RenderBufferCache.cpp \
 		ResourceCache.cpp \
-		ShapeCache.cpp \
 		SkiaColorFilter.cpp \
 		SkiaShader.cpp \
 		Snapshot.cpp \
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 4642a4f..57d1a4f 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -224,16 +224,6 @@
             gradientCache.getSize(), gradientCache.getMaxSize());
     log.appendFormat("  PathCache            %8d / %8d\n",
             pathCache.getSize(), pathCache.getMaxSize());
-    log.appendFormat("  CircleShapeCache     %8d / %8d\n",
-            circleShapeCache.getSize(), circleShapeCache.getMaxSize());
-    log.appendFormat("  OvalShapeCache       %8d / %8d\n",
-            ovalShapeCache.getSize(), ovalShapeCache.getMaxSize());
-    log.appendFormat("  RoundRectShapeCache  %8d / %8d\n",
-            roundRectShapeCache.getSize(), roundRectShapeCache.getMaxSize());
-    log.appendFormat("  RectShapeCache       %8d / %8d\n",
-            rectShapeCache.getSize(), rectShapeCache.getMaxSize());
-    log.appendFormat("  ArcShapeCache        %8d / %8d\n",
-            arcShapeCache.getSize(), arcShapeCache.getMaxSize());
     log.appendFormat("  TextDropShadowCache  %8d / %8d\n", dropShadowCache.getSize(),
             dropShadowCache.getMaxSize());
     for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
@@ -253,11 +243,6 @@
     total += gradientCache.getSize();
     total += pathCache.getSize();
     total += dropShadowCache.getSize();
-    total += roundRectShapeCache.getSize();
-    total += circleShapeCache.getSize();
-    total += ovalShapeCache.getSize();
-    total += rectShapeCache.getSize();
-    total += arcShapeCache.getSize();
     for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
         total += fontRenderer->getFontRendererSize(i);
     }
@@ -325,11 +310,7 @@
             fontRenderer->flush();
             textureCache.flush();
             pathCache.clear();
-            roundRectShapeCache.clear();
-            circleShapeCache.clear();
-            ovalShapeCache.clear();
-            rectShapeCache.clear();
-            arcShapeCache.clear();
+            tasks.stop();
             // fall through
         case kFlushMode_Layers:
             layerCache.clear();
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index dc32a7e..63836c1 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -36,7 +36,6 @@
 #include "GradientCache.h"
 #include "PatchCache.h"
 #include "ProgramCache.h"
-#include "ShapeCache.h"
 #include "PathCache.h"
 #include "TextDropShadowCache.h"
 #include "FboCache.h"
@@ -269,11 +268,6 @@
     GradientCache gradientCache;
     ProgramCache programCache;
     PathCache pathCache;
-    RoundRectShapeCache roundRectShapeCache;
-    CircleShapeCache circleShapeCache;
-    OvalShapeCache ovalShapeCache;
-    RectShapeCache rectShapeCache;
-    ArcShapeCache arcShapeCache;
     PatchCache patchCache;
     TextDropShadowCache dropShadowCache;
     FboCache fboCache;
diff --git a/libs/hwui/Debug.h b/libs/hwui/Debug.h
index 773fe82..46beb94 100644
--- a/libs/hwui/Debug.h
+++ b/libs/hwui/Debug.h
@@ -64,7 +64,7 @@
 #define DEBUG_PATCHES_EMPTY_VERTICES 0
 
 // Turn on to display debug info about shapes
-#define DEBUG_SHAPES 0
+#define DEBUG_PATHS 0
 
 // Turn on to display debug info about textures
 #define DEBUG_TEXTURES 0
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp
index 8455545..020c1e9 100644
--- a/libs/hwui/DeferredDisplayList.cpp
+++ b/libs/hwui/DeferredDisplayList.cpp
@@ -17,6 +17,8 @@
 #define LOG_TAG "OpenGLRenderer"
 #define ATRACE_TAG ATRACE_TAG_VIEW
 
+#include <SkCanvas.h>
+
 #include <utils/Trace.h>
 
 #include "Debug.h"
@@ -76,9 +78,9 @@
             renderer.restoreDisplayState(op->state, kStateDeferFlag_Draw);
 
 #if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS
-            renderer.eventMark(strlen(op->name()), op->name());
+            renderer.eventMark(op->name());
 #endif
-            status |= op->applyDraw(renderer, dirty, 0, op->state.mMultipliedAlpha);
+            status |= op->applyDraw(renderer, dirty, 0);
             logBuffer.writeCommand(0, op->name());
         }
         return status;
@@ -132,7 +134,6 @@
     virtual status_t replay(OpenGLRenderer& renderer, Rect& dirty) {
         DEFER_LOGD("batch %p restoring to count %d", this, mRestoreCount);
         renderer.restoreToCount(mRestoreCount);
-
         return DrawGlInfo::kStatusDone;
     }
 
@@ -367,13 +368,19 @@
     status_t status = DrawGlInfo::kStatusDone;
 
     if (isEmpty()) return status; // nothing to flush
+    renderer.restoreToCount(1);
 
     DEFER_LOGD("--flushing");
     renderer.eventMark("Flush");
 
-    renderer.restoreToCount(1);
+    // save and restore (with draw modifiers) so that reordering doesn't affect final state
+    DrawModifiers restoreDrawModifiers = renderer.getDrawModifiers();
+    renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
+
     status |= replayBatchList(mBatches, renderer, dirty);
-    renderer.resetDrawModifiers();
+
+    renderer.restoreToCount(1);
+    renderer.setDrawModifiers(restoreDrawModifiers);
 
     DEFER_LOGD("--flush complete, returning %x", status);
 
diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h
index 8e908fa..2afc8c1 100644
--- a/libs/hwui/DeferredDisplayList.h
+++ b/libs/hwui/DeferredDisplayList.h
@@ -52,6 +52,8 @@
         kOpBatch_Count, // Add other batch ids before this
     };
 
+    void clear();
+
     bool isEmpty() { return mBatches.isEmpty(); }
 
     /**
@@ -72,14 +74,12 @@
     void addDrawOp(OpenGLRenderer& renderer, DrawOp* op);
 
 private:
-    /*
+    /**
      * Resets the batching back-pointers, creating a barrier in the operation stream so that no ops
      * added in the future will be inserted into a batch that already exist.
      */
     void resetBatchingState();
 
-    void clear();
-
     void storeStateOpBarrier(OpenGLRenderer& renderer, StateOp* op);
     void storeRestoreToCountBarrier(int newSaveCount);
 
@@ -88,9 +88,10 @@
     int getStateOpDeferFlags() const;
     int getDrawOpDeferFlags() const;
 
-    /*
-     *
-     * at defer time, stores the savecount of save/saveLayer ops that were 
+    /**
+     * At defer time, stores the *defer time* savecount of save/saveLayer ops that were deferred, so
+     * that when an associated restoreToCount is deferred, it can be recorded as a
+     * RestoreToCountBatch
      */
     Vector<int> mSaveStack;
     int mComplexClipStackStart;
diff --git a/libs/hwui/DisplayList.cpp b/libs/hwui/DisplayList.cpp
index 4743f58..d985ad0 100644
--- a/libs/hwui/DisplayList.cpp
+++ b/libs/hwui/DisplayList.cpp
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include <SkCanvas.h>
+
 #include "Debug.h"
 #include "DisplayList.h"
 #include "DisplayListOp.h"
@@ -121,9 +123,7 @@
     }
 
     for (size_t i = 0; i < mPaths.size(); i++) {
-        SkPath* path = mPaths.itemAt(i);
-        caches.pathCache.remove(path);
-        delete path;
+        delete mPaths.itemAt(i);
     }
 
     for (size_t i = 0; i < mMatrices.size(); i++) {
@@ -233,7 +233,6 @@
     mBottom = 0;
     mClipChildren = true;
     mAlpha = 1;
-    mMultipliedAlpha = 255;
     mHasOverlappingRendering = true;
     mTranslationX = 0;
     mTranslationY = 0;
@@ -352,9 +351,9 @@
                     level * 2, "", mTransformMatrix, MATRIX_ARGS(mTransformMatrix));
         }
     }
-    if (mAlpha < 1 && !mCaching) {
-        if (!mHasOverlappingRendering) {
-            ALOGD("%*sSetAlpha %.2f", level * 2, "", mAlpha);
+    if (mAlpha < 1) {
+        if (mCaching || !mHasOverlappingRendering) {
+            ALOGD("%*sScaleAlpha %.2f", level * 2, "", mAlpha);
         } else {
             int flags = SkCanvas::kHasAlphaLayer_SaveFlag;
             if (mClipChildren) {
@@ -362,7 +361,7 @@
             }
             ALOGD("%*sSaveLayerAlpha %.2f, %.2f, %.2f, %.2f, %d, 0x%x", level * 2, "",
                     (float) 0, (float) 0, (float) mRight - mLeft, (float) mBottom - mTop,
-                    mMultipliedAlpha, flags);
+                    (int)(mAlpha * 255), flags);
         }
     }
     if (mClipChildren && !mCaching) {
@@ -400,9 +399,9 @@
             renderer.concatMatrix(mTransformMatrix);
         }
     }
-    if (mAlpha < 1 && !mCaching) {
-        if (!mHasOverlappingRendering) {
-            renderer.setAlpha(mAlpha);
+    if (mAlpha < 1) {
+        if (mCaching || !mHasOverlappingRendering) {
+            renderer.scaleAlpha(mAlpha);
         } else {
             // TODO: should be able to store the size of a DL at record time and not
             // have to pass it into this call. In fact, this information might be in the
@@ -412,7 +411,7 @@
                 saveFlags |= SkCanvas::kClipToLayer_SaveFlag;
             }
             handler(mSaveLayerOp->reinit(0, 0, mRight - mLeft, mBottom - mTop,
-                    mMultipliedAlpha, SkXfermode::kSrcOver_Mode, saveFlags), PROPERTY_SAVECOUNT);
+                    mAlpha * 255, SkXfermode::kSrcOver_Mode, saveFlags), PROPERTY_SAVECOUNT);
         }
     }
     if (mClipChildren && !mCaching) {
@@ -423,40 +422,38 @@
 
 class DeferOperationHandler {
 public:
-    DeferOperationHandler(DeferStateStruct& deferStruct, int multipliedAlpha, int level)
-        : mDeferStruct(deferStruct), mMultipliedAlpha(multipliedAlpha), mLevel(level) {}
+    DeferOperationHandler(DeferStateStruct& deferStruct, int level)
+        : mDeferStruct(deferStruct), mLevel(level) {}
     inline void operator()(DisplayListOp* operation, int saveCount) {
-        operation->defer(mDeferStruct, saveCount, mLevel, mMultipliedAlpha);
+        operation->defer(mDeferStruct, saveCount, mLevel);
     }
 private:
     DeferStateStruct& mDeferStruct;
-    const int mMultipliedAlpha;
     const int mLevel;
 };
 
 void DisplayList::defer(DeferStateStruct& deferStruct, const int level) {
-    DeferOperationHandler handler(deferStruct, mCaching ? mMultipliedAlpha : -1, level);
+    DeferOperationHandler handler(deferStruct, level);
     iterate<DeferOperationHandler>(deferStruct.mRenderer, handler, level);
 }
 
 class ReplayOperationHandler {
 public:
-    ReplayOperationHandler(ReplayStateStruct& replayStruct, int multipliedAlpha, int level)
-        : mReplayStruct(replayStruct), mMultipliedAlpha(multipliedAlpha), mLevel(level) {}
+    ReplayOperationHandler(ReplayStateStruct& replayStruct, int level)
+        : mReplayStruct(replayStruct), mLevel(level) {}
     inline void operator()(DisplayListOp* operation, int saveCount) {
 #if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS
-        replayStruct.mRenderer.eventMark(operation->name());
+        mReplayStruct.mRenderer.eventMark(operation->name());
 #endif
-        operation->replay(mReplayStruct, saveCount, mLevel, mMultipliedAlpha);
+        operation->replay(mReplayStruct, saveCount, mLevel);
     }
 private:
     ReplayStateStruct& mReplayStruct;
-    const int mMultipliedAlpha;
     const int mLevel;
 };
 
 void DisplayList::replay(ReplayStateStruct& replayStruct, const int level) {
-    ReplayOperationHandler handler(replayStruct, mCaching ? mMultipliedAlpha : -1, level);
+    ReplayOperationHandler handler(replayStruct, level);
 
     replayStruct.mRenderer.startMark(mName.string());
     iterate<ReplayOperationHandler>(replayStruct.mRenderer, handler, level);
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index 5392587..84f20ab 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -164,7 +164,6 @@
         alpha = fminf(1.0f, fmaxf(0.0f, alpha));
         if (alpha != mAlpha) {
             mAlpha = alpha;
-            mMultipliedAlpha = (int) (255 * alpha);
         }
     }
 
@@ -501,7 +500,6 @@
     // View properties
     bool mClipChildren;
     float mAlpha;
-    int mMultipliedAlpha;
     bool mHasOverlappingRendering;
     float mTranslationX, mTranslationY;
     float mRotation, mRotationX, mRotationY;
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 9988bb8..4f2db69 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -78,11 +78,9 @@
         kOpLogFlag_JSON = 0x2 // TODO: add?
     };
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) = 0;
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) = 0;
 
-    virtual void replay(ReplayStateStruct& replayStruct, int saveCount,
-            int level, int multipliedAlpha) = 0;
+    virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level) = 0;
 
     virtual void output(int level, uint32_t logFlags = 0) = 0;
 
@@ -106,8 +104,7 @@
 
     virtual ~StateOp() {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         // default behavior only affects immediate, deferrable state, issue directly to renderer
         applyState(deferStruct.mRenderer, saveCount);
     }
@@ -116,8 +113,7 @@
      * State operations are applied directly to the renderer, but can cause the deferred drawing op
      * list to flush
      */
-    virtual void replay(ReplayStateStruct& replayStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level) {
         applyState(replayStruct.mRenderer, saveCount);
     }
 
@@ -129,14 +125,12 @@
     DrawOp(SkPaint* paint)
             : mPaint(paint), mQuickRejected(false) {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         if (mQuickRejected &&
                 CC_LIKELY(deferStruct.mReplayFlags & DisplayList::kReplayFlag_ClipChildren)) {
             return;
         }
 
-        state.mMultipliedAlpha = multipliedAlpha;
         if (!getLocalBounds(state.mBounds)) {
             // empty bounds signify bounds can't be calculated
             state.mBounds.setEmpty();
@@ -145,19 +139,16 @@
         deferStruct.mDeferredList.addDrawOp(deferStruct.mRenderer, this);
     }
 
-    virtual void replay(ReplayStateStruct& replayStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level) {
         if (mQuickRejected &&
                 CC_LIKELY(replayStruct.mReplayFlags & DisplayList::kReplayFlag_ClipChildren)) {
             return;
         }
 
-        replayStruct.mDrawGlStatus |= applyDraw(replayStruct.mRenderer, replayStruct.mDirty,
-                level, multipliedAlpha);
+        replayStruct.mDrawGlStatus |= applyDraw(replayStruct.mRenderer, replayStruct.mDirty, level);
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) = 0;
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) = 0;
 
     virtual void onDrawOpDeferred(OpenGLRenderer& renderer) {
     }
@@ -177,8 +168,8 @@
     float strokeWidthOutset() { return mPaint->getStrokeWidth() * 0.5f; }
 
 protected:
-    SkPaint* getPaint(OpenGLRenderer& renderer, bool alwaysCopy = false) {
-        return renderer.filterPaint(mPaint, alwaysCopy);
+    SkPaint* getPaint(OpenGLRenderer& renderer) {
+        return renderer.filterPaint(mPaint);
     }
 
     SkPaint* mPaint; // should be accessed via getPaint() when applying
@@ -227,8 +218,7 @@
     SaveOp(int flags)
             : mFlags(flags) {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         int newSaveCount = deferStruct.mRenderer.save(mFlags);
         deferStruct.mDeferredList.addSave(deferStruct.mRenderer, this, newSaveCount);
     }
@@ -260,8 +250,7 @@
     RestoreToCountOp(int count)
             : mCount(count) {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         deferStruct.mDeferredList.addRestoreToCount(deferStruct.mRenderer, saveCount + mCount);
         deferStruct.mRenderer.restoreToCount(saveCount + mCount);
     }
@@ -293,11 +282,15 @@
             int alpha, SkXfermode::Mode mode, int flags)
             : mArea(left, top, right, bottom), mAlpha(alpha), mMode(mode), mFlags(flags) {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         // NOTE: don't bother with actual saveLayer, instead issuing it at flush time
-        int newSaveCount = deferStruct.mRenderer.save(mFlags);
+        int newSaveCount = deferStruct.mRenderer.getSaveCount();
         deferStruct.mDeferredList.addSaveLayer(deferStruct.mRenderer, this, newSaveCount);
+
+        // NOTE: don't issue full saveLayer, since that has side effects/is costly. instead just
+        // setup the snapshot for deferral, and re-issue the op at flush time
+        deferStruct.mRenderer.saveLayerDeferred(mArea.left, mArea.top, mArea.right, mArea.bottom,
+                mAlpha, mMode, mFlags);
     }
 
     virtual void applyState(OpenGLRenderer& renderer, int saveCount) {
@@ -453,8 +446,7 @@
 public:
     ClipOp(SkRegion::Op op) : mOp(op) {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         // NOTE: must defer op BEFORE applying state, since it may read clip
         deferStruct.mDeferredList.addClip(deferStruct.mRenderer, this);
 
@@ -689,16 +681,9 @@
                     paint),
             mBitmap(bitmap) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
-        bool makeCopy = multipliedAlpha >= 0 && multipliedAlpha < 255;
-        SkPaint* paint = getPaint(renderer, makeCopy);
-        if (makeCopy) {
-            // The paint is safe to modify since we're working on a copy
-            paint->setAlpha(multipliedAlpha);
-        }
-        status_t ret = renderer.drawBitmap(mBitmap, mLocalBounds.left, mLocalBounds.top, paint);
-        return ret;
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
+        return renderer.drawBitmap(mBitmap, mLocalBounds.left, mLocalBounds.top,
+                getPaint(renderer));
     }
 
     virtual void output(int level, uint32_t logFlags) {
@@ -723,8 +708,7 @@
         transform.mapRect(mLocalBounds);
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawBitmap(mBitmap, mMatrix, getPaint(renderer));
     }
 
@@ -749,8 +733,7 @@
             : DrawBoundedOp(dstLeft, dstTop, dstRight, dstBottom, paint),
             mBitmap(bitmap), mSrc(srcLeft, srcTop, srcRight, srcBottom) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawBitmap(mBitmap, mSrc.left, mSrc.top, mSrc.right, mSrc.bottom,
                 mLocalBounds.left, mLocalBounds.top, mLocalBounds.right, mLocalBounds.bottom,
                 getPaint(renderer));
@@ -776,8 +759,7 @@
     DrawBitmapDataOp(SkBitmap* bitmap, float left, float top, SkPaint* paint)
             : DrawBitmapOp(bitmap, left, top, paint) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawBitmapData(mBitmap, mLocalBounds.left,
                 mLocalBounds.top, getPaint(renderer));
     }
@@ -800,8 +782,7 @@
             mBitmap(bitmap), mMeshWidth(meshWidth), mMeshHeight(meshHeight),
             mVertices(vertices), mColors(colors) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawBitmapMesh(mBitmap, mMeshWidth, mMeshHeight,
                 mVertices, mColors, getPaint(renderer));
     }
@@ -834,8 +815,7 @@
             mColors(colors), mxDivsCount(width), myDivsCount(height),
             mNumColors(numColors), mAlpha(alpha), mMode(mode) {};
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         // NOTE: not calling the virtual method, which takes a paint
         return renderer.drawPatch(mBitmap, mxDivs, myDivs, mColors,
                 mxDivsCount, myDivsCount, mNumColors,
@@ -869,8 +849,7 @@
     DrawColorOp(int color, SkXfermode::Mode mode)
             : DrawOp(0), mColor(color), mMode(mode) {};
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawColor(mColor, mMode);
     }
 
@@ -913,8 +892,7 @@
     DrawRectOp(float left, float top, float right, float bottom, SkPaint* paint)
             : DrawStrokableOp(left, top, right, bottom, paint) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawRect(mLocalBounds.left, mLocalBounds.top,
                 mLocalBounds.right, mLocalBounds.bottom, getPaint(renderer));
     }
@@ -932,8 +910,7 @@
             : DrawBoundedOp(rects, count, paint),
             mRects(rects), mCount(count) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawRects(mRects, mCount, getPaint(renderer));
     }
 
@@ -958,8 +935,7 @@
             float rx, float ry, SkPaint* paint)
             : DrawStrokableOp(left, top, right, bottom, paint), mRx(rx), mRy(ry) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawRoundRect(mLocalBounds.left, mLocalBounds.top,
                 mLocalBounds.right, mLocalBounds.bottom, mRx, mRy, getPaint(renderer));
     }
@@ -981,8 +957,7 @@
             : DrawStrokableOp(x - radius, y - radius, x + radius, y + radius, paint),
             mX(x), mY(y), mRadius(radius) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawCircle(mX, mY, mRadius, getPaint(renderer));
     }
 
@@ -1003,8 +978,7 @@
     DrawOvalOp(float left, float top, float right, float bottom, SkPaint* paint)
             : DrawStrokableOp(left, top, right, bottom, paint) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawOval(mLocalBounds.left, mLocalBounds.top,
                 mLocalBounds.right, mLocalBounds.bottom, getPaint(renderer));
     }
@@ -1023,8 +997,7 @@
             : DrawStrokableOp(left, top, right, bottom, paint),
             mStartAngle(startAngle), mSweepAngle(sweepAngle), mUseCenter(useCenter) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawArc(mLocalBounds.left, mLocalBounds.top,
                 mLocalBounds.right, mLocalBounds.bottom,
                 mStartAngle, mSweepAngle, mUseCenter, getPaint(renderer));
@@ -1055,8 +1028,7 @@
         mLocalBounds.set(left, top, left + width, top + height);
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawPath(mPath, getPaint(renderer));
     }
 
@@ -1086,8 +1058,7 @@
         mLocalBounds.outset(strokeWidthOutset());
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawLines(mPoints, mCount, getPaint(renderer));
     }
 
@@ -1113,8 +1084,7 @@
     DrawPointsOp(float* points, int count, SkPaint* paint)
             : DrawLinesOp(points, count, paint) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawPoints(mPoints, mCount, getPaint(renderer));
     }
 
@@ -1160,8 +1130,7 @@
         /* TODO: inherit from DrawBounded and init mLocalBounds */
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawTextOnPath(mText, mBytesCount, mCount, mPath,
                 mHOffset, mVOffset, getPaint(renderer));
     }
@@ -1182,8 +1151,7 @@
         /* TODO: inherit from DrawBounded and init mLocalBounds */
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawPosText(mText, mBytesCount, mCount, mPositions, getPaint(renderer));
     }
 
@@ -1231,8 +1199,7 @@
         }
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         return renderer.drawText(mText, mBytesCount, mCount, mX, mY,
                 mPositions, getPaint(renderer), mLength);
     }
@@ -1269,8 +1236,7 @@
     DrawFunctorOp(Functor* functor)
             : DrawOp(0), mFunctor(functor) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
         renderer.startMark("GL functor");
         status_t ret = renderer.callDrawGLFunction(mFunctor, dirty);
         renderer.endMark();
@@ -1293,22 +1259,21 @@
             : DrawBoundedOp(0, 0, displayList->getWidth(), displayList->getHeight(), 0),
             mDisplayList(displayList), mFlags(flags) {}
 
-    virtual void defer(DeferStateStruct& deferStruct, int saveCount,
-            int level, int multipliedAlpha) {
+    virtual void defer(DeferStateStruct& deferStruct, int saveCount, int level) {
         if (mDisplayList && mDisplayList->isRenderable()) {
             mDisplayList->defer(deferStruct, level + 1);
         }
     }
-
-    virtual void replay(ReplayStateStruct& replayStruct, int saveCount,
-            int level, int multipliedAlpha) {
+virtual void replay(ReplayStateStruct& replayStruct, int saveCount, int level) {
         if (mDisplayList && mDisplayList->isRenderable()) {
             mDisplayList->replay(replayStruct, level + 1);
         }
     }
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) { return DrawGlInfo::kStatusDone; }
+    // NOT USED since replay() is overridden
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
+        return DrawGlInfo::kStatusDone;
+    }
 
     virtual void output(int level, uint32_t logFlags) {
         OP_LOG("Draw Display List %p, flags %#x", mDisplayList, mFlags);
@@ -1326,22 +1291,11 @@
 
 class DrawLayerOp : public DrawOp {
 public:
-    DrawLayerOp(Layer* layer, float x, float y, SkPaint* paint)
-            : DrawOp(paint), mLayer(layer), mX(x), mY(y) {}
+    DrawLayerOp(Layer* layer, float x, float y)
+            : DrawOp(0), mLayer(layer), mX(x), mY(y) {}
 
-    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level,
-            int multipliedAlpha) {
-        int oldAlpha = -1;
-
-        if (multipliedAlpha >= 0 && multipliedAlpha < 255) {
-            oldAlpha = mLayer->getAlpha();
-            mLayer->setAlpha(multipliedAlpha);
-        }
-        status_t ret = renderer.drawLayer(mLayer, mX, mY, getPaint(renderer));
-        if (oldAlpha >= 0) {
-            mLayer->setAlpha(oldAlpha);
-        }
-        return ret;
+    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, int level) {
+        return renderer.drawLayer(mLayer, mX, mY);
     }
 
     virtual void output(int level, uint32_t logFlags) {
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 11a655e..07daa3b 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -17,6 +17,7 @@
 #define LOG_TAG "OpenGLRenderer"
 
 #include <SkCamera.h>
+#include <SkCanvas.h>
 
 #include <private/hwui/DrawGlInfo.h>
 
@@ -246,12 +247,11 @@
     return DrawGlInfo::kStatusDone;
 }
 
-status_t DisplayListRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) {
+status_t DisplayListRenderer::drawLayer(Layer* layer, float x, float y) {
     mLayers.add(layer);
     mCaches.resourceCache.incrementRefcount(layer);
-    paint = refPaint(paint);
 
-    addDrawOp(new (alloc()) DrawLayerOp(layer, x, y, paint));
+    addDrawOp(new (alloc()) DrawLayerOp(layer, x, y));
     return DrawGlInfo::kStatusDone;
 }
 
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 73b9b66..50e552f 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -94,7 +94,7 @@
     virtual bool clipRegion(SkRegion* region, SkRegion::Op op);
 
     virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t flags);
-    virtual status_t drawLayer(Layer* layer, float x, float y, SkPaint* paint);
+    virtual status_t drawLayer(Layer* layer, float x, float y);
     virtual status_t drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
     virtual status_t drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
     virtual status_t drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index f0dcb30..26c7e5d 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -21,6 +21,7 @@
 
 #include <cutils/properties.h>
 
+#include <utils/Functor.h>
 #include <utils/Log.h>
 
 #include <RenderScript.h>
@@ -55,10 +56,7 @@
     mGammaTable = NULL;
     mInitialized = false;
     mMaxNumberOfQuads = 1024;
-    mCurrentQuadIndex = 0;
-    mLastQuadIndex = 0;
 
-    mTextMesh = NULL;
     mCurrentCacheTexture = NULL;
 
     mLinearFiltering = false;
@@ -114,8 +112,6 @@
         // Unbinding the buffer shouldn't be necessary but it crashes with some drivers
         Caches::getInstance().unbindIndicesBuffer();
         glDeleteBuffers(1, &mIndexBufferID);
-
-        delete[] mTextMesh;
     }
 
     LruCache<Font::FontDescription, Font*>::Iterator it(mActiveFonts);
@@ -126,9 +122,7 @@
 }
 
 void FontRenderer::flushAllAndInvalidate() {
-    if (mCurrentQuadIndex != 0) {
-        issueDrawCommand();
-    }
+    issueDrawCommand();
 
     LruCache<Font::FontDescription, Font*>::Iterator it(mActiveFonts);
     while (it.next()) {
@@ -236,6 +230,9 @@
         // Large-glyph texture memory is allocated only as needed
         cacheTexture->allocateTexture();
     }
+    if (!cacheTexture->mesh()) {
+        cacheTexture->allocateMesh();
+    }
 
     // Tells us whether the glyphs is B&W (1 bit per pixel)
     // or anti-aliased (8 bits per pixel)
@@ -307,11 +304,12 @@
 }
 
 CacheTexture* FontRenderer::createCacheTexture(int width, int height, bool allocate) {
-    CacheTexture* cacheTexture = new CacheTexture(width, height);
+    CacheTexture* cacheTexture = new CacheTexture(width, height, mMaxNumberOfQuads);
 
     if (allocate) {
         Caches::getInstance().activeTexture(0);
         cacheTexture->allocateTexture();
+        cacheTexture->allocateMesh();
     }
 
     return cacheTexture;
@@ -356,12 +354,6 @@
     glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexBufferSizeBytes, indexBufferData, GL_STATIC_DRAW);
 
     free(indexBufferData);
-
-    uint32_t coordSize = 2;
-    uint32_t uvSize = 2;
-    uint32_t vertsPerQuad = 4;
-    uint32_t vertexBufferSize = mMaxNumberOfQuads * vertsPerQuad * coordSize * uvSize;
-    mTextMesh = new float[vertexBufferSize];
 }
 
 // We don't want to allocate anything unless we actually draw text
@@ -376,15 +368,6 @@
     mInitialized = true;
 }
 
-void FontRenderer::updateDrawParams() {
-    if (mCurrentQuadIndex != mLastQuadIndex) {
-        mDrawOffsets.add((uint16_t*)(mLastQuadIndex * sizeof(uint16_t) * 6));
-        mDrawCounts.add(mCurrentQuadIndex - mLastQuadIndex);
-        mDrawCacheTextures.add(mCurrentCacheTexture);
-        mLastQuadIndex = mCurrentQuadIndex;
-    }
-}
-
 void FontRenderer::checkTextureUpdate() {
     if (!mUploadTexture) {
         return;
@@ -424,76 +407,60 @@
 }
 
 void FontRenderer::issueDrawCommand() {
-    updateDrawParams();
-    checkTextureUpdate();
+    bool first = true;
+    bool force = false;
 
+    GLuint lastId = 0;
     Caches& caches = Caches::getInstance();
-    caches.bindIndicesBuffer(mIndexBufferID);
-    if (!mDrawn) {
-        float* buffer = mTextMesh;
-        int offset = 2;
 
-        bool force = caches.unbindMeshBuffer();
-        caches.bindPositionVertexPointer(force, buffer);
-        caches.bindTexCoordsVertexPointer(force, buffer + offset);
-    }
+    for (uint32_t i = 0; i < mCacheTextures.size(); i++) {
+        CacheTexture* texture = mCacheTextures[i];
+        if (texture->canDraw()) {
+            if (first) {
+                if (mFunctor) (*mFunctor)(0, NULL);
 
-    for (uint32_t i = 0; i < mDrawOffsets.size(); i++) {
-        uint16_t* offset = mDrawOffsets[i];
-        uint32_t count = mDrawCounts[i];
-        CacheTexture* texture = mDrawCacheTextures[i];
+                checkTextureUpdate();
+                caches.bindIndicesBuffer(mIndexBufferID);
 
-        caches.activeTexture(0);
-        glBindTexture(GL_TEXTURE_2D, texture->getTextureId());
+                if (!mDrawn) {
+                    // If returns true, a VBO was bound and we must
+                    // rebind our vertex attrib pointers even if
+                    // they have the same values as the current pointers
+                    force = caches.unbindMeshBuffer();
+                }
 
-        texture->setLinearFiltering(mLinearFiltering, false);
+                caches.activeTexture(0);
+                first = false;
+            }
 
-        glDrawElements(GL_TRIANGLES, count * 6, GL_UNSIGNED_SHORT, offset);
+            glBindTexture(GL_TEXTURE_2D, texture->getTextureId());
+            texture->setLinearFiltering(mLinearFiltering, false);
+
+            TextureVertex* mesh = texture->mesh();
+            caches.bindPositionVertexPointer(force, &mesh[0].position[0]);
+            caches.bindTexCoordsVertexPointer(force, &mesh[0].texture[0]);
+            force = false;
+
+            glDrawElements(GL_TRIANGLES, texture->meshElementCount(),
+                    GL_UNSIGNED_SHORT, texture->indices());
+
+            texture->resetMesh();
+        }
     }
 
     mDrawn = true;
-
-    mCurrentQuadIndex = 0;
-    mLastQuadIndex = 0;
-    mDrawOffsets.clear();
-    mDrawCounts.clear();
-    mDrawCacheTextures.clear();
 }
 
 void FontRenderer::appendMeshQuadNoClip(float x1, float y1, float u1, float v1,
         float x2, float y2, float u2, float v2, float x3, float y3, float u3, float v3,
         float x4, float y4, float u4, float v4, CacheTexture* texture) {
     if (texture != mCurrentCacheTexture) {
-        updateDrawParams();
         // Now use the new texture id
         mCurrentCacheTexture = texture;
     }
 
-    const uint32_t vertsPerQuad = 4;
-    const uint32_t floatsPerVert = 4;
-    float* currentPos = mTextMesh + mCurrentQuadIndex * vertsPerQuad * floatsPerVert;
-
-    (*currentPos++) = x1;
-    (*currentPos++) = y1;
-    (*currentPos++) = u1;
-    (*currentPos++) = v1;
-
-    (*currentPos++) = x2;
-    (*currentPos++) = y2;
-    (*currentPos++) = u2;
-    (*currentPos++) = v2;
-
-    (*currentPos++) = x3;
-    (*currentPos++) = y3;
-    (*currentPos++) = u3;
-    (*currentPos++) = v3;
-
-    (*currentPos++) = x4;
-    (*currentPos++) = y4;
-    (*currentPos++) = u4;
-    (*currentPos++) = v4;
-
-    mCurrentQuadIndex++;
+    mCurrentCacheTexture->addQuad(x1, y1, u1, v1, x2, y2, u2, v2,
+            x3, y3, u3, v3, x4, y4, u4, v4);
 }
 
 void FontRenderer::appendMeshQuad(float x1, float y1, float u1, float v1,
@@ -514,7 +481,7 @@
         mBounds->bottom = fmax(mBounds->bottom, y1);
     }
 
-    if (mCurrentQuadIndex == mMaxNumberOfQuads) {
+    if (mCurrentCacheTexture->endOfMesh()) {
         issueDrawCommand();
     }
 }
@@ -532,7 +499,7 @@
         mBounds->bottom = fmax(mBounds->bottom, fmax(y1, fmax(y2, fmax(y3, y4))));
     }
 
-    if (mCurrentQuadIndex == mMaxNumberOfQuads) {
+    if (mCurrentCacheTexture->endOfMesh()) {
         issueDrawCommand();
     }
 }
@@ -597,11 +564,12 @@
     return image;
 }
 
-void FontRenderer::initRender(const Rect* clip, Rect* bounds) {
+void FontRenderer::initRender(const Rect* clip, Rect* bounds, Functor* functor) {
     checkInit();
 
     mDrawn = false;
     mBounds = bounds;
+    mFunctor = functor;
     mClip = clip;
 }
 
@@ -609,9 +577,7 @@
     mBounds = NULL;
     mClip = NULL;
 
-    if (mCurrentQuadIndex != 0) {
-        issueDrawCommand();
-    }
+    issueDrawCommand();
 }
 
 void FontRenderer::precache(SkPaint* paint, const char* text, int numGlyphs, const mat4& matrix) {
@@ -621,13 +587,13 @@
 
 bool FontRenderer::renderPosText(SkPaint* paint, const Rect* clip, const char *text,
         uint32_t startIndex, uint32_t len, int numGlyphs, int x, int y,
-        const float* positions, Rect* bounds) {
+        const float* positions, Rect* bounds, Functor* functor) {
     if (!mCurrentFont) {
         ALOGE("No font set");
         return false;
     }
 
-    initRender(clip, bounds);
+    initRender(clip, bounds, functor);
     mCurrentFont->render(paint, text, startIndex, len, numGlyphs, x, y, positions);
     finishRender();
 
@@ -642,7 +608,7 @@
         return false;
     }
 
-    initRender(clip, bounds);
+    initRender(clip, bounds, NULL);
     mCurrentFont->render(paint, text, startIndex, len, numGlyphs, path, hOffset, vOffset);
     finishRender();
 
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index d0c44ef..1da3b6c 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -28,6 +28,7 @@
 #include "font/CacheTexture.h"
 #include "font/CachedGlyphInfo.h"
 #include "font/Font.h"
+#include "utils/SortedList.h"
 #include "Matrix.h"
 #include "Properties.h"
 
@@ -37,6 +38,8 @@
     class ScriptIntrinsicBlur;
 }
 
+class Functor;
+
 namespace android {
 namespace uirenderer {
 
@@ -61,7 +64,8 @@
 
     // bounds is an out parameter
     bool renderPosText(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex,
-            uint32_t len, int numGlyphs, int x, int y, const float* positions, Rect* bounds);
+            uint32_t len, int numGlyphs, int x, int y, const float* positions, Rect* bounds,
+            Functor* functor);
     // bounds is an out parameter
     bool renderTextOnPath(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex,
             uint32_t len, int numGlyphs, SkPath* path, float hOffset, float vOffset, Rect* bounds);
@@ -87,13 +91,8 @@
     DropShadow renderDropShadow(SkPaint* paint, const char *text, uint32_t startIndex,
             uint32_t len, int numGlyphs, uint32_t radius, const float* positions);
 
-    GLuint getTexture(bool linearFiltering = false) {
-        checkInit();
-
-        mCurrentCacheTexture->setLinearFiltering(linearFiltering);
+    void setTextureFiltering(bool linearFiltering) {
         mLinearFiltering = linearFiltering;
-
-        return mCurrentCacheTexture->getTextureId();
     }
 
     uint32_t getCacheSize() const {
@@ -124,7 +123,7 @@
     void initVertexArrayBuffers();
 
     void checkInit();
-    void initRender(const Rect* clip, Rect* bounds);
+    void initRender(const Rect* clip, Rect* bounds, Functor* functor);
     void finishRender();
 
     void issueDrawCommand();
@@ -143,7 +142,6 @@
 
     void removeFont(const Font* font);
 
-    void updateDrawParams();
     void checkTextureUpdate();
 
     void setTextureDirty() {
@@ -164,14 +162,10 @@
 
     bool mUploadTexture;
 
-    // Pointer to vertex data to speed up frame to frame work
-    float* mTextMesh;
-    uint32_t mCurrentQuadIndex;
-    uint32_t mLastQuadIndex;
     uint32_t mMaxNumberOfQuads;
-
     uint32_t mIndexBufferID;
 
+    Functor* mFunctor;
     const Rect* mClip;
     Rect* mBounds;
     bool mDrawn;
@@ -180,10 +174,6 @@
 
     bool mLinearFiltering;
 
-    Vector<uint16_t*> mDrawOffsets;
-    Vector<uint32_t> mDrawCounts;
-    Vector<CacheTexture*> mDrawCacheTextures;
-
     // RS constructs
     sp<RSC::RS> mRs;
     sp<const RSC::Element> mRsElement;
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index 1899002..2998535 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -18,6 +18,8 @@
 
 #include <utils/Log.h>
 
+#include "DisplayList.h"
+#include "DeferredDisplayList.h"
 #include "Layer.h"
 #include "LayerRenderer.h"
 #include "OpenGLRenderer.h"
@@ -43,15 +45,18 @@
     fbo = 0;
     stencil = NULL;
     debugDrawUpdate = false;
+    deferredList = NULL;
     Caches::getInstance().resourceCache.incrementRefcount(this);
 }
 
 Layer::~Layer() {
-    if (mesh) delete mesh;
-    if (meshIndices) delete meshIndices;
     if (colorFilter) Caches::getInstance().resourceCache.decrementRefcount(colorFilter);
     removeFbo();
     deleteTexture();
+
+    delete[] mesh;
+    delete[] meshIndices;
+    delete deferredList;
 }
 
 uint32_t Layer::computeIdealWidth(uint32_t layerWidth) {
@@ -133,5 +138,43 @@
     }
 }
 
+void Layer::defer() {
+    if (!deferredList) {
+        deferredList = new DeferredDisplayList;
+    }
+    DeferStateStruct deferredState(*deferredList, *renderer,
+            DisplayList::kReplayFlag_ClipChildren);
+
+    const float width = layer.getWidth();
+    const float height = layer.getHeight();
+
+    if (dirtyRect.isEmpty() || (dirtyRect.left <= 0 && dirtyRect.top <= 0 &&
+            dirtyRect.right >= width && dirtyRect.bottom >= height)) {
+        dirtyRect.set(0, 0, width, height);
+    }
+
+    renderer->initViewport(width, height);
+    renderer->setupFrameState(dirtyRect.left, dirtyRect.top,
+            dirtyRect.right, dirtyRect.bottom, !isBlend());
+
+    displayList->defer(deferredState, 0);
+}
+
+void Layer::flush() {
+    if (deferredList && !deferredList->isEmpty()) {
+        renderer->setViewport(layer.getWidth(), layer.getHeight());
+        renderer->prepareDirty(dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom,
+                !isBlend());
+
+        deferredList->flush(*renderer, dirtyRect);
+
+        renderer->finish();
+        renderer = NULL;
+
+        dirtyRect.setEmpty();
+        deferredList->clear();
+    }
+}
+
 }; // namespace uirenderer
 }; // namespace android
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index ccf1da5..0e00191 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -42,6 +42,8 @@
 // Forward declarations
 class OpenGLRenderer;
 class DisplayList;
+class DeferredDisplayList;
+class DeferStateStruct;
 
 /**
  * A layer has dimensions and is backed by an OpenGL texture or FBO.
@@ -271,6 +273,9 @@
         return transform;
     }
 
+    void defer();
+    void flush();
+
     /**
      * Bounds of the layer.
      */
@@ -379,6 +384,12 @@
      */
     mat4 transform;
 
+    /**
+     * Used to defer display lists when the layer is updated with a
+     * display list.
+     */
+    DeferredDisplayList* deferredList;
+
 }; // struct Layer
 
 }; // namespace uirenderer
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index 9aa9615..bb02286 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -129,8 +129,8 @@
 void LayerRenderer::generateMesh() {
     if (mLayer->region.isRect() || mLayer->region.isEmpty()) {
         if (mLayer->mesh) {
-            delete mLayer->mesh;
-            delete mLayer->meshIndices;
+            delete[] mLayer->mesh;
+            delete[] mLayer->meshIndices;
 
             mLayer->mesh = NULL;
             mLayer->meshIndices = NULL;
@@ -153,8 +153,8 @@
     GLsizei elementCount = count * 6;
 
     if (mLayer->mesh && mLayer->meshElementCount < elementCount) {
-        delete mLayer->mesh;
-        delete mLayer->meshIndices;
+        delete[] mLayer->mesh;
+        delete[] mLayer->meshIndices;
 
         mLayer->mesh = NULL;
         mLayer->meshIndices = NULL;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index e576f76..1c36a23 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -112,11 +112,15 @@
 
 OpenGLRenderer::OpenGLRenderer():
         mCaches(Caches::getInstance()), mExtensions(Extensions::getInstance()) {
-    resetDrawModifiers();
+    mDrawModifiers.mShader = NULL;
+    mDrawModifiers.mColorFilter = NULL;
+    mDrawModifiers.mHasShadow = false;
+    mDrawModifiers.mHasDrawFilter = false;
 
     memcpy(mMeshVertices, gMeshVertices, sizeof(gMeshVertices));
 
     mFirstSnapshot = new Snapshot;
+    mFrameStarted = false;
 
     mScissorOptimizationDisabled = false;
 }
@@ -176,39 +180,63 @@
     mFirstSnapshot->viewport.set(0, 0, width, height);
 }
 
-status_t OpenGLRenderer::prepare(bool opaque) {
-    return prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque);
-}
-
-status_t OpenGLRenderer::prepareDirty(float left, float top,
+void OpenGLRenderer::setupFrameState(float left, float top,
         float right, float bottom, bool opaque) {
     mCaches.clearGarbage();
 
+    mOpaque = opaque;
     mSnapshot = new Snapshot(mFirstSnapshot,
             SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
     mSnapshot->fbo = getTargetFbo();
     mSaveCount = 1;
 
     mSnapshot->setClip(left, top, right, bottom);
+    mTilingClip.set(left, top, right, bottom);
+}
+
+status_t OpenGLRenderer::startFrame() {
+    if (mFrameStarted) return DrawGlInfo::kStatusDone;
+    mFrameStarted = true;
+
     mDirtyClip = true;
 
-    updateLayers();
+    discardFramebuffer(mTilingClip.left, mTilingClip.top, mTilingClip.right, mTilingClip.bottom);
 
-    discardFramebuffer(left, top, right, bottom);
-
-    syncState();
+    glViewport(0, 0, mWidth, mHeight);
 
     // Functors break the tiling extension in pretty spectacular ways
     // This ensures we don't use tiling when a functor is going to be
     // invoked during the frame
     mSuppressTiling = mCaches.hasRegisteredFunctors();
 
-    mTilingSnapshot = mSnapshot;
-    startTiling(mTilingSnapshot, true);
+    startTiling(mSnapshot, true);
 
     debugOverdraw(true, true);
 
-    return clear(left, top, right, bottom, opaque);
+    return clear(mTilingClip.left, mTilingClip.top,
+            mTilingClip.right, mTilingClip.bottom, mOpaque);
+}
+
+status_t OpenGLRenderer::prepare(bool opaque) {
+    return prepareDirty(0.0f, 0.0f, mWidth, mHeight, opaque);
+}
+
+status_t OpenGLRenderer::prepareDirty(float left, float top,
+        float right, float bottom, bool opaque) {
+    setupFrameState(left, top, right, bottom, opaque);
+
+    // Layer renderers will start the frame immediately
+    // The framebuffer renderer will first defer the display list
+    // for each layer and wait until the first drawing command
+    // to start the frame
+    if (mSnapshot->fbo == 0) {
+        syncState();
+        updateLayers();
+    } else {
+        return startFrame();
+    }
+
+    return DrawGlInfo::kStatusDone;
 }
 
 void OpenGLRenderer::discardFramebuffer(float left, float top, float right, float bottom) {
@@ -238,8 +266,6 @@
 }
 
 void OpenGLRenderer::syncState() {
-    glViewport(0, 0, mWidth, mHeight);
-
     if (mCaches.blend) {
         glEnable(GL_BLEND);
     } else {
@@ -249,9 +275,9 @@
 
 void OpenGLRenderer::startTiling(const sp<Snapshot>& s, bool opaque) {
     if (!mSuppressTiling) {
-        Rect* clip = mTilingSnapshot->clipRect;
+        Rect* clip = &mTilingClip;
         if (s->flags & Snapshot::kFlagFboTarget) {
-            clip = &s->layer->clipRect;
+            clip = &(s->layer->clipRect);
         }
 
         startTiling(*clip, s->height, opaque);
@@ -309,6 +335,8 @@
         }
 #endif
     }
+
+    mFrameStarted = false;
 }
 
 void OpenGLRenderer::interrupt() {
@@ -477,10 +505,10 @@
 
 void OpenGLRenderer::renderOverdraw() {
     if (mCaches.debugOverdraw && getTargetFbo() == 0) {
-        const Rect* clip = mTilingSnapshot->clipRect;
+        const Rect* clip = &mTilingClip;
 
         mCaches.enableScissor();
-        mCaches.setScissor(clip->left, mTilingSnapshot->height - clip->bottom,
+        mCaches.setScissor(clip->left, mFirstSnapshot->height - clip->bottom,
                 clip->right - clip->left, clip->bottom - clip->top);
 
         mCaches.stencil.enableDebugTest(2);
@@ -500,8 +528,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 bool OpenGLRenderer::updateLayer(Layer* layer, bool inFrame) {
-    if (layer->deferredUpdateScheduled && layer->renderer && layer->displayList) {
-        OpenGLRenderer* renderer = layer->renderer;
+    if (layer->deferredUpdateScheduled && layer->renderer &&
+            layer->displayList && layer->displayList->isRenderable()) {
         Rect& dirty = layer->dirtyRect;
 
         if (inFrame) {
@@ -509,19 +537,29 @@
             debugOverdraw(false, false);
         }
 
-        renderer->setViewport(layer->layer.getWidth(), layer->layer.getHeight());
-        renderer->prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, !layer->isBlend());
-        renderer->drawDisplayList(layer->displayList, dirty, DisplayList::kReplayFlag_ClipChildren);
-        renderer->finish();
+        if (CC_UNLIKELY(inFrame || mCaches.drawDeferDisabled)) {
+            OpenGLRenderer* renderer = layer->renderer;
+            renderer->setViewport(layer->layer.getWidth(), layer->layer.getHeight());
+            renderer->prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom,
+                    !layer->isBlend());
+            renderer->drawDisplayList(layer->displayList, dirty,
+                    DisplayList::kReplayFlag_ClipChildren);
+            renderer->finish();
+        } else {
+            layer->defer();
+        }
 
         if (inFrame) {
             resumeAfterLayer();
             startTiling(mSnapshot);
         }
 
-        dirty.setEmpty();
+        if (CC_UNLIKELY(inFrame || mCaches.drawDeferDisabled)) {
+            dirty.setEmpty();
+            layer->renderer = NULL;
+        }
+
         layer->deferredUpdateScheduled = false;
-        layer->renderer = NULL;
         layer->displayList = NULL;
         layer->debugDrawUpdate = mCaches.debugLayersUpdates;
 
@@ -532,19 +570,54 @@
 }
 
 void OpenGLRenderer::updateLayers() {
+    // If draw deferring is enabled this method will simply defer
+    // the display list of each individual layer. The layers remain
+    // in the layer updates list which will be cleared by flushLayers().
     int count = mLayerUpdates.size();
     if (count > 0) {
-        startMark("Layer Updates");
+        if (CC_UNLIKELY(mCaches.drawDeferDisabled)) {
+            startMark("Layer Updates");
+        } else {
+            startMark("Defer Layer Updates");
+        }
 
         // Note: it is very important to update the layers in reverse order
         for (int i = count - 1; i >= 0; i--) {
             Layer* layer = mLayerUpdates.itemAt(i);
             updateLayer(layer, false);
-            mCaches.resourceCache.decrementRefcount(layer);
+            if (CC_UNLIKELY(mCaches.drawDeferDisabled)) {
+                mCaches.resourceCache.decrementRefcount(layer);
+            }
         }
-        mLayerUpdates.clear();
 
+        if (CC_UNLIKELY(mCaches.drawDeferDisabled)) {
+            mLayerUpdates.clear();
+            glBindFramebuffer(GL_FRAMEBUFFER, getTargetFbo());
+        }
+        endMark();
+    }
+}
+
+void OpenGLRenderer::flushLayers() {
+    int count = mLayerUpdates.size();
+    if (count > 0) {
+        startMark("Apply Layer Updates");
+        char layerName[12];
+
+        // Note: it is very important to update the layers in reverse order
+        for (int i = count - 1; i >= 0; i--) {
+            sprintf(layerName, "Layer #%d", i);
+            startMark(layerName); {
+                Layer* layer = mLayerUpdates.itemAt(i);
+                layer->flush();
+                mCaches.resourceCache.decrementRefcount(layer);
+            }
+            endMark();
+        }
+
+        mLayerUpdates.clear();
         glBindFramebuffer(GL_FRAMEBUFFER, getTargetFbo());
+
         endMark();
     }
 }
@@ -643,6 +716,63 @@
     return count;
 }
 
+void OpenGLRenderer::calculateLayerBoundsAndClip(Rect& bounds, Rect& clip, bool fboLayer) {
+    const Rect untransformedBounds(bounds);
+
+    currentTransform().mapRect(bounds);
+
+    // Layers only make sense if they are in the framebuffer's bounds
+    if (bounds.intersect(*mSnapshot->clipRect)) {
+        // We cannot work with sub-pixels in this case
+        bounds.snapToPixelBoundaries();
+
+        // When the layer is not an FBO, we may use glCopyTexImage so we
+        // need to make sure the layer does not extend outside the bounds
+        // of the framebuffer
+        if (!bounds.intersect(mSnapshot->previous->viewport)) {
+            bounds.setEmpty();
+        } else if (fboLayer) {
+            clip.set(bounds);
+            mat4 inverse;
+            inverse.loadInverse(currentTransform());
+            inverse.mapRect(clip);
+            clip.snapToPixelBoundaries();
+            if (clip.intersect(untransformedBounds)) {
+                clip.translate(-untransformedBounds.left, -untransformedBounds.top);
+                bounds.set(untransformedBounds);
+            } else {
+                clip.setEmpty();
+            }
+        }
+    } else {
+        bounds.setEmpty();
+    }
+}
+
+int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float bottom,
+        int alpha, SkXfermode::Mode mode, int flags) {
+    const GLuint previousFbo = mSnapshot->fbo;
+    const int count = saveSnapshot(flags);
+
+    if (!mSnapshot->isIgnored() && (flags & SkCanvas::kClipToLayer_SaveFlag)) {
+        // initialize the snapshot as though it almost represents an FBO layer so deferred draw
+        // operations will be able to store and restore the current clip and transform info, and
+        // quick rejection will be correct (for display lists)
+
+        Rect bounds(left, top, right, bottom);
+        Rect clip;
+        calculateLayerBoundsAndClip(bounds, clip, true);
+
+        if (!bounds.isEmpty() && !clip.isEmpty()) {
+            mSnapshot->resetTransform(-bounds.left, -bounds.top, 0.0f);
+            mSnapshot->resetClip(clip.left, clip.top, clip.right, clip.bottom);
+        }
+    }
+
+    return count;
+}
+
+
 /**
  * Layers are viewed by Skia are slightly different than layers in image editing
  * programs (for instance.) When a layer is created, previously created layers
@@ -704,35 +834,7 @@
     // Window coordinates of the layer
     Rect clip;
     Rect bounds(left, top, right, bottom);
-    Rect untransformedBounds(bounds);
-    currentTransform().mapRect(bounds);
-
-    // Layers only make sense if they are in the framebuffer's bounds
-    if (bounds.intersect(*mSnapshot->clipRect)) {
-        // We cannot work with sub-pixels in this case
-        bounds.snapToPixelBoundaries();
-
-        // When the layer is not an FBO, we may use glCopyTexImage so we
-        // need to make sure the layer does not extend outside the bounds
-        // of the framebuffer
-        if (!bounds.intersect(mSnapshot->previous->viewport)) {
-            bounds.setEmpty();
-        } else if (fboLayer) {
-            clip.set(bounds);
-            mat4 inverse;
-            inverse.loadInverse(currentTransform());
-            inverse.mapRect(clip);
-            clip.snapToPixelBoundaries();
-            if (clip.intersect(untransformedBounds)) {
-                clip.translate(-left, -top);
-                bounds.set(untransformedBounds);
-            } else {
-                clip.setEmpty();
-            }
-        }
-    } else {
-        bounds.setEmpty();
-    }
+    calculateLayerBoundsAndClip(bounds, clip, fboLayer);
 
     if (bounds.isEmpty() || bounds.getWidth() > mCaches.maxTextureSize ||
             bounds.getHeight() > mCaches.maxTextureSize ||
@@ -900,7 +1002,7 @@
 }
 
 void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) {
-    float alpha = layer->getAlpha() / 255.0f;
+    float alpha = layer->getAlpha() / 255.0f * mSnapshot->alpha;
 
     setupDraw();
     if (layer->getRenderTarget() == GL_TEXTURE_2D) {
@@ -964,9 +1066,10 @@
             layer->setFilter(GL_LINEAR, true);
         }
 
+        float alpha = layer->getAlpha() / 255.0f * mSnapshot->alpha;
+        bool blend = layer->isBlend() || alpha < 1.0f;
         drawTextureMesh(x, y, x + rect.getWidth(), y + rect.getHeight(),
-                layer->getTexture(), layer->getAlpha() / 255.0f,
-                layer->getMode(), layer->isBlend(),
+                layer->getTexture(), alpha, layer->getMode(), blend,
                 &mMeshVertices[0].position[0], &mMeshVertices[0].texture[0],
                 GL_TRIANGLE_STRIP, gMeshCount, swap, swap || simpleTransform);
 
@@ -1001,7 +1104,7 @@
             rects = safeRegion.getArray(&count);
         }
 
-        const float alpha = layer->getAlpha() / 255.0f;
+        const float alpha = layer->getAlpha() / 255.0f * mSnapshot->alpha;
         const float texX = 1.0f / float(layer->getWidth());
         const float texY = 1.0f / float(layer->getHeight());
         const float height = rect.getHeight();
@@ -1201,13 +1304,6 @@
 // State Deferral
 ///////////////////////////////////////////////////////////////////////////////
 
-void OpenGLRenderer::resetDrawModifiers() {
-    mDrawModifiers.mShader = NULL;
-    mDrawModifiers.mColorFilter = NULL;
-    mDrawModifiers.mHasShadow = false;
-    mDrawModifiers.mHasDrawFilter = false;
-}
-
 bool OpenGLRenderer::storeDisplayState(DeferredDisplayState& state, int stateDeferFlags) {
     const Rect& currentClip = *(mSnapshot->clipRect);
     const mat4& currentMatrix = *(mSnapshot->transform);
@@ -1246,7 +1342,7 @@
         mSnapshot->alpha = state.mAlpha;
     }
 
-    if (!state.mClip.isEmpty()) { //stateDeferFlags & kStateDeferFlag_Clip) {
+    if (!state.mClip.isEmpty()) {
         mSnapshot->setClip(state.mClip.left, state.mClip.top, state.mClip.right, state.mClip.bottom);
         dirtyClip();
     }
@@ -1726,7 +1822,7 @@
 }
 
 void OpenGLRenderer::setupDrawTexture(GLuint texture) {
-    bindTexture(texture);
+    if (texture) bindTexture(texture);
     mTextureUnit++;
     mCaches.enableTexCoordsVertexArray();
 }
@@ -1806,6 +1902,7 @@
     // will be performed by the display list itself
     if (displayList && displayList->isRenderable()) {
         if (CC_UNLIKELY(mCaches.drawDeferDisabled)) {
+            startFrame();
             ReplayStateStruct replayStruct(*this, dirty, replayFlags);
             displayList->replay(replayStruct, 0);
             return replayStruct.mDrawGlStatus;
@@ -1814,6 +1911,10 @@
         DeferredDisplayList deferredList;
         DeferStateStruct deferStruct(deferredList, *this, replayFlags);
         displayList->defer(deferStruct, 0);
+
+        flushLayers();
+        startFrame();
+
         return deferredList.flush(*this, dirty);
     }
 
@@ -2257,9 +2358,11 @@
     // TODO: try clipping large paths to viewport
     PathTessellator::tessellatePath(path, paint, mSnapshot->transform, vertexBuffer);
 
-    SkRect bounds = path.getBounds();
-    PathTessellator::expandBoundsForStroke(bounds, paint, false);
-    dirtyLayer(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, currentTransform());
+    if (hasLayer()) {
+        SkRect bounds = path.getBounds();
+        PathTessellator::expandBoundsForStroke(bounds, paint, false);
+        dirtyLayer(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, currentTransform());
+    }
 
     return drawVertexBuffer(vertexBuffer, paint);
 }
@@ -2383,13 +2486,14 @@
 
 status_t OpenGLRenderer::drawRoundRect(float left, float top, float right, float bottom,
         float rx, float ry, SkPaint* p) {
-    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p)) {
+    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+            (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
         return DrawGlInfo::kStatusDone;
     }
 
     if (p->getPathEffect() != 0) {
         mCaches.activeTexture(0);
-        const PathTexture* texture = mCaches.roundRectShapeCache.getRoundRect(
+        const PathTexture* texture = mCaches.pathCache.getRoundRect(
                 right - left, bottom - top, rx, ry, p);
         return drawShape(left, top, texture, p);
     }
@@ -2408,12 +2512,13 @@
 
 status_t OpenGLRenderer::drawCircle(float x, float y, float radius, SkPaint* p) {
     if (mSnapshot->isIgnored() || quickRejectPreStroke(x - radius, y - radius,
-            x + radius, y + radius, p)) {
+            x + radius, y + radius, p) ||
+            (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
         return DrawGlInfo::kStatusDone;
     }
     if (p->getPathEffect() != 0) {
         mCaches.activeTexture(0);
-        const PathTexture* texture = mCaches.circleShapeCache.getCircle(radius, p);
+        const PathTexture* texture = mCaches.pathCache.getCircle(radius, p);
         return drawShape(x - radius, y - radius, texture, p);
     }
 
@@ -2428,13 +2533,14 @@
 
 status_t OpenGLRenderer::drawOval(float left, float top, float right, float bottom,
         SkPaint* p) {
-    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p)) {
+    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+            (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
         return DrawGlInfo::kStatusDone;
     }
 
     if (p->getPathEffect() != 0) {
         mCaches.activeTexture(0);
-        const PathTexture* texture = mCaches.ovalShapeCache.getOval(right - left, bottom - top, p);
+        const PathTexture* texture = mCaches.pathCache.getOval(right - left, bottom - top, p);
         return drawShape(left, top, texture, p);
     }
 
@@ -2449,7 +2555,8 @@
 
 status_t OpenGLRenderer::drawArc(float left, float top, float right, float bottom,
         float startAngle, float sweepAngle, bool useCenter, SkPaint* p) {
-    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p)) {
+    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+            (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
         return DrawGlInfo::kStatusDone;
     }
 
@@ -2460,7 +2567,7 @@
     // TODO: support fills (accounting for concavity if useCenter && sweepAngle > 180)
     if (p->getStyle() != SkPaint::kStroke_Style || p->getPathEffect() != 0 || useCenter) {
         mCaches.activeTexture(0);
-        const PathTexture* texture = mCaches.arcShapeCache.getArc(right - left, bottom - top,
+        const PathTexture* texture = mCaches.pathCache.getArc(right - left, bottom - top,
                 startAngle, sweepAngle, useCenter, p);
         return drawShape(left, top, texture, p);
     }
@@ -2485,7 +2592,8 @@
 #define SkPaintDefaults_MiterLimit SkIntToScalar(4)
 
 status_t OpenGLRenderer::drawRect(float left, float top, float right, float bottom, SkPaint* p) {
-    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p)) {
+    if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+            (p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
         return DrawGlInfo::kStatusDone;
     }
 
@@ -2495,7 +2603,7 @@
                 p->getStrokeMiter() != SkPaintDefaults_MiterLimit) {
             mCaches.activeTexture(0);
             const PathTexture* texture =
-                    mCaches.rectShapeCache.getRect(right - left, bottom - top, p);
+                    mCaches.pathCache.getRect(right - left, bottom - top, p);
             return drawShape(left, top, texture, p);
         }
 
@@ -2561,6 +2669,48 @@
     return alpha == 0.0f && getXfermode(paint->getXfermode()) == SkXfermode::kSrcOver_Mode;
 }
 
+class TextSetupFunctor: public Functor {
+public:
+    TextSetupFunctor(OpenGLRenderer& renderer, float x, float y, bool pureTranslate,
+            int alpha, SkXfermode::Mode mode, SkPaint* paint): Functor(),
+            renderer(renderer), x(x), y(y), pureTranslate(pureTranslate),
+            alpha(alpha), mode(mode), paint(paint) {
+    }
+    ~TextSetupFunctor() { }
+
+    status_t operator ()(int what, void* data) {
+        renderer.setupDraw();
+        renderer.setupDrawTextGamma(paint);
+        renderer.setupDrawDirtyRegionsDisabled();
+        renderer.setupDrawWithTexture(true);
+        renderer.setupDrawAlpha8Color(paint->getColor(), alpha);
+        renderer.setupDrawColorFilter();
+        renderer.setupDrawShader();
+        renderer.setupDrawBlending(true, mode);
+        renderer.setupDrawProgram();
+        renderer.setupDrawModelView(x, y, x, y, pureTranslate, true);
+        // Calling setupDrawTexture with the name 0 will enable the
+        // uv attributes and increase the texture unit count
+        // texture binding will be performed by the font renderer as
+        // needed
+        renderer.setupDrawTexture(0);
+        renderer.setupDrawPureColorUniforms();
+        renderer.setupDrawColorFilterUniforms();
+        renderer.setupDrawShaderUniforms(pureTranslate);
+        renderer.setupDrawTextGammaUniforms();
+
+        return NO_ERROR;
+    }
+
+    OpenGLRenderer& renderer;
+    float x;
+    float y;
+    bool pureTranslate;
+    int alpha;
+    SkXfermode::Mode mode;
+    SkPaint* paint;
+};
+
 status_t OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count,
         const float* positions, SkPaint* paint) {
     if (text == NULL || count == 0 || mSnapshot->isIgnored() || canSkipText(paint)) {
@@ -2597,31 +2747,16 @@
     if (pureTranslate && !linearFilter) {
         linearFilter = fabs(y - (int) y) > 0.0f || fabs(x - (int) x) > 0.0f;
     }
-
-    mCaches.activeTexture(0);
-    setupDraw();
-    setupDrawTextGamma(paint);
-    setupDrawDirtyRegionsDisabled();
-    setupDrawWithTexture(true);
-    setupDrawAlpha8Color(paint->getColor(), alpha);
-    setupDrawColorFilter();
-    setupDrawShader();
-    setupDrawBlending(true, mode);
-    setupDrawProgram();
-    setupDrawModelView(x, y, x, y, pureTranslate, true);
-    setupDrawTexture(fontRenderer.getTexture(linearFilter));
-    setupDrawPureColorUniforms();
-    setupDrawColorFilterUniforms();
-    setupDrawShaderUniforms(pureTranslate);
-    setupDrawTextGammaUniforms();
+    fontRenderer.setTextureFiltering(linearFilter);
 
     const Rect* clip = pureTranslate ? mSnapshot->clipRect : &mSnapshot->getLocalClip();
     Rect bounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
 
     const bool hasActiveLayer = hasLayer();
 
+    TextSetupFunctor functor(*this, x, y, pureTranslate, alpha, mode, paint);
     if (fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y,
-            positions, hasActiveLayer ? &bounds : NULL)) {
+            positions, hasActiveLayer ? &bounds : NULL, &functor)) {
         if (hasActiveLayer) {
             if (!pureTranslate) {
                 currentTransform().mapRect(bounds);
@@ -2714,40 +2849,22 @@
 
     // Pick the appropriate texture filtering
     bool linearFilter = !pureTranslate || fabs(y - (int) y) > 0.0f || fabs(x - (int) x) > 0.0f;
-
-    // The font renderer will always use texture unit 0
-    mCaches.activeTexture(0);
-    setupDraw();
-    setupDrawTextGamma(paint);
-    setupDrawDirtyRegionsDisabled();
-    setupDrawWithTexture(true);
-    setupDrawAlpha8Color(paint->getColor(), alpha);
-    setupDrawColorFilter();
-    setupDrawShader();
-    setupDrawBlending(true, mode);
-    setupDrawProgram();
-    setupDrawModelView(x, y, x, y, pureTranslate, true);
-    // See comment above; the font renderer must use texture unit 0
-    // assert(mTextureUnit == 0)
-    setupDrawTexture(fontRenderer.getTexture(linearFilter));
-    setupDrawPureColorUniforms();
-    setupDrawColorFilterUniforms();
-    setupDrawShaderUniforms(pureTranslate);
-    setupDrawTextGammaUniforms();
+    fontRenderer.setTextureFiltering(linearFilter);
 
     // TODO: Implement better clipping for scaled/rotated text
     const Rect* clip = !pureTranslate ? NULL : mSnapshot->clipRect;
     Rect bounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
 
     bool status;
+    TextSetupFunctor functor(*this, x, y, pureTranslate, alpha, mode, paint);
     if (CC_UNLIKELY(paint->getTextAlign() != SkPaint::kLeft_Align)) {
         SkPaint paintCopy(*paint);
         paintCopy.setTextAlign(SkPaint::kLeft_Align);
         status = fontRenderer.renderPosText(&paintCopy, clip, text, 0, bytesCount, count, x, y,
-                positions, hasActiveLayer ? &bounds : NULL);
+                positions, hasActiveLayer ? &bounds : NULL, &functor);
     } else {
         status = fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y,
-                positions, hasActiveLayer ? &bounds : NULL);
+                positions, hasActiveLayer ? &bounds : NULL, &functor);
     }
 
     if (status && hasActiveLayer) {
@@ -2770,12 +2887,12 @@
 
     FontRenderer& fontRenderer = mCaches.fontRenderer->getFontRenderer(paint);
     fontRenderer.setFont(paint, mat4::identity());
+    fontRenderer.setTextureFiltering(true);
 
     int alpha;
     SkXfermode::Mode mode;
     getAlphaAndMode(paint, &alpha, &mode);
 
-    mCaches.activeTexture(0);
     setupDraw();
     setupDrawTextGamma(paint);
     setupDrawDirtyRegionsDisabled();
@@ -2786,7 +2903,11 @@
     setupDrawBlending(true, mode);
     setupDrawProgram();
     setupDrawModelView(0.0f, 0.0f, 0.0f, 0.0f, false, true);
-    setupDrawTexture(fontRenderer.getTexture(true));
+    // Calling setupDrawTexture with the name 0 will enable the
+    // uv attributes and increase the texture unit count
+    // texture binding will be performed by the font renderer as
+    // needed
+    setupDrawTexture(0);
     setupDrawPureColorUniforms();
     setupDrawColorFilterUniforms();
     setupDrawShaderUniforms(false);
@@ -2825,7 +2946,7 @@
     return DrawGlInfo::kStatusDrew;
 }
 
-status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) {
+status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y) {
     if (!layer) {
         return DrawGlInfo::kStatusDone;
     }
@@ -2863,7 +2984,7 @@
         if (layer->region.isRect()) {
             composeLayerRect(layer, layer->regionRect);
         } else if (layer->mesh) {
-            const float a = layer->getAlpha() / 255.0f;
+            const float a = layer->getAlpha() / 255.0f * mSnapshot->alpha;
             setupDraw();
             setupDrawWithTexture();
             setupDrawColor(a, a, a, a);
@@ -2970,12 +3091,8 @@
     mDrawModifiers.mPaintFilterSetBits = setBits & SkPaint::kAllFlags;
 }
 
-SkPaint* OpenGLRenderer::filterPaint(SkPaint* paint, bool alwaysCopy) {
+SkPaint* OpenGLRenderer::filterPaint(SkPaint* paint) {
     if (CC_LIKELY(!mDrawModifiers.mHasDrawFilter || !paint)) {
-        if (CC_UNLIKELY(alwaysCopy)) {
-            mFilteredPaint = *paint;
-            return &mFilteredPaint;
-        }
         return paint;
     }
 
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 3aa9975..31dc9c8 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -72,7 +72,6 @@
 
 struct DeferredDisplayState {
     Rect mBounds; // local bounds, mapped with matrix to be in screen space coordinates, clipped.
-    int mMultipliedAlpha; // -1 if invalid (because caching not set)
 
     // the below are set and used by the OpenGLRenderer at record and deferred playback
     Rect mClip;
@@ -86,6 +85,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 class DisplayList;
+class TextSetupFunctor;
 class VertexBuffer;
 
 /**
@@ -206,6 +206,9 @@
     virtual int saveLayer(float left, float top, float right, float bottom,
             int alpha, SkXfermode::Mode mode, int flags);
 
+    int saveLayerDeferred(float left, float top, float right, float bottom,
+            int alpha, SkXfermode::Mode mode, int flags);
+
     virtual void translate(float dx, float dy);
     virtual void rotate(float degrees);
     virtual void scale(float sx, float sy);
@@ -226,7 +229,7 @@
 
     virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t replayFlags);
     virtual void outputDisplayList(DisplayList* displayList);
-    virtual status_t drawLayer(Layer* layer, float x, float y, SkPaint* paint);
+    virtual status_t drawLayer(Layer* layer, float x, float y);
     virtual status_t drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
     virtual status_t drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
     virtual status_t drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
@@ -272,12 +275,14 @@
     virtual void resetPaintFilter();
     virtual void setupPaintFilter(int clearBits, int setBits);
 
-    SkPaint* filterPaint(SkPaint* paint, bool alwaysCopy = false);
+    SkPaint* filterPaint(SkPaint* paint);
 
-    void resetDrawModifiers();
     bool storeDisplayState(DeferredDisplayState& state, int stateDeferFlags);
     void restoreDisplayState(const DeferredDisplayState& state, int stateDeferFlags);
 
+    const DrawModifiers& getDrawModifiers() { return mDrawModifiers; }
+    void setDrawModifiers(const DrawModifiers& drawModifiers) { mDrawModifiers = drawModifiers; }
+
     // TODO: what does this mean? no perspective? no rotate?
     ANDROID_API bool isCurrentTransformSimple() {
         return mSnapshot->transform->isSimple();
@@ -293,11 +298,11 @@
     }
 
     /**
-     * Sets the alpha on the current snapshot. This alpha value will be modulated
+     * Scales the alpha on the current snapshot. This alpha value will be modulated
      * with other alpha values when drawing primitives.
      */
-    void setAlpha(float alpha) {
-        mSnapshot->alpha = alpha;
+    void scaleAlpha(float alpha) {
+        mSnapshot->alpha *= alpha;
     }
 
     /**
@@ -357,6 +362,18 @@
     void initViewport(int width, int height);
 
     /**
+     * Perform the setup specific to a frame. This method does not
+     * issue any OpenGL commands.
+     */
+    void setupFrameState(float left, float top, float right, float bottom, bool opaque);
+
+    /**
+     * Indicates the start of rendering. This method will setup the
+     * initial OpenGL state (viewport, clearing the buffer, etc.)
+     */
+    status_t startFrame();
+
+    /**
      * Clears the underlying surface if needed.
      */
     virtual status_t clear(float left, float top, float right, float bottom, bool opaque);
@@ -539,6 +556,11 @@
     bool quickRejectPreStroke(float left, float top, float right, float bottom, SkPaint* paint);
 
     /**
+     * given the local bounds of the layer, calculates ...
+     */
+    void calculateLayerBoundsAndClip(Rect& bounds, Rect& clip, bool fboLayer);
+
+    /**
      * Creates a new layer stored in the specified snapshot.
      *
      * @param snapshot The snapshot associated with the new layer
@@ -887,6 +909,7 @@
 
     bool updateLayer(Layer* layer, bool inFrame);
     void updateLayers();
+    void flushLayers();
 
     /**
      * Renders the specified region as a series of rectangles. This method
@@ -937,7 +960,11 @@
     // Current state
     sp<Snapshot> mSnapshot;
     // State used to define the clipping region
-    sp<Snapshot> mTilingSnapshot;
+    Rect mTilingClip;
+    // Is the target render surface opaque
+    bool mOpaque;
+    // Is a frame currently being rendered
+    bool mFrameStarted;
 
     // Used to draw textured quads
     TextureVertex mMeshVertices[4];
@@ -986,6 +1013,8 @@
     String8 mName;
 
     friend class DisplayListRenderer;
+    friend class Layer;
+    friend class TextSetupFunctor;
 
 }; // class OpenGLRenderer
 
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index fb687cd..fdb10e2 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2013 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.
@@ -15,19 +15,304 @@
  */
 
 #define LOG_TAG "OpenGLRenderer"
+#define ATRACE_TAG ATRACE_TAG_VIEW
 
-#include <utils/Mutex.h>
+#include <SkBitmap.h>
+#include <SkCanvas.h>
+#include <SkPaint.h>
+#include <SkPath.h>
+#include <SkRect.h>
 
-#include <sys/sysinfo.h>
+#include <utils/JenkinsHash.h>
+#include <utils/Trace.h>
 
 #include "Caches.h"
 #include "PathCache.h"
-#include "Properties.h"
+
+#include "thread/Signal.h"
+#include "thread/Task.h"
+#include "thread/TaskProcessor.h"
 
 namespace android {
 namespace uirenderer {
 
 ///////////////////////////////////////////////////////////////////////////////
+// Cache entries
+///////////////////////////////////////////////////////////////////////////////
+
+PathDescription::PathDescription():
+        type(kShapeNone),
+        join(SkPaint::kDefault_Join),
+        cap(SkPaint::kDefault_Cap),
+        style(SkPaint::kFill_Style),
+        miter(4.0f),
+        strokeWidth(1.0f),
+        pathEffect(NULL) {
+    memset(&shape, 0, sizeof(Shape));
+}
+
+PathDescription::PathDescription(ShapeType type, SkPaint* paint):
+        type(type),
+        join(paint->getStrokeJoin()),
+        cap(paint->getStrokeCap()),
+        style(paint->getStyle()),
+        miter(paint->getStrokeMiter()),
+        strokeWidth(paint->getStrokeWidth()),
+        pathEffect(paint->getPathEffect()) {
+    memset(&shape, 0, sizeof(Shape));
+}
+
+hash_t PathDescription::hash() const {
+    uint32_t hash = JenkinsHashMix(0, type);
+    hash = JenkinsHashMix(hash, join);
+    hash = JenkinsHashMix(hash, cap);
+    hash = JenkinsHashMix(hash, style);
+    hash = JenkinsHashMix(hash, android::hash_type(miter));
+    hash = JenkinsHashMix(hash, android::hash_type(strokeWidth));
+    hash = JenkinsHashMix(hash, android::hash_type(pathEffect));
+    hash = JenkinsHashMixBytes(hash, (uint8_t*) &shape, sizeof(Shape));
+    return JenkinsHashWhiten(hash);
+}
+
+int PathDescription::compare(const PathDescription& rhs) const {
+    return memcmp(this, &rhs, sizeof(PathDescription));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Utilities
+///////////////////////////////////////////////////////////////////////////////
+
+bool PathCache::canDrawAsConvexPath(SkPath* path, SkPaint* paint) {
+    // NOTE: This should only be used after PathTessellator handles joins properly
+    return paint->getPathEffect() == NULL && path->getConvexity() == SkPath::kConvex_Convexity;
+}
+
+void PathCache::computePathBounds(const SkPath* path, const SkPaint* paint,
+        float& left, float& top, float& offset, uint32_t& width, uint32_t& height) {
+    const SkRect& bounds = path->getBounds();
+    PathCache::computeBounds(bounds, paint, left, top, offset, width, height);
+}
+
+void PathCache::computeBounds(const SkRect& bounds, const SkPaint* paint,
+        float& left, float& top, float& offset, uint32_t& width, uint32_t& height) {
+    const float pathWidth = fmax(bounds.width(), 1.0f);
+    const float pathHeight = fmax(bounds.height(), 1.0f);
+
+    left = bounds.fLeft;
+    top = bounds.fTop;
+
+    offset = (int) floorf(fmax(paint->getStrokeWidth(), 1.0f) * 1.5f + 0.5f);
+
+    width = uint32_t(pathWidth + offset * 2.0 + 0.5);
+    height = uint32_t(pathHeight + offset * 2.0 + 0.5);
+}
+
+static void initBitmap(SkBitmap& bitmap, uint32_t width, uint32_t height) {
+    bitmap.setConfig(SkBitmap::kA8_Config, width, height);
+    bitmap.allocPixels();
+    bitmap.eraseColor(0);
+}
+
+static void initPaint(SkPaint& paint) {
+    // Make sure the paint is opaque, color, alpha, filter, etc.
+    // will be applied later when compositing the alpha8 texture
+    paint.setColor(0xff000000);
+    paint.setAlpha(255);
+    paint.setColorFilter(NULL);
+    paint.setMaskFilter(NULL);
+    paint.setShader(NULL);
+    SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrc_Mode);
+    SkSafeUnref(paint.setXfermode(mode));
+}
+
+static void drawPath(const SkPath *path, const SkPaint* paint, SkBitmap& bitmap,
+        float left, float top, float offset, uint32_t width, uint32_t height) {
+    initBitmap(bitmap, width, height);
+
+    SkPaint pathPaint(*paint);
+    initPaint(pathPaint);
+
+    SkCanvas canvas(bitmap);
+    canvas.translate(-left + offset, -top + offset);
+    canvas.drawPath(*path, pathPaint);
+}
+
+static PathTexture* createTexture(float left, float top, float offset,
+        uint32_t width, uint32_t height, uint32_t id) {
+    PathTexture* texture = new PathTexture();
+    texture->left = left;
+    texture->top = top;
+    texture->offset = offset;
+    texture->width = width;
+    texture->height = height;
+    texture->generation = id;
+    return texture;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Cache constructor/destructor
+///////////////////////////////////////////////////////////////////////////////
+
+PathCache::PathCache():
+        mCache(LruCache<PathDescription, PathTexture*>::kUnlimitedCapacity),
+        mSize(0), mMaxSize(MB(DEFAULT_PATH_CACHE_SIZE)) {
+    char property[PROPERTY_VALUE_MAX];
+    if (property_get(PROPERTY_PATH_CACHE_SIZE, property, NULL) > 0) {
+        INIT_LOGD("  Setting %s cache size to %sMB", name, property);
+        setMaxSize(MB(atof(property)));
+    } else {
+        INIT_LOGD("  Using default %s cache size of %.2fMB", name, DEFAULT_PATH_CACHE_SIZE);
+    }
+    init();
+}
+
+PathCache::~PathCache() {
+    mCache.clear();
+}
+
+void PathCache::init() {
+    mCache.setOnEntryRemovedListener(this);
+
+    GLint maxTextureSize;
+    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
+    mMaxTextureSize = maxTextureSize;
+
+    mDebugEnabled = readDebugLevel() & kDebugCaches;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Size management
+///////////////////////////////////////////////////////////////////////////////
+
+uint32_t PathCache::getSize() {
+    return mSize;
+}
+
+uint32_t PathCache::getMaxSize() {
+    return mMaxSize;
+}
+
+void PathCache::setMaxSize(uint32_t maxSize) {
+    mMaxSize = maxSize;
+    while (mSize > mMaxSize) {
+        mCache.removeOldest();
+    }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Callbacks
+///////////////////////////////////////////////////////////////////////////////
+
+void PathCache::operator()(PathDescription& entry, PathTexture*& texture) {
+    removeTexture(texture);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Caching
+///////////////////////////////////////////////////////////////////////////////
+
+void PathCache::removeTexture(PathTexture* texture) {
+    if (texture) {
+        const uint32_t size = texture->width * texture->height;
+        mSize -= size;
+
+        PATH_LOGD("PathCache::delete name, size, mSize = %d, %d, %d",
+                texture->id, size, mSize);
+        if (mDebugEnabled) {
+            ALOGD("Shape deleted, size = %d", size);
+        }
+
+        if (texture->id) {
+            glDeleteTextures(1, &texture->id);
+        }
+        delete texture;
+    }
+}
+
+void PathCache::purgeCache(uint32_t width, uint32_t height) {
+    const uint32_t size = width * height;
+    // Don't even try to cache a bitmap that's bigger than the cache
+    if (size < mMaxSize) {
+        while (mSize + size > mMaxSize) {
+            mCache.removeOldest();
+        }
+    }
+}
+
+void PathCache::trim() {
+    while (mSize > mMaxSize) {
+        mCache.removeOldest();
+    }
+}
+
+PathTexture* PathCache::addTexture(const PathDescription& entry, const SkPath *path,
+        const SkPaint* paint) {
+    ATRACE_CALL();
+
+    float left, top, offset;
+    uint32_t width, height;
+    computePathBounds(path, paint, left, top, offset, width, height);
+
+    if (!checkTextureSize(width, height)) return NULL;
+
+    purgeCache(width, height);
+
+    SkBitmap bitmap;
+    drawPath(path, paint, bitmap, left, top, offset, width, height);
+
+    PathTexture* texture = createTexture(left, top, offset, width, height,
+            path->getGenerationID());
+    generateTexture(entry, &bitmap, texture);
+
+    return texture;
+}
+
+void PathCache::generateTexture(const PathDescription& entry, SkBitmap* bitmap,
+        PathTexture* texture, bool addToCache) {
+    generateTexture(*bitmap, texture);
+
+    uint32_t size = texture->width * texture->height;
+    if (size < mMaxSize) {
+        mSize += size;
+        PATH_LOGD("PathCache::get/create: name, size, mSize = %d, %d, %d",
+                texture->id, size, mSize);
+        if (mDebugEnabled) {
+            ALOGD("Shape created, size = %d", size);
+        }
+        if (addToCache) {
+            mCache.put(entry, texture);
+        }
+    } else {
+        texture->cleanup = true;
+    }
+}
+
+void PathCache::clear() {
+    mCache.clear();
+}
+
+void PathCache::generateTexture(SkBitmap& bitmap, Texture* texture) {
+    SkAutoLockPixels alp(bitmap);
+    if (!bitmap.readyToDraw()) {
+        ALOGE("Cannot generate texture from bitmap");
+        return;
+    }
+
+    glGenTextures(1, &texture->id);
+
+    glBindTexture(GL_TEXTURE_2D, texture->id);
+    // Textures are Alpha8
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+    texture->blend = true;
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, texture->width, texture->height, 0,
+            GL_ALPHA, GL_UNSIGNED_BYTE, bitmap.getPixels());
+
+    texture->setFilter(GL_LINEAR);
+    texture->setWrap(GL_CLAMP_TO_EDGE);
+}
+
+///////////////////////////////////////////////////////////////////////////////
 // Path precaching
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -52,7 +337,7 @@
 
     if (width <= mMaxTextureSize && height <= mMaxTextureSize) {
         SkBitmap* bitmap = new SkBitmap();
-        PathCache::drawPath(t->path, t->paint, *bitmap, left, top, offset, width, height);
+        drawPath(t->path, t->paint, *bitmap, left, top, offset, width, height);
         t->setResult(bitmap);
     } else {
         texture->width = 0;
@@ -62,23 +347,18 @@
 }
 
 ///////////////////////////////////////////////////////////////////////////////
-// Path cache
+// Paths
 ///////////////////////////////////////////////////////////////////////////////
 
-PathCache::PathCache(): ShapeCache<PathCacheEntry>("path",
-        PROPERTY_PATH_CACHE_SIZE, DEFAULT_PATH_CACHE_SIZE) {
-}
-
-PathCache::~PathCache() {
-}
-
-void PathCache::remove(SkPath* path) {
-    Vector<PathCacheEntry> pathsToRemove;
-    LruCache<PathCacheEntry, PathTexture*>::Iterator i(mCache);
+void PathCache::remove(const path_pair_t& pair) {
+    Vector<PathDescription> pathsToRemove;
+    LruCache<PathDescription, PathTexture*>::Iterator i(mCache);
 
     while (i.next()) {
-        const PathCacheEntry& key = i.key();
-        if (key.path == path || key.path == path->getSourcePath()) {
+        const PathDescription& key = i.key();
+        if (key.type == kShapePath &&
+                (key.shape.path.mPath == pair.getFirst() ||
+                        key.shape.path.mPath == pair.getSecond())) {
             pathsToRemove.push(key);
         }
     }
@@ -90,7 +370,7 @@
 
 void PathCache::removeDeferred(SkPath* path) {
     Mutex::Autolock l(mLock);
-    mGarbage.push(path);
+    mGarbage.push(path_pair_t(path, const_cast<SkPath*>(path->getSourcePath())));
 }
 
 void PathCache::clearGarbage() {
@@ -121,7 +401,9 @@
 PathTexture* PathCache::get(SkPath* path, SkPaint* paint) {
     path = getSourcePath(path);
 
-    PathCacheEntry entry(path, paint);
+    PathDescription entry(kShapePath, paint);
+    entry.shape.path.mPath = path;
+
     PathTexture* texture = mCache.get(entry);
 
     if (!texture) {
@@ -135,7 +417,7 @@
             // producing the bitmap, so let's wait
             SkBitmap* bitmap = task->getResult();
             if (bitmap) {
-                addTexture(entry, bitmap, texture);
+                generateTexture(entry, bitmap, texture, false);
                 texture->clearTask();
             } else {
                 ALOGW("Path too large to be rendered into a texture");
@@ -144,6 +426,8 @@
                 mCache.remove(entry);
             }
         } else if (path->getGenerationID() != texture->generation) {
+            // The size of the path might have changed so we first
+            // remove the entry from the cache
             mCache.remove(entry);
             texture = addTexture(entry, path, paint);
         }
@@ -159,7 +443,9 @@
 
     path = getSourcePath(path);
 
-    PathCacheEntry entry(path, paint);
+    PathDescription entry(kShapePath, paint);
+    entry.shape.path.mPath = path;
+
     PathTexture* texture = mCache.get(entry);
 
     bool generate = false;
@@ -193,5 +479,130 @@
     }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+// Rounded rects
+///////////////////////////////////////////////////////////////////////////////
+
+PathTexture* PathCache::getRoundRect(float width, float height,
+        float rx, float ry, SkPaint* paint) {
+    PathDescription entry(kShapeRoundRect, paint);
+    entry.shape.roundRect.mWidth = width;
+    entry.shape.roundRect.mHeight = height;
+    entry.shape.roundRect.mRx = rx;
+    entry.shape.roundRect.mRy = ry;
+
+    PathTexture* texture = get(entry);
+
+    if (!texture) {
+        SkPath path;
+        SkRect r;
+        r.set(0.0f, 0.0f, width, height);
+        path.addRoundRect(r, rx, ry, SkPath::kCW_Direction);
+
+        texture = addTexture(entry, &path, paint);
+    }
+
+    return texture;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Circles
+///////////////////////////////////////////////////////////////////////////////
+
+PathTexture* PathCache::getCircle(float radius, SkPaint* paint) {
+    PathDescription entry(kShapeCircle, paint);
+    entry.shape.circle.mRadius = radius;
+
+    PathTexture* texture = get(entry);
+
+    if (!texture) {
+        SkPath path;
+        path.addCircle(radius, radius, radius, SkPath::kCW_Direction);
+
+        texture = addTexture(entry, &path, paint);
+    }
+
+    return texture;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Ovals
+///////////////////////////////////////////////////////////////////////////////
+
+PathTexture* PathCache::getOval(float width, float height, SkPaint* paint) {
+    PathDescription entry(kShapeOval, paint);
+    entry.shape.oval.mWidth = width;
+    entry.shape.oval.mHeight = height;
+
+    PathTexture* texture = get(entry);
+
+    if (!texture) {
+        SkPath path;
+        SkRect r;
+        r.set(0.0f, 0.0f, width, height);
+        path.addOval(r, SkPath::kCW_Direction);
+
+        texture = addTexture(entry, &path, paint);
+    }
+
+    return texture;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Rects
+///////////////////////////////////////////////////////////////////////////////
+
+PathTexture* PathCache::getRect(float width, float height, SkPaint* paint) {
+    PathDescription entry(kShapeRect, paint);
+    entry.shape.rect.mWidth = width;
+    entry.shape.rect.mHeight = height;
+
+    PathTexture* texture = get(entry);
+
+    if (!texture) {
+        SkPath path;
+        SkRect r;
+        r.set(0.0f, 0.0f, width, height);
+        path.addRect(r, SkPath::kCW_Direction);
+
+        texture = addTexture(entry, &path, paint);
+    }
+
+    return texture;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Arcs
+///////////////////////////////////////////////////////////////////////////////
+
+PathTexture* PathCache::getArc(float width, float height,
+        float startAngle, float sweepAngle, bool useCenter, SkPaint* paint) {
+    PathDescription entry(kShapeArc, paint);
+    entry.shape.arc.mWidth = width;
+    entry.shape.arc.mHeight = height;
+    entry.shape.arc.mStartAngle = startAngle;
+    entry.shape.arc.mSweepAngle = sweepAngle;
+    entry.shape.arc.mUseCenter = useCenter;
+
+    PathTexture* texture = get(entry);
+
+    if (!texture) {
+        SkPath path;
+        SkRect r;
+        r.set(0.0f, 0.0f, width, height);
+        if (useCenter) {
+            path.moveTo(r.centerX(), r.centerY());
+        }
+        path.arcTo(r, startAngle, sweepAngle, !useCenter);
+        if (useCenter) {
+            path.close();
+        }
+
+        texture = addTexture(entry, &path, paint);
+    }
+
+    return texture;
+}
+
 }; // namespace uirenderer
 }; // namespace android
diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h
index 27031a5..dd1f996 100644
--- a/libs/hwui/PathCache.h
+++ b/libs/hwui/PathCache.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2013 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.
@@ -17,17 +17,22 @@
 #ifndef ANDROID_HWUI_PATH_CACHE_H
 #define ANDROID_HWUI_PATH_CACHE_H
 
-#include <utils/Thread.h>
+#include <GLES2/gl2.h>
+
+#include <utils/LruCache.h>
+#include <utils/Mutex.h>
 #include <utils/Vector.h>
 
 #include "Debug.h"
-#include "ShapeCache.h"
-#include "thread/Signal.h"
-#include "thread/Task.h"
-#include "thread/TaskProcessor.h"
+#include "Properties.h"
+#include "Texture.h"
+#include "utils/Pair.h"
 
+class SkBitmap;
+class SkCanvas;
 class SkPaint;
 class SkPath;
+class SkRect;
 
 namespace android {
 namespace uirenderer {
@@ -35,60 +40,181 @@
 class Caches;
 
 ///////////////////////////////////////////////////////////////////////////////
+// Defines
+///////////////////////////////////////////////////////////////////////////////
+
+// Debug
+#if DEBUG_PATHS
+    #define PATH_LOGD(...) ALOGD(__VA_ARGS__)
+#else
+    #define PATH_LOGD(...)
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
 // Classes
 ///////////////////////////////////////////////////////////////////////////////
 
-struct PathCacheEntry: public ShapeCacheEntry {
-    PathCacheEntry(SkPath* path, SkPaint* paint):
-            ShapeCacheEntry(ShapeCacheEntry::kShapePath, paint) {
-        this->path = path;
+/**
+ * Alpha texture used to represent a path.
+ */
+struct PathTexture: public Texture {
+    PathTexture(): Texture() {
     }
 
-    PathCacheEntry(): ShapeCacheEntry() {
-        path = NULL;
+    ~PathTexture() {
+        clearTask();
     }
 
-    hash_t hash() const {
-        uint32_t hash = ShapeCacheEntry::hash();
-        hash = JenkinsHashMix(hash, android::hash_type(path));
-        return JenkinsHashWhiten(hash);
+    /**
+     * Left coordinate of the path bounds.
+     */
+    float left;
+    /**
+     * Top coordinate of the path bounds.
+     */
+    float top;
+    /**
+     * Offset to draw the path at the correct origin.
+     */
+    float offset;
+
+    sp<Task<SkBitmap*> > task() const {
+        return mTask;
     }
 
-    int compare(const ShapeCacheEntry& r) const {
-        int deltaInt = ShapeCacheEntry::compare(r);
-        if (deltaInt != 0) return deltaInt;
-
-        const PathCacheEntry& rhs = (const PathCacheEntry&) r;
-        return path - rhs.path;
+    void setTask(const sp<Task<SkBitmap*> >& task) {
+        mTask = task;
     }
 
-    SkPath* path;
+    void clearTask() {
+        if (mTask != NULL) {
+            mTask.clear();
+        }
+    }
 
-}; // PathCacheEntry
+private:
+    sp<Task<SkBitmap*> > mTask;
+}; // struct PathTexture
 
-inline hash_t hash_type(const PathCacheEntry& entry) {
-    return entry.hash();
-}
+enum ShapeType {
+    kShapeNone,
+    kShapeRect,
+    kShapeRoundRect,
+    kShapeCircle,
+    kShapeOval,
+    kShapeArc,
+    kShapePath
+};
+
+struct PathDescription {
+    ShapeType type;
+    SkPaint::Join join;
+    SkPaint::Cap cap;
+    SkPaint::Style style;
+    float miter;
+    float strokeWidth;
+    SkPathEffect* pathEffect;
+    union Shape {
+        struct Path {
+            SkPath* mPath;
+        } path;
+        struct RoundRect {
+            float mWidth;
+            float mHeight;
+            float mRx;
+            float mRy;
+        } roundRect;
+        struct Circle {
+            float mRadius;
+        } circle;
+        struct Oval {
+            float mWidth;
+            float mHeight;
+        } oval;
+        struct Rect {
+            float mWidth;
+            float mHeight;
+        } rect;
+        struct Arc {
+            float mWidth;
+            float mHeight;
+            float mStartAngle;
+            float mSweepAngle;
+            bool mUseCenter;
+        } arc;
+    } shape;
+
+    PathDescription();
+    PathDescription(ShapeType shapeType, SkPaint* paint);
+
+    hash_t hash() const;
+
+    int compare(const PathDescription& rhs) const;
+
+    bool operator==(const PathDescription& other) const {
+        return compare(other) == 0;
+    }
+
+    bool operator!=(const PathDescription& other) const {
+        return compare(other) != 0;
+    }
+
+    friend inline int strictly_order_type(
+            const PathDescription& lhs, const PathDescription& rhs) {
+        return lhs.compare(rhs) < 0;
+    }
+
+    friend inline int compare_type(const PathDescription& lhs, const PathDescription& rhs) {
+        return lhs.compare(rhs);
+    }
+
+    friend inline hash_t hash_type(const PathDescription& entry) {
+        return entry.hash();
+    }
+};
 
 /**
- * A simple LRU path cache. The cache has a maximum size expressed in bytes.
+ * A simple LRU shape cache. The cache has a maximum size expressed in bytes.
  * Any texture added to the cache causing the cache to grow beyond the maximum
  * allowed size will also cause the oldest texture to be kicked out.
  */
-class PathCache: public ShapeCache<PathCacheEntry> {
+class PathCache: public OnEntryRemoved<PathDescription, PathTexture*> {
 public:
     PathCache();
     ~PathCache();
 
     /**
-     * Returns the texture associated with the specified path. If the texture
-     * cannot be found in the cache, a new texture is generated.
+     * Used as a callback when an entry is removed from the cache.
+     * Do not invoke directly.
      */
-    PathTexture* get(SkPath* path, SkPaint* paint);
+    void operator()(PathDescription& path, PathTexture*& texture);
+
     /**
-     * Removes an entry.
+     * Clears the cache. This causes all textures to be deleted.
      */
-    void remove(SkPath* path);
+    void clear();
+
+    /**
+     * Sets the maximum size of the cache in bytes.
+     */
+    void setMaxSize(uint32_t maxSize);
+    /**
+     * Returns the maximum size of the cache in bytes.
+     */
+    uint32_t getMaxSize();
+    /**
+     * Returns the current size of the cache in bytes.
+     */
+    uint32_t getSize();
+
+    PathTexture* getRoundRect(float width, float height, float rx, float ry, SkPaint* paint);
+    PathTexture* getCircle(float radius, SkPaint* paint);
+    PathTexture* getOval(float width, float height, SkPaint* paint);
+    PathTexture* getRect(float width, float height, SkPaint* paint);
+    PathTexture* getArc(float width, float height, float startAngle, float sweepAngle,
+            bool useCenter, SkPaint* paint);
+    PathTexture* get(SkPath* path, SkPaint* paint);
+
     /**
      * Removes the specified path. This is meant to be called from threads
      * that are not the EGL context thread.
@@ -98,10 +224,72 @@
      * Process deferred removals.
      */
     void clearGarbage();
+    /**
+     * Trims the contents of the cache, removing items until it's under its
+     * specified limit.
+     *
+     * Trimming is used for caches that support pre-caching from a worker
+     * thread. During pre-caching the maximum limit of the cache can be
+     * exceeded for the duration of the frame. It is therefore required to
+     * trim the cache at the end of the frame to keep the total amount of
+     * memory used under control.
+     */
+    void trim();
 
+    /**
+     * Precaches the specified path using background threads.
+     */
     void precache(SkPath* path, SkPaint* paint);
 
+    static bool canDrawAsConvexPath(SkPath* path, SkPaint* paint);
+    static void computePathBounds(const SkPath* path, const SkPaint* paint,
+            float& left, float& top, float& offset, uint32_t& width, uint32_t& height);
+    static void computeBounds(const SkRect& bounds, const SkPaint* paint,
+            float& left, float& top, float& offset, uint32_t& width, uint32_t& height);
+
 private:
+    typedef Pair<SkPath*, SkPath*> path_pair_t;
+
+    PathTexture* addTexture(const PathDescription& entry,
+            const SkPath *path, const SkPaint* paint);
+    PathTexture* addTexture(const PathDescription& entry, SkBitmap* bitmap);
+
+    /**
+     * Generates the texture from a bitmap into the specified texture structure.
+     */
+    void generateTexture(SkBitmap& bitmap, Texture* texture);
+    void generateTexture(const PathDescription& entry, SkBitmap* bitmap, PathTexture* texture,
+            bool addToCache = true);
+
+    PathTexture* get(const PathDescription& entry) {
+        return mCache.get(entry);
+    }
+
+    /**
+     * Removes an entry.
+     * The pair must define first=path, second=sourcePath
+     */
+    void remove(const path_pair_t& pair);
+
+    /**
+     * Ensures there is enough space in the cache for a texture of the specified
+     * dimensions.
+     */
+    void purgeCache(uint32_t width, uint32_t height);
+
+    void removeTexture(PathTexture* texture);
+
+    bool checkTextureSize(uint32_t width, uint32_t height) {
+        if (width > mMaxTextureSize || height > mMaxTextureSize) {
+            ALOGW("Shape too large to be rendered into a texture (%dx%d, max=%dx%d)",
+                    width, height, mMaxTextureSize, mMaxTextureSize);
+            return false;
+        }
+        return true;
+    }
+
+    void init();
+
     class PathTask: public Task<SkBitmap*> {
     public:
         PathTask(SkPath* path, SkPaint* paint, PathTexture* texture):
@@ -128,8 +316,16 @@
         uint32_t mMaxTextureSize;
     };
 
+    LruCache<PathDescription, PathTexture*> mCache;
+    uint32_t mSize;
+    uint32_t mMaxSize;
+    GLuint mMaxTextureSize;
+
+    bool mDebugEnabled;
+
     sp<PathProcessor> mProcessor;
-    Vector<SkPath*> mGarbage;
+
+    Vector<path_pair_t> mGarbage;
     mutable Mutex mLock;
 }; // class PathCache
 
diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h
index b8559bc8..e4b4f3c 100644
--- a/libs/hwui/Properties.h
+++ b/libs/hwui/Properties.h
@@ -115,12 +115,11 @@
 #define PROPERTY_RENDER_BUFFER_CACHE_SIZE "ro.hwui.r_buffer_cache_size"
 #define PROPERTY_GRADIENT_CACHE_SIZE "ro.hwui.gradient_cache_size"
 #define PROPERTY_PATH_CACHE_SIZE "ro.hwui.path_cache_size"
-#define PROPERTY_SHAPE_CACHE_SIZE "ro.hwui.shape_cache_size"
 #define PROPERTY_DROP_SHADOW_CACHE_SIZE "ro.hwui.drop_shadow_cache_size"
 #define PROPERTY_FBO_CACHE_SIZE "ro.hwui.fbo_cache_size"
 
 // These properties are defined in percentage (range 0..1)
-#define PROPERTY_TEXTURE_CACHE_FLUSH_RATE "ro.hwui.texture_cache_flush_rate"
+#define PROPERTY_TEXTURE_CACHE_FLUSH_RATE "ro.hwui.texture_cache_flushrate"
 
 // These properties are defined in pixels
 #define PROPERTY_TEXT_SMALL_CACHE_WIDTH "ro.hwui.text_small_cache_width"
@@ -159,8 +158,7 @@
 #define DEFAULT_TEXTURE_CACHE_SIZE 24.0f
 #define DEFAULT_LAYER_CACHE_SIZE 16.0f
 #define DEFAULT_RENDER_BUFFER_CACHE_SIZE 2.0f
-#define DEFAULT_PATH_CACHE_SIZE 4.0f
-#define DEFAULT_SHAPE_CACHE_SIZE 1.0f
+#define DEFAULT_PATH_CACHE_SIZE 10.0f
 #define DEFAULT_PATCH_CACHE_SIZE 512
 #define DEFAULT_GRADIENT_CACHE_SIZE 0.5f
 #define DEFAULT_DROP_SHADOW_CACHE_SIZE 2.0f
diff --git a/libs/hwui/ShapeCache.cpp b/libs/hwui/ShapeCache.cpp
deleted file mode 100644
index 5a23235..0000000
--- a/libs/hwui/ShapeCache.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#define LOG_TAG "OpenGLRenderer"
-
-#include "ShapeCache.h"
-
-namespace android {
-namespace uirenderer {
-
-///////////////////////////////////////////////////////////////////////////////
-// Rounded rects
-///////////////////////////////////////////////////////////////////////////////
-
-RoundRectShapeCache::RoundRectShapeCache(): ShapeCache<RoundRectShapeCacheEntry>(
-        "round rect", PROPERTY_SHAPE_CACHE_SIZE, DEFAULT_SHAPE_CACHE_SIZE) {
-}
-
-PathTexture* RoundRectShapeCache::getRoundRect(float width, float height,
-        float rx, float ry, SkPaint* paint) {
-    RoundRectShapeCacheEntry entry(width, height, rx, ry, paint);
-    PathTexture* texture = get(entry);
-
-    if (!texture) {
-        SkPath path;
-        SkRect r;
-        r.set(0.0f, 0.0f, width, height);
-        path.addRoundRect(r, rx, ry, SkPath::kCW_Direction);
-
-        texture = addTexture(entry, &path, paint);
-    }
-
-    return texture;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Circles
-///////////////////////////////////////////////////////////////////////////////
-
-CircleShapeCache::CircleShapeCache(): ShapeCache<CircleShapeCacheEntry>(
-        "circle", PROPERTY_SHAPE_CACHE_SIZE, DEFAULT_SHAPE_CACHE_SIZE) {
-}
-
-PathTexture* CircleShapeCache::getCircle(float radius, SkPaint* paint) {
-    CircleShapeCacheEntry entry(radius, paint);
-    PathTexture* texture = get(entry);
-
-    if (!texture) {
-        SkPath path;
-        path.addCircle(radius, radius, radius, SkPath::kCW_Direction);
-
-        texture = addTexture(entry, &path, paint);
-    }
-
-    return texture;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Ovals
-///////////////////////////////////////////////////////////////////////////////
-
-OvalShapeCache::OvalShapeCache(): ShapeCache<OvalShapeCacheEntry>(
-        "oval", PROPERTY_SHAPE_CACHE_SIZE, DEFAULT_SHAPE_CACHE_SIZE) {
-}
-
-PathTexture* OvalShapeCache::getOval(float width, float height, SkPaint* paint) {
-    OvalShapeCacheEntry entry(width, height, paint);
-    PathTexture* texture = get(entry);
-
-    if (!texture) {
-        SkPath path;
-        SkRect r;
-        r.set(0.0f, 0.0f, width, height);
-        path.addOval(r, SkPath::kCW_Direction);
-
-        texture = addTexture(entry, &path, paint);
-    }
-
-    return texture;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Rects
-///////////////////////////////////////////////////////////////////////////////
-
-RectShapeCache::RectShapeCache(): ShapeCache<RectShapeCacheEntry>(
-        "rect", PROPERTY_SHAPE_CACHE_SIZE, DEFAULT_SHAPE_CACHE_SIZE) {
-}
-
-PathTexture* RectShapeCache::getRect(float width, float height, SkPaint* paint) {
-    RectShapeCacheEntry entry(width, height, paint);
-    PathTexture* texture = get(entry);
-
-    if (!texture) {
-        SkRect bounds;
-        bounds.set(0.0f, 0.0f, width, height);
-
-        float left, top, offset;
-        uint32_t rectWidth, rectHeight;
-        computeBounds(bounds, paint, left, top, offset, rectWidth, rectHeight);
-
-        if (!checkTextureSize(rectWidth, rectHeight)) return NULL;
-
-        purgeCache(rectWidth, rectHeight);
-
-        SkBitmap bitmap;
-        initBitmap(bitmap, rectWidth, rectHeight);
-
-        SkPaint pathPaint(*paint);
-        initPaint(pathPaint);
-
-        SkCanvas canvas(bitmap);
-        canvas.translate(-left + offset, -top + offset);
-        canvas.drawRect(bounds, pathPaint);
-
-        texture = createTexture(0, 0, offset, rectWidth, rectHeight, 0);
-        addTexture(entry, &bitmap, texture);
-    }
-
-    return texture;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Arcs
-///////////////////////////////////////////////////////////////////////////////
-
-ArcShapeCache::ArcShapeCache(): ShapeCache<ArcShapeCacheEntry>(
-        "arc", PROPERTY_SHAPE_CACHE_SIZE, DEFAULT_SHAPE_CACHE_SIZE) {
-}
-
-PathTexture* ArcShapeCache::getArc(float width, float height,
-        float startAngle, float sweepAngle, bool useCenter, SkPaint* paint) {
-    ArcShapeCacheEntry entry(width, height, startAngle, sweepAngle, useCenter, paint);
-    PathTexture* texture = get(entry);
-
-    if (!texture) {
-        SkPath path;
-        SkRect r;
-        r.set(0.0f, 0.0f, width, height);
-        if (useCenter) {
-            path.moveTo(r.centerX(), r.centerY());
-        }
-        path.arcTo(r, startAngle, sweepAngle, !useCenter);
-        if (useCenter) {
-            path.close();
-        }
-
-        texture = addTexture(entry, &path, paint);
-    }
-
-    return texture;
-}
-
-}; // namespace uirenderer
-}; // namespace android
diff --git a/libs/hwui/ShapeCache.h b/libs/hwui/ShapeCache.h
deleted file mode 100644
index 92314b0..0000000
--- a/libs/hwui/ShapeCache.h
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#ifndef ANDROID_HWUI_SHAPE_CACHE_H
-#define ANDROID_HWUI_SHAPE_CACHE_H
-
-#define ATRACE_TAG ATRACE_TAG_VIEW
-
-#include <GLES2/gl2.h>
-
-#include <SkBitmap.h>
-#include <SkCanvas.h>
-#include <SkPaint.h>
-#include <SkPath.h>
-#include <SkRect.h>
-
-#include <utils/JenkinsHash.h>
-#include <utils/LruCache.h>
-#include <utils/Trace.h>
-
-#include "Debug.h"
-#include "Properties.h"
-#include "Texture.h"
-#include "thread/Task.h"
-
-namespace android {
-namespace uirenderer {
-
-///////////////////////////////////////////////////////////////////////////////
-// Defines
-///////////////////////////////////////////////////////////////////////////////
-
-// Debug
-#if DEBUG_SHAPES
-    #define SHAPE_LOGD(...) ALOGD(__VA_ARGS__)
-#else
-    #define SHAPE_LOGD(...)
-#endif
-
-///////////////////////////////////////////////////////////////////////////////
-// Classes
-///////////////////////////////////////////////////////////////////////////////
-
-/**
- * Alpha texture used to represent a path.
- */
-struct PathTexture: public Texture {
-    PathTexture(): Texture() {
-    }
-
-    ~PathTexture() {
-        clearTask();
-    }
-
-    /**
-     * Left coordinate of the path bounds.
-     */
-    float left;
-    /**
-     * Top coordinate of the path bounds.
-     */
-    float top;
-    /**
-     * Offset to draw the path at the correct origin.
-     */
-    float offset;
-
-    sp<Task<SkBitmap*> > task() const {
-        return mTask;
-    }
-
-    void setTask(const sp<Task<SkBitmap*> >& task) {
-        mTask = task;
-    }
-
-    void clearTask() {
-        if (mTask != NULL) {
-            mTask.clear();
-        }
-    }
-
-private:
-    sp<Task<SkBitmap*> > mTask;
-}; // struct PathTexture
-
-/**
- * Describe a shape in the shape cache.
- */
-struct ShapeCacheEntry {
-    enum ShapeType {
-        kShapeNone,
-        kShapeRect,
-        kShapeRoundRect,
-        kShapeCircle,
-        kShapeOval,
-        kShapeArc,
-        kShapePath
-    };
-
-    ShapeCacheEntry() {
-        shapeType = kShapeNone;
-        join = SkPaint::kDefault_Join;
-        cap = SkPaint::kDefault_Cap;
-        style = SkPaint::kFill_Style;
-        miter = 4.0f;
-        strokeWidth = 1.0f;
-        pathEffect = NULL;
-    }
-
-    ShapeCacheEntry(ShapeType type, SkPaint* paint) {
-        shapeType = type;
-        join = paint->getStrokeJoin();
-        cap = paint->getStrokeCap();
-        miter = paint->getStrokeMiter();
-        strokeWidth = paint->getStrokeWidth();
-        style = paint->getStyle();
-        pathEffect = paint->getPathEffect();
-    }
-
-    virtual ~ShapeCacheEntry() {
-    }
-
-    virtual hash_t hash() const {
-        uint32_t hash = JenkinsHashMix(0, shapeType);
-        hash = JenkinsHashMix(hash, join);
-        hash = JenkinsHashMix(hash, cap);
-        hash = JenkinsHashMix(hash, style);
-        hash = JenkinsHashMix(hash, android::hash_type(miter));
-        hash = JenkinsHashMix(hash, android::hash_type(strokeWidth));
-        hash = JenkinsHashMix(hash, android::hash_type(pathEffect));
-        return JenkinsHashWhiten(hash);
-    }
-
-    virtual int compare(const ShapeCacheEntry& rhs) const {
-        int deltaInt = shapeType - rhs.shapeType;
-        if (deltaInt != 0) return deltaInt;
-
-        deltaInt = join - rhs.join;
-        if (deltaInt != 0) return deltaInt;
-
-        deltaInt = cap - rhs.cap;
-        if (deltaInt != 0) return deltaInt;
-
-        deltaInt = style - rhs.style;
-        if (deltaInt != 0) return deltaInt;
-
-        if (miter < rhs.miter) return -1;
-        if (miter > rhs.miter) return +1;
-
-        if (strokeWidth < rhs.strokeWidth) return -1;
-        if (strokeWidth > rhs.strokeWidth) return +1;
-
-        if (pathEffect < rhs.pathEffect) return -1;
-        if (pathEffect > rhs.pathEffect) return +1;
-
-        return 0;
-    }
-
-    bool operator==(const ShapeCacheEntry& other) const {
-        return compare(other) == 0;
-    }
-
-    bool operator!=(const ShapeCacheEntry& other) const {
-        return compare(other) != 0;
-    }
-
-    ShapeType shapeType;
-    SkPaint::Join join;
-    SkPaint::Cap cap;
-    SkPaint::Style style;
-    float miter;
-    float strokeWidth;
-    SkPathEffect* pathEffect;
-}; // struct ShapeCacheEntry
-
-// Cache support
-
-inline int strictly_order_type(const ShapeCacheEntry& lhs, const ShapeCacheEntry& rhs) {
-    return lhs.compare(rhs) < 0;
-}
-
-inline int compare_type(const ShapeCacheEntry& lhs, const ShapeCacheEntry& rhs) {
-    return lhs.compare(rhs);
-}
-
-inline hash_t hash_type(const ShapeCacheEntry& entry) {
-    return entry.hash();
-}
-
-struct RoundRectShapeCacheEntry: public ShapeCacheEntry {
-    RoundRectShapeCacheEntry(float width, float height, float rx, float ry, SkPaint* paint):
-            ShapeCacheEntry(ShapeCacheEntry::kShapeRoundRect, paint) {
-        mWidth = width;
-        mHeight = height;
-        mRx = rx;
-        mRy = ry;
-    }
-
-    RoundRectShapeCacheEntry(): ShapeCacheEntry() {
-        mWidth = 0;
-        mHeight = 0;
-        mRx = 0;
-        mRy = 0;
-    }
-
-    hash_t hash() const {
-        uint32_t hash = ShapeCacheEntry::hash();
-        hash = JenkinsHashMix(hash, android::hash_type(mWidth));
-        hash = JenkinsHashMix(hash, android::hash_type(mHeight));
-        hash = JenkinsHashMix(hash, android::hash_type(mRx));
-        hash = JenkinsHashMix(hash, android::hash_type(mRy));
-        return JenkinsHashWhiten(hash);
-    }
-
-    int compare(const ShapeCacheEntry& r) const {
-        int deltaInt = ShapeCacheEntry::compare(r);
-        if (deltaInt != 0) return deltaInt;
-
-        const RoundRectShapeCacheEntry& rhs = (const RoundRectShapeCacheEntry&) r;
-
-        if (mWidth < rhs.mWidth) return -1;
-        if (mWidth > rhs.mWidth) return +1;
-
-        if (mHeight < rhs.mHeight) return -1;
-        if (mHeight > rhs.mHeight) return +1;
-
-        if (mRx < rhs.mRx) return -1;
-        if (mRx > rhs.mRx) return +1;
-
-        if (mRy < rhs.mRy) return -1;
-        if (mRy > rhs.mRy) return +1;
-
-        return 0;
-    }
-
-private:
-    float mWidth;
-    float mHeight;
-    float mRx;
-    float mRy;
-}; // RoundRectShapeCacheEntry
-
-inline hash_t hash_type(const RoundRectShapeCacheEntry& entry) {
-    return entry.hash();
-}
-
-struct CircleShapeCacheEntry: public ShapeCacheEntry {
-    CircleShapeCacheEntry(float radius, SkPaint* paint):
-            ShapeCacheEntry(ShapeCacheEntry::kShapeCircle, paint) {
-        mRadius = radius;
-    }
-
-    CircleShapeCacheEntry(): ShapeCacheEntry() {
-        mRadius = 0;
-    }
-
-    hash_t hash() const {
-        uint32_t hash = ShapeCacheEntry::hash();
-        hash = JenkinsHashMix(hash, android::hash_type(mRadius));
-        return JenkinsHashWhiten(hash);
-    }
-
-    int compare(const ShapeCacheEntry& r) const {
-        int deltaInt = ShapeCacheEntry::compare(r);
-        if (deltaInt != 0) return deltaInt;
-
-        const CircleShapeCacheEntry& rhs = (const CircleShapeCacheEntry&) r;
-
-        if (mRadius < rhs.mRadius) return -1;
-        if (mRadius > rhs.mRadius) return +1;
-
-        return 0;
-    }
-
-private:
-    float mRadius;
-}; // CircleShapeCacheEntry
-
-inline hash_t hash_type(const CircleShapeCacheEntry& entry) {
-    return entry.hash();
-}
-
-struct OvalShapeCacheEntry: public ShapeCacheEntry {
-    OvalShapeCacheEntry(float width, float height, SkPaint* paint):
-            ShapeCacheEntry(ShapeCacheEntry::kShapeOval, paint) {
-        mWidth = width;
-        mHeight = height;
-    }
-
-    OvalShapeCacheEntry(): ShapeCacheEntry() {
-        mWidth = mHeight = 0;
-    }
-
-    hash_t hash() const {
-        uint32_t hash = ShapeCacheEntry::hash();
-        hash = JenkinsHashMix(hash, android::hash_type(mWidth));
-        hash = JenkinsHashMix(hash, android::hash_type(mHeight));
-        return JenkinsHashWhiten(hash);
-    }
-
-    int compare(const ShapeCacheEntry& r) const {
-        int deltaInt = ShapeCacheEntry::compare(r);
-        if (deltaInt != 0) return deltaInt;
-
-        const OvalShapeCacheEntry& rhs = (const OvalShapeCacheEntry&) r;
-
-        if (mWidth < rhs.mWidth) return -1;
-        if (mWidth > rhs.mWidth) return +1;
-
-        if (mHeight < rhs.mHeight) return -1;
-        if (mHeight > rhs.mHeight) return +1;
-
-        return 0;
-    }
-
-private:
-    float mWidth;
-    float mHeight;
-}; // OvalShapeCacheEntry
-
-inline hash_t hash_type(const OvalShapeCacheEntry& entry) {
-    return entry.hash();
-}
-
-struct RectShapeCacheEntry: public ShapeCacheEntry {
-    RectShapeCacheEntry(float width, float height, SkPaint* paint):
-            ShapeCacheEntry(ShapeCacheEntry::kShapeRect, paint) {
-        mWidth = width;
-        mHeight = height;
-    }
-
-    RectShapeCacheEntry(): ShapeCacheEntry() {
-        mWidth = mHeight = 0;
-    }
-
-    hash_t hash() const {
-        uint32_t hash = ShapeCacheEntry::hash();
-        hash = JenkinsHashMix(hash, android::hash_type(mWidth));
-        hash = JenkinsHashMix(hash, android::hash_type(mHeight));
-        return JenkinsHashWhiten(hash);
-    }
-
-    int compare(const ShapeCacheEntry& r) const {
-        int deltaInt = ShapeCacheEntry::compare(r);
-        if (deltaInt != 0) return deltaInt;
-
-        const RectShapeCacheEntry& rhs = (const RectShapeCacheEntry&) r;
-
-        if (mWidth < rhs.mWidth) return -1;
-        if (mWidth > rhs.mWidth) return +1;
-
-        if (mHeight < rhs.mHeight) return -1;
-        if (mHeight > rhs.mHeight) return +1;
-
-        return 0;
-    }
-
-private:
-    float mWidth;
-    float mHeight;
-}; // RectShapeCacheEntry
-
-inline hash_t hash_type(const RectShapeCacheEntry& entry) {
-    return entry.hash();
-}
-
-struct ArcShapeCacheEntry: public ShapeCacheEntry {
-    ArcShapeCacheEntry(float width, float height, float startAngle, float sweepAngle,
-            bool useCenter, SkPaint* paint):
-            ShapeCacheEntry(ShapeCacheEntry::kShapeArc, paint) {
-        mWidth = width;
-        mHeight = height;
-        mStartAngle = startAngle;
-        mSweepAngle = sweepAngle;
-        mUseCenter = useCenter ? 1 : 0;
-    }
-
-    ArcShapeCacheEntry(): ShapeCacheEntry() {
-        mWidth = 0;
-        mHeight = 0;
-        mStartAngle = 0;
-        mSweepAngle = 0;
-        mUseCenter = 0;
-    }
-
-    hash_t hash() const {
-        uint32_t hash = ShapeCacheEntry::hash();
-        hash = JenkinsHashMix(hash, android::hash_type(mWidth));
-        hash = JenkinsHashMix(hash, android::hash_type(mHeight));
-        hash = JenkinsHashMix(hash, android::hash_type(mStartAngle));
-        hash = JenkinsHashMix(hash, android::hash_type(mSweepAngle));
-        hash = JenkinsHashMix(hash, mUseCenter);
-        return JenkinsHashWhiten(hash);
-    }
-
-    int compare(const ShapeCacheEntry& r) const {
-        int deltaInt = ShapeCacheEntry::compare(r);
-        if (deltaInt != 0) return deltaInt;
-
-        const ArcShapeCacheEntry& rhs = (const ArcShapeCacheEntry&) r;
-
-        if (mWidth < rhs.mWidth) return -1;
-        if (mWidth > rhs.mWidth) return +1;
-
-        if (mHeight < rhs.mHeight) return -1;
-        if (mHeight > rhs.mHeight) return +1;
-
-        if (mStartAngle < rhs.mStartAngle) return -1;
-        if (mStartAngle > rhs.mStartAngle) return +1;
-
-        if (mSweepAngle < rhs.mSweepAngle) return -1;
-        if (mSweepAngle > rhs.mSweepAngle) return +1;
-
-        return mUseCenter - rhs.mUseCenter;
-    }
-
-private:
-    float mWidth;
-    float mHeight;
-    float mStartAngle;
-    float mSweepAngle;
-    uint32_t mUseCenter;
-}; // ArcShapeCacheEntry
-
-inline hash_t hash_type(const ArcShapeCacheEntry& entry) {
-    return entry.hash();
-}
-
-/**
- * A simple LRU shape cache. The cache has a maximum size expressed in bytes.
- * Any texture added to the cache causing the cache to grow beyond the maximum
- * allowed size will also cause the oldest texture to be kicked out.
- */
-template<typename Entry>
-class ShapeCache: public OnEntryRemoved<Entry, PathTexture*> {
-public:
-    ShapeCache(const char* name, const char* propertyName, float defaultSize);
-    ~ShapeCache();
-
-    /**
-     * Used as a callback when an entry is removed from the cache.
-     * Do not invoke directly.
-     */
-    void operator()(Entry& path, PathTexture*& texture);
-
-    /**
-     * Clears the cache. This causes all textures to be deleted.
-     */
-    void clear();
-
-    /**
-     * Sets the maximum size of the cache in bytes.
-     */
-    void setMaxSize(uint32_t maxSize);
-    /**
-     * Returns the maximum size of the cache in bytes.
-     */
-    uint32_t getMaxSize();
-    /**
-     * Returns the current size of the cache in bytes.
-     */
-    uint32_t getSize();
-
-    /**
-     * Trims the contents of the cache, removing items until it's under its
-     * specified limit.
-     *
-     * Trimming is used for caches that support pre-caching from a worker
-     * thread. During pre-caching the maximum limit of the cache can be
-     * exceeded for the duration of the frame. It is therefore required to
-     * trim the cache at the end of the frame to keep the total amount of
-     * memory used under control.
-     *
-     * Only the PathCache currently supports pre-caching.
-     */
-    void trim();
-
-    static void computePathBounds(const SkPath* path, const SkPaint* paint,
-            float& left, float& top, float& offset, uint32_t& width, uint32_t& height) {
-        const SkRect& bounds = path->getBounds();
-        computeBounds(bounds, paint, left, top, offset, width, height);
-    }
-
-    static void computeBounds(const SkRect& bounds, const SkPaint* paint,
-            float& left, float& top, float& offset, uint32_t& width, uint32_t& height) {
-        const float pathWidth = fmax(bounds.width(), 1.0f);
-        const float pathHeight = fmax(bounds.height(), 1.0f);
-
-        left = bounds.fLeft;
-        top = bounds.fTop;
-
-        offset = (int) floorf(fmax(paint->getStrokeWidth(), 1.0f) * 1.5f + 0.5f);
-
-        width = uint32_t(pathWidth + offset * 2.0 + 0.5);
-        height = uint32_t(pathHeight + offset * 2.0 + 0.5);
-    }
-
-    static void drawPath(const SkPath *path, const SkPaint* paint, SkBitmap& bitmap,
-            float left, float top, float offset, uint32_t width, uint32_t height) {
-        initBitmap(bitmap, width, height);
-
-        SkPaint pathPaint(*paint);
-        initPaint(pathPaint);
-
-        SkCanvas canvas(bitmap);
-        canvas.translate(-left + offset, -top + offset);
-        canvas.drawPath(*path, pathPaint);
-    }
-
-protected:
-    PathTexture* addTexture(const Entry& entry, const SkPath *path, const SkPaint* paint);
-    PathTexture* addTexture(const Entry& entry, SkBitmap* bitmap);
-    void addTexture(const Entry& entry, SkBitmap* bitmap, PathTexture* texture);
-
-    /**
-     * Ensures there is enough space in the cache for a texture of the specified
-     * dimensions.
-     */
-    void purgeCache(uint32_t width, uint32_t height);
-
-    PathTexture* get(Entry entry) {
-        return mCache.get(entry);
-    }
-
-    void removeTexture(PathTexture* texture);
-
-    bool checkTextureSize(uint32_t width, uint32_t height) {
-        if (width > mMaxTextureSize || height > mMaxTextureSize) {
-            ALOGW("Shape %s too large to be rendered into a texture (%dx%d, max=%dx%d)",
-                    mName, width, height, mMaxTextureSize, mMaxTextureSize);
-            return false;
-        }
-        return true;
-    }
-
-    static PathTexture* createTexture(float left, float top, float offset,
-            uint32_t width, uint32_t height, uint32_t id) {
-        PathTexture* texture = new PathTexture();
-        texture->left = left;
-        texture->top = top;
-        texture->offset = offset;
-        texture->width = width;
-        texture->height = height;
-        texture->generation = id;
-        return texture;
-    }
-
-    static void initBitmap(SkBitmap& bitmap, uint32_t width, uint32_t height) {
-        bitmap.setConfig(SkBitmap::kA8_Config, width, height);
-        bitmap.allocPixels();
-        bitmap.eraseColor(0);
-    }
-
-    static void initPaint(SkPaint& paint) {
-        // Make sure the paint is opaque, color, alpha, filter, etc.
-        // will be applied later when compositing the alpha8 texture
-        paint.setColor(0xff000000);
-        paint.setAlpha(255);
-        paint.setColorFilter(NULL);
-        paint.setMaskFilter(NULL);
-        paint.setShader(NULL);
-        SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrc_Mode);
-        SkSafeUnref(paint.setXfermode(mode));
-    }
-
-    LruCache<Entry, PathTexture*> mCache;
-    uint32_t mSize;
-    uint32_t mMaxSize;
-    GLuint mMaxTextureSize;
-
-    char* mName;
-    bool mDebugEnabled;
-
-private:
-    /**
-     * Generates the texture from a bitmap into the specified texture structure.
-     */
-    void generateTexture(SkBitmap& bitmap, Texture* texture);
-
-    void init();
-}; // class ShapeCache
-
-class RoundRectShapeCache: public ShapeCache<RoundRectShapeCacheEntry> {
-public:
-    RoundRectShapeCache();
-
-    PathTexture* getRoundRect(float width, float height, float rx, float ry, SkPaint* paint);
-}; // class RoundRectShapeCache
-
-class CircleShapeCache: public ShapeCache<CircleShapeCacheEntry> {
-public:
-    CircleShapeCache();
-
-    PathTexture* getCircle(float radius, SkPaint* paint);
-}; // class CircleShapeCache
-
-class OvalShapeCache: public ShapeCache<OvalShapeCacheEntry> {
-public:
-    OvalShapeCache();
-
-    PathTexture* getOval(float width, float height, SkPaint* paint);
-}; // class OvalShapeCache
-
-class RectShapeCache: public ShapeCache<RectShapeCacheEntry> {
-public:
-    RectShapeCache();
-
-    PathTexture* getRect(float width, float height, SkPaint* paint);
-}; // class RectShapeCache
-
-class ArcShapeCache: public ShapeCache<ArcShapeCacheEntry> {
-public:
-    ArcShapeCache();
-
-    PathTexture* getArc(float width, float height, float startAngle, float sweepAngle,
-            bool useCenter, SkPaint* paint);
-}; // class ArcShapeCache
-
-///////////////////////////////////////////////////////////////////////////////
-// Constructors/destructor
-///////////////////////////////////////////////////////////////////////////////
-
-template<class Entry>
-ShapeCache<Entry>::ShapeCache(const char* name, const char* propertyName, float defaultSize):
-        mCache(LruCache<ShapeCacheEntry, PathTexture*>::kUnlimitedCapacity),
-        mSize(0), mMaxSize(MB(defaultSize)) {
-    char property[PROPERTY_VALUE_MAX];
-    if (property_get(propertyName, property, NULL) > 0) {
-        INIT_LOGD("  Setting %s cache size to %sMB", name, property);
-        setMaxSize(MB(atof(property)));
-    } else {
-        INIT_LOGD("  Using default %s cache size of %.2fMB", name, defaultSize);
-    }
-
-    size_t len = strlen(name);
-    mName = new char[len + 1];
-    strcpy(mName, name);
-    mName[len] = '\0';
-
-    init();
-}
-
-template<class Entry>
-ShapeCache<Entry>::~ShapeCache() {
-    mCache.clear();
-    delete[] mName;
-}
-
-template<class Entry>
-void ShapeCache<Entry>::init() {
-    mCache.setOnEntryRemovedListener(this);
-
-    GLint maxTextureSize;
-    glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
-    mMaxTextureSize = maxTextureSize;
-
-    mDebugEnabled = readDebugLevel() & kDebugCaches;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Size management
-///////////////////////////////////////////////////////////////////////////////
-
-template<class Entry>
-uint32_t ShapeCache<Entry>::getSize() {
-    return mSize;
-}
-
-template<class Entry>
-uint32_t ShapeCache<Entry>::getMaxSize() {
-    return mMaxSize;
-}
-
-template<class Entry>
-void ShapeCache<Entry>::setMaxSize(uint32_t maxSize) {
-    mMaxSize = maxSize;
-    while (mSize > mMaxSize) {
-        mCache.removeOldest();
-    }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Callbacks
-///////////////////////////////////////////////////////////////////////////////
-
-template<class Entry>
-void ShapeCache<Entry>::operator()(Entry& path, PathTexture*& texture) {
-    removeTexture(texture);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Caching
-///////////////////////////////////////////////////////////////////////////////
-
-template<class Entry>
-void ShapeCache<Entry>::removeTexture(PathTexture* texture) {
-    if (texture) {
-        const uint32_t size = texture->width * texture->height;
-        mSize -= size;
-
-        SHAPE_LOGD("ShapeCache::callback: delete %s: name, size, mSize = %d, %d, %d",
-                mName, texture->id, size, mSize);
-        if (mDebugEnabled) {
-            ALOGD("Shape %s deleted, size = %d", mName, size);
-        }
-
-        if (texture->id) {
-            glDeleteTextures(1, &texture->id);
-        }
-        delete texture;
-    }
-}
-
-template<class Entry>
-void ShapeCache<Entry>::purgeCache(uint32_t width, uint32_t height) {
-    const uint32_t size = width * height;
-    // Don't even try to cache a bitmap that's bigger than the cache
-    if (size < mMaxSize) {
-        while (mSize + size > mMaxSize) {
-            mCache.removeOldest();
-        }
-    }
-}
-
-template<class Entry>
-void ShapeCache<Entry>::trim() {
-    while (mSize > mMaxSize) {
-        mCache.removeOldest();
-    }
-}
-
-template<class Entry>
-PathTexture* ShapeCache<Entry>::addTexture(const Entry& entry, const SkPath *path,
-        const SkPaint* paint) {
-    ATRACE_CALL();
-
-    float left, top, offset;
-    uint32_t width, height;
-    computePathBounds(path, paint, left, top, offset, width, height);
-
-    if (!checkTextureSize(width, height)) return NULL;
-
-    purgeCache(width, height);
-
-    SkBitmap bitmap;
-    drawPath(path, paint, bitmap, left, top, offset, width, height);
-
-    PathTexture* texture = createTexture(left, top, offset, width, height,
-            path->getGenerationID());
-    addTexture(entry, &bitmap, texture);
-
-    return texture;
-}
-
-template<class Entry>
-void ShapeCache<Entry>::addTexture(const Entry& entry, SkBitmap* bitmap, PathTexture* texture) {
-    generateTexture(*bitmap, texture);
-
-    uint32_t size = texture->width * texture->height;
-    if (size < mMaxSize) {
-        mSize += size;
-        SHAPE_LOGD("ShapeCache::get: create %s: name, size, mSize = %d, %d, %d",
-                mName, texture->id, size, mSize);
-        if (mDebugEnabled) {
-            ALOGD("Shape %s created, size = %d", mName, size);
-        }
-        mCache.put(entry, texture);
-    } else {
-        texture->cleanup = true;
-    }
-}
-
-template<class Entry>
-void ShapeCache<Entry>::clear() {
-    mCache.clear();
-}
-
-template<class Entry>
-void ShapeCache<Entry>::generateTexture(SkBitmap& bitmap, Texture* texture) {
-    SkAutoLockPixels alp(bitmap);
-    if (!bitmap.readyToDraw()) {
-        ALOGE("Cannot generate texture from bitmap");
-        return;
-    }
-
-    glGenTextures(1, &texture->id);
-
-    glBindTexture(GL_TEXTURE_2D, texture->id);
-    // Textures are Alpha8
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
-    texture->blend = true;
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, texture->width, texture->height, 0,
-            GL_ALPHA, GL_UNSIGNED_BYTE, bitmap.getPixels());
-
-    texture->setFilter(GL_LINEAR);
-    texture->setWrap(GL_CLAMP_TO_EDGE);
-}
-
-}; // namespace uirenderer
-}; // namespace android
-
-#endif // ANDROID_HWUI_SHAPE_CACHE_H
diff --git a/libs/hwui/SkiaShader.cpp b/libs/hwui/SkiaShader.cpp
index 9013fd5..c38eedb 100644
--- a/libs/hwui/SkiaShader.cpp
+++ b/libs/hwui/SkiaShader.cpp
@@ -411,8 +411,14 @@
 
 void SkiaComposeShader::setupProgram(Program* program, const mat4& modelView,
         const Snapshot& snapshot, GLuint* textureUnit) {
-    mFirst->setupProgram(program, modelView, snapshot, textureUnit);
-    mSecond->setupProgram(program, modelView, snapshot, textureUnit);
+    // Apply this compose shader's local transform and pass it down to
+    // the child shaders. They will in turn apply their local transform
+    // to this matrix.
+    mat4 transform;
+    computeScreenSpaceMatrix(transform, modelView);
+
+    mFirst->setupProgram(program, transform, snapshot, textureUnit);
+    mSecond->setupProgram(program, transform, snapshot, textureUnit);
 }
 
 }; // namespace uirenderer
diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp
index 923913e..d26ee38 100644
--- a/libs/hwui/Snapshot.cpp
+++ b/libs/hwui/Snapshot.cpp
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#define LOG_TAG "OpenGLRenderer"
+
 #include "Snapshot.h"
 
 #include <SkCanvas.h>
@@ -199,5 +201,14 @@
     return invisible || empty;
 }
 
+void Snapshot::dump() const {
+    ALOGD("Snapshot %p, flags %x, prev %p, height %d, ignored %d, hasComplexClip %d",
+            this, flags, previous.get(), height, isIgnored(), clipRegion && !clipRegion->isEmpty());
+    ALOGD("  ClipRect (at %p) %.1f %.1f %.1f %.1f",
+            clipRect, clipRect->left, clipRect->top, clipRect->right, clipRect->bottom);
+    ALOGD("  Transform (at %p):", transform);
+    transform->dump();
+}
+
 }; // namespace uirenderer
 }; // namespace android
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index ffd4729..cc6d0cd 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -228,6 +228,8 @@
      */
     float alpha;
 
+    void dump() const;
+
 private:
     void ensureClipRegion();
     void copyClipRectFromRegion();
diff --git a/libs/hwui/font/CacheTexture.cpp b/libs/hwui/font/CacheTexture.cpp
index 24b0523..1096642 100644
--- a/libs/hwui/font/CacheTexture.cpp
+++ b/libs/hwui/font/CacheTexture.cpp
@@ -106,6 +106,84 @@
 // CacheTexture
 ///////////////////////////////////////////////////////////////////////////////
 
+CacheTexture::CacheTexture(uint16_t width, uint16_t height, uint32_t maxQuadCount) :
+            mTexture(NULL), mTextureId(0), mWidth(width), mHeight(height),
+            mLinearFiltering(false), mDirty(false), mNumGlyphs(0),
+            mMesh(NULL), mCurrentQuad(0), mMaxQuadCount(maxQuadCount) {
+    mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
+            mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE, true);
+}
+
+CacheTexture::~CacheTexture() {
+    releaseMesh();
+    releaseTexture();
+    reset();
+}
+
+void CacheTexture::reset() {
+    // Delete existing cache blocks
+    while (mCacheBlocks != NULL) {
+        CacheBlock* tmpBlock = mCacheBlocks;
+        mCacheBlocks = mCacheBlocks->mNext;
+        delete tmpBlock;
+    }
+    mNumGlyphs = 0;
+    mCurrentQuad = 0;
+}
+
+void CacheTexture::init() {
+    // reset, then create a new remainder space to start again
+    reset();
+    mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
+            mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE, true);
+}
+
+void CacheTexture::releaseMesh() {
+    delete[] mMesh;
+}
+
+void CacheTexture::releaseTexture() {
+    if (mTexture) {
+        delete[] mTexture;
+        mTexture = NULL;
+    }
+    if (mTextureId) {
+        glDeleteTextures(1, &mTextureId);
+        mTextureId = 0;
+    }
+    mDirty = false;
+    mCurrentQuad = 0;
+}
+
+void CacheTexture::allocateMesh() {
+    if (!mMesh) {
+        mMesh = new TextureVertex[mMaxQuadCount * 4];
+    }
+}
+
+void CacheTexture::allocateTexture() {
+    if (!mTexture) {
+        mTexture = new uint8_t[mWidth * mHeight];
+    }
+
+    if (!mTextureId) {
+        glGenTextures(1, &mTextureId);
+
+        glBindTexture(GL_TEXTURE_2D, mTextureId);
+        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+        // Initialize texture dimensions
+        glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, mWidth, mHeight, 0,
+                GL_ALPHA, GL_UNSIGNED_BYTE, 0);
+
+        const GLenum filtering = getLinearFiltering() ? GL_LINEAR : GL_NEAREST;
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
+
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    }
+}
+
 bool CacheTexture::fitBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint32_t* retOriginY) {
     if (glyph.fHeight + TEXTURE_BORDER_SIZE * 2 > mHeight) {
         return false;
diff --git a/libs/hwui/font/CacheTexture.h b/libs/hwui/font/CacheTexture.h
index fdd1623..5742941 100644
--- a/libs/hwui/font/CacheTexture.h
+++ b/libs/hwui/font/CacheTexture.h
@@ -24,7 +24,8 @@
 #include <utils/Log.h>
 
 #include "FontUtil.h"
-#include "Rect.h"
+#include "../Rect.h"
+#include "../Vertex.h"
 
 namespace android {
 namespace uirenderer {
@@ -55,14 +56,14 @@
     }
 
     static CacheBlock* insertBlock(CacheBlock* head, CacheBlock* newBlock);
-
     static CacheBlock* removeBlock(CacheBlock* head, CacheBlock* blockToRemove);
 
     void output() {
         CacheBlock* currBlock = this;
         while (currBlock) {
             ALOGD("Block: this, x, y, w, h = %p, %d, %d, %d, %d",
-                    currBlock, currBlock->mX, currBlock->mY, currBlock->mWidth, currBlock->mHeight);
+                    currBlock, currBlock->mX, currBlock->mY,
+                    currBlock->mWidth, currBlock->mHeight);
             currBlock = currBlock->mNext;
         }
     }
@@ -70,72 +71,17 @@
 
 class CacheTexture {
 public:
-    CacheTexture(uint16_t width, uint16_t height) :
-            mTexture(NULL), mTextureId(0), mWidth(width), mHeight(height),
-            mLinearFiltering(false), mDirty(false), mNumGlyphs(0) {
-        mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
-                mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE, true);
-    }
+    CacheTexture(uint16_t width, uint16_t height, uint32_t maxQuadCount);
+    ~CacheTexture();
 
-    ~CacheTexture() {
-        releaseTexture();
-        reset();
-    }
+    void reset();
+    void init();
 
-    void reset() {
-        // Delete existing cache blocks
-        while (mCacheBlocks != NULL) {
-            CacheBlock* tmpBlock = mCacheBlocks;
-            mCacheBlocks = mCacheBlocks->mNext;
-            delete tmpBlock;
-        }
-        mNumGlyphs = 0;
-    }
+    void releaseMesh();
+    void releaseTexture();
 
-    void init() {
-        // reset, then create a new remainder space to start again
-        reset();
-        mCacheBlocks = new CacheBlock(TEXTURE_BORDER_SIZE, TEXTURE_BORDER_SIZE,
-                mWidth - TEXTURE_BORDER_SIZE, mHeight - TEXTURE_BORDER_SIZE, true);
-    }
-
-    void releaseTexture() {
-        if (mTexture) {
-            delete[] mTexture;
-            mTexture = NULL;
-        }
-        if (mTextureId) {
-            glDeleteTextures(1, &mTextureId);
-            mTextureId = 0;
-        }
-        mDirty = false;
-    }
-
-    /**
-     * This method assumes that the proper texture unit is active.
-     */
-    void allocateTexture() {
-        if (!mTexture) {
-            mTexture = new uint8_t[mWidth * mHeight];
-        }
-
-        if (!mTextureId) {
-            glGenTextures(1, &mTextureId);
-
-            glBindTexture(GL_TEXTURE_2D, mTextureId);
-            glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-            // Initialize texture dimensions
-            glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, mWidth, mHeight, 0,
-                    GL_ALPHA, GL_UNSIGNED_BYTE, 0);
-
-            const GLenum filtering = getLinearFiltering() ? GL_LINEAR : GL_NEAREST;
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering);
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering);
-
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-        }
-    }
+    void allocateTexture();
+    void allocateMesh();
 
     bool fitBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint32_t* retOriginY);
 
@@ -193,6 +139,42 @@
         return mNumGlyphs;
     }
 
+    TextureVertex* mesh() const {
+        return mMesh;
+    }
+
+    uint32_t meshElementCount() const {
+        return mCurrentQuad * 6;
+    }
+
+    uint16_t* indices() const {
+        return (uint16_t*) 0;
+    }
+
+    void resetMesh() {
+        mCurrentQuad = 0;
+    }
+
+    inline void addQuad(float x1, float y1, float u1, float v1,
+            float x2, float y2, float u2, float v2,
+            float x3, float y3, float u3, float v3,
+            float x4, float y4, float u4, float v4) {
+        TextureVertex* mesh = mMesh + mCurrentQuad * 4;
+        TextureVertex::set(mesh++, x1, y1, u1, v1);
+        TextureVertex::set(mesh++, x2, y2, u2, v2);
+        TextureVertex::set(mesh++, x3, y3, u3, v3);
+        TextureVertex::set(mesh++, x4, y4, u4, v4);
+        mCurrentQuad++;
+    }
+
+    bool canDraw() const {
+        return mCurrentQuad > 0;
+    }
+
+    bool endOfMesh() const {
+        return mCurrentQuad == mMaxQuadCount;
+    }
+
 private:
     uint8_t* mTexture;
     GLuint mTextureId;
@@ -201,6 +183,9 @@
     bool mLinearFiltering;
     bool mDirty;
     uint16_t mNumGlyphs;
+    TextureVertex* mMesh;
+    uint32_t mCurrentQuad;
+    uint32_t mMaxQuadCount;
     CacheBlock* mCacheBlocks;
     Rect mDirtyRect;
 };
diff --git a/libs/hwui/font/FontUtil.h b/libs/hwui/font/FontUtil.h
index 4f9c46b..f758666 100644
--- a/libs/hwui/font/FontUtil.h
+++ b/libs/hwui/font/FontUtil.h
@@ -26,7 +26,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #define DEFAULT_TEXT_SMALL_CACHE_WIDTH 1024
-#define DEFAULT_TEXT_SMALL_CACHE_HEIGHT 256
+#define DEFAULT_TEXT_SMALL_CACHE_HEIGHT 512
 #define DEFAULT_TEXT_LARGE_CACHE_WIDTH 2048
 #define DEFAULT_TEXT_LARGE_CACHE_HEIGHT 512
 
diff --git a/libs/hwui/thread/TaskManager.cpp b/libs/hwui/thread/TaskManager.cpp
index ce6c8c0..c8bfd9c 100644
--- a/libs/hwui/thread/TaskManager.cpp
+++ b/libs/hwui/thread/TaskManager.cpp
@@ -48,6 +48,12 @@
     return mThreads.size() > 0;
 }
 
+void TaskManager::stop() {
+    for (size_t i = 0; i < mThreads.size(); i++) {
+        mThreads[i]->exit();
+    }
+}
+
 bool TaskManager::addTaskBase(const sp<TaskBase>& task, const sp<TaskProcessorBase>& processor) {
     if (mThreads.size() > 0) {
         TaskWrapper wrapper(task, processor);
diff --git a/libs/hwui/thread/TaskManager.h b/libs/hwui/thread/TaskManager.h
index bc86062..477314b 100644
--- a/libs/hwui/thread/TaskManager.h
+++ b/libs/hwui/thread/TaskManager.h
@@ -47,6 +47,12 @@
      */
     bool canRunTasks() const;
 
+    /**
+     * Stops all allocated threads. Adding tasks will start
+     * the threads again as necessary.
+     */
+    void stop();
+
 private:
     template <typename T>
     friend class TaskProcessor;
diff --git a/libs/hwui/utils/Pair.h b/libs/hwui/utils/Pair.h
new file mode 100644
index 0000000..172606a4
--- /dev/null
+++ b/libs/hwui/utils/Pair.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+#ifndef ANDROID_HWUI_PAIR_H
+#define ANDROID_HWUI_PAIR_H
+
+namespace android {
+namespace uirenderer {
+
+template <typename F, typename S>
+struct Pair {
+    F first;
+    S second;
+
+    Pair() { }
+    Pair(const Pair& o) : first(o.first), second(o.second) { }
+    Pair(const F& f, const S& s) : first(f), second(s)  { }
+
+    inline const F& getFirst() const {
+        return first;
+    }
+
+    inline const S& getSecond() const {
+        return second;
+    }
+};
+
+}; // namespace uirenderer
+
+template <typename F, typename S>
+struct trait_trivial_ctor< uirenderer::Pair<F, S> >
+{ enum { value = aggregate_traits<F, S>::has_trivial_ctor }; };
+template <typename F, typename S>
+struct trait_trivial_dtor< uirenderer::Pair<F, S> >
+{ enum { value = aggregate_traits<F, S>::has_trivial_dtor }; };
+template <typename F, typename S>
+struct trait_trivial_copy< uirenderer::Pair<F, S> >
+{ enum { value = aggregate_traits<F, S>::has_trivial_copy }; };
+template <typename F, typename S>
+struct trait_trivial_move< uirenderer::Pair<F, S> >
+{ enum { value = aggregate_traits<F, S>::has_trivial_move }; };
+
+}; // namespace android
+
+#endif // ANDROID_HWUI_PAIR_H
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 135d2c8..6f284f8 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -2047,11 +2047,28 @@
     }
 
     /**
+     * Register a component to be the sole receiver of MEDIA_BUTTON intents.  This is like
+     * {@link #registerMediaButtonEventReceiver(android.content.ComponentName)}, but allows
+     * the buttons to go to any PendingIntent.  Note that you should only use this form if
+     * you know you will continue running for the full time until unregistering the
+     * PendingIntent.
+     * @param eventReceiver target that will receive media button intents.  The PendingIntent
+     * will be sent as-is when a media button action occurs, with {@link Intent#EXTRA_KEY_EVENT}
+     * added and holding the key code of the media button that was pressed.
+     */
+    public void registerMediaButtonEventReceiver(PendingIntent eventReceiver) {
+        if (eventReceiver == null) {
+            return;
+        }
+        registerMediaButtonIntent(eventReceiver, null);
+    }
+
+    /**
      * @hide
      * no-op if (pi == null) or (eventReceiver == null)
      */
     public void registerMediaButtonIntent(PendingIntent pi, ComponentName eventReceiver) {
-        if ((pi == null) || (eventReceiver == null)) {
+        if (pi == null) {
             Log.e(TAG, "Cannot call registerMediaButtonIntent() with a null parameter");
             return;
         }
@@ -2114,6 +2131,18 @@
     }
 
     /**
+     * Unregister the receiver of MEDIA_BUTTON intents.
+     * @param eventReceiver same PendingIntent that was registed with
+     *      {@link #registerMediaButtonEventReceiver(PendingIntent)}.
+     */
+    public void unregisterMediaButtonEventReceiver(PendingIntent eventReceiver) {
+        if (eventReceiver == null) {
+            return;
+        }
+        unregisterMediaButtonIntent(eventReceiver, null);
+    }
+
+    /**
      * @hide
      */
     public void unregisterMediaButtonIntent(PendingIntent pi, ComponentName eventReceiver) {
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index f0a5c28..38cdb8a 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -42,6 +42,8 @@
 import android.content.IntentFilter;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
 import android.database.ContentObserver;
 import android.media.MediaPlayer.OnCompletionListener;
 import android.media.MediaPlayer.OnErrorListener;
@@ -70,10 +72,14 @@
 import android.view.VolumePanel;
 
 import com.android.internal.telephony.ITelephony;
+import com.android.internal.util.XmlUtils;
+
+import org.xmlpull.v1.XmlPullParserException;
 
 import java.io.FileDescriptor;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.HashMap;
@@ -159,6 +165,7 @@
     private static final int MSG_PERSIST_SAFE_VOLUME_STATE = 28;
     private static final int MSG_PROMOTE_RCC = 29;
     private static final int MSG_BROADCAST_BT_CONNECTION_STATE = 30;
+    private static final int MSG_UNLOAD_SOUND_EFFECTS = 31;
 
 
     // flags for MSG_PERSIST_VOLUME indicating if current and/or last audible volume should be
@@ -197,28 +204,12 @@
 
     /* Sound effect file names  */
     private static final String SOUND_EFFECTS_PATH = "/media/audio/ui/";
-    private static final String[] SOUND_EFFECT_FILES = new String[] {
-        "Effect_Tick.ogg",
-        "KeypressStandard.ogg",
-        "KeypressSpacebar.ogg",
-        "KeypressDelete.ogg",
-        "KeypressReturn.ogg"
-    };
+    private static final List<String> SOUND_EFFECT_FILES = new ArrayList<String>();
 
     /* Sound effect file name mapping sound effect id (AudioManager.FX_xxx) to
      * file index in SOUND_EFFECT_FILES[] (first column) and indicating if effect
      * uses soundpool (second column) */
-    private final int[][] SOUND_EFFECT_FILES_MAP = new int[][] {
-        {0, -1},  // FX_KEY_CLICK
-        {0, -1},  // FX_FOCUS_NAVIGATION_UP
-        {0, -1},  // FX_FOCUS_NAVIGATION_DOWN
-        {0, -1},  // FX_FOCUS_NAVIGATION_LEFT
-        {0, -1},  // FX_FOCUS_NAVIGATION_RIGHT
-        {1, -1},  // FX_KEYPRESS_STANDARD
-        {2, -1},  // FX_KEYPRESS_SPACEBAR
-        {3, -1},  // FX_FOCUS_DELETE
-        {4, -1}   // FX_FOCUS_RETURN
-    };
+    private final int[][] SOUND_EFFECT_FILES_MAP = new int[AudioManager.NUM_SOUND_EFFECTS][2];
 
    /** @hide Maximum volume index values for audio streams */
     private final int[] MAX_STREAM_VOLUME = new int[] {
@@ -267,6 +258,8 @@
     };
     private int[] mStreamVolumeAlias;
 
+    private final boolean mUseFixedVolume;
+
     // stream names used by dumpStreamStates()
     private final String[] STREAM_NAMES = new String[] {
             "STREAM_VOICE_CALL",
@@ -497,6 +490,9 @@
         mSafeMediaVolumeIndex = mContext.getResources().getInteger(
                 com.android.internal.R.integer.config_safe_media_volume_index) * 10;
 
+        mUseFixedVolume = mContext.getResources().getBoolean(
+                com.android.internal.R.bool.config_useFixedVolume);
+
         readPersistedSettings();
         mSettingsObserver = new SettingsObserver();
         updateStreamVolumeAlias(false /*updateVolumes*/);
@@ -688,6 +684,9 @@
         if (ringerMode != ringerModeFromSettings) {
             Settings.Global.putInt(cr, Settings.Global.MODE_RINGER, ringerMode);
         }
+        if (mUseFixedVolume) {
+            ringerMode = AudioManager.RINGER_MODE_NORMAL;
+        }
         synchronized(mSettingsLock) {
             mRingerMode = ringerMode;
 
@@ -746,6 +745,10 @@
 
         boolean masterMute = System.getIntForUser(cr, System.VOLUME_MASTER_MUTE,
                                                   0, UserHandle.USER_CURRENT) == 1;
+        if (mUseFixedVolume) {
+            masterMute = false;
+            AudioSystem.setMasterVolume(1.0f);
+        }
         AudioSystem.setMasterMute(masterMute);
         broadcastMasterMuteStatus(masterMute);
 
@@ -786,7 +789,7 @@
         }
     }
 
-    /** @see AudioManager#adjustVolume(int, int, int) */
+    /** @see AudioManager#adjustVolume(int, int) */
     public void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags) {
         if (DEBUG_VOL) Log.d(TAG, "adjustSuggestedStreamVolume() stream="+suggestedStreamType);
         int streamType;
@@ -816,6 +819,9 @@
 
     /** @see AudioManager#adjustStreamVolume(int, int, int) */
     public void adjustStreamVolume(int streamType, int direction, int flags) {
+        if (mUseFixedVolume) {
+            return;
+        }
         if (DEBUG_VOL) Log.d(TAG, "adjustStreamVolume() stream="+streamType+", dir="+direction);
 
         ensureValidDirection(direction);
@@ -926,8 +932,11 @@
         sendVolumeUpdate(streamType, oldIndex, index, flags);
     }
 
-    /** @see AudioManager#adjustMasterVolume(int) */
+    /** @see AudioManager#adjustMasterVolume(int, int) */
     public void adjustMasterVolume(int steps, int flags) {
+        if (mUseFixedVolume) {
+            return;
+        }
         ensureValidSteps(steps);
         int volume = Math.round(AudioSystem.getMasterVolume() * MAX_MASTER_VOLUME);
         int delta = 0;
@@ -982,6 +991,10 @@
 
     /** @see AudioManager#setStreamVolume(int, int, int) */
     public void setStreamVolume(int streamType, int index, int flags) {
+        if (mUseFixedVolume) {
+            return;
+        }
+
         ensureValidStreamType(streamType);
         VolumeStreamState streamState = mStreamStates[mStreamVolumeAlias[streamType]];
 
@@ -1224,6 +1237,10 @@
 
     /** @see AudioManager#setStreamSolo(int, boolean) */
     public void setStreamSolo(int streamType, boolean state, IBinder cb) {
+        if (mUseFixedVolume) {
+            return;
+        }
+
         for (int stream = 0; stream < mStreamStates.length; stream++) {
             if (!isStreamAffectedByMute(stream) || stream == streamType) continue;
             // Bring back last audible volume
@@ -1233,6 +1250,10 @@
 
     /** @see AudioManager#setStreamMute(int, boolean) */
     public void setStreamMute(int streamType, boolean state, IBinder cb) {
+        if (mUseFixedVolume) {
+            return;
+        }
+
         if (isStreamAffectedByMute(streamType)) {
             mStreamStates[streamType].mute(cb, state);
         }
@@ -1243,8 +1264,12 @@
         return (mStreamStates[streamType].muteCount() != 0);
     }
 
-    /** @see AudioManager#setMasterMute(boolean, IBinder) */
+    /** @see AudioManager#setMasterMute(boolean, int) */
     public void setMasterMute(boolean state, int flags, IBinder cb) {
+        if (mUseFixedVolume) {
+            return;
+        }
+
         if (state != AudioSystem.getMasterMute()) {
             AudioSystem.setMasterMute(state);
             // Post a persist master volume msg
@@ -1278,6 +1303,10 @@
     }
 
     public void setMasterVolume(int volume, int flags) {
+        if (mUseFixedVolume) {
+            return;
+        }
+
         if (volume < 0) {
             volume = 0;
         } else if (volume > MAX_MASTER_VOLUME) {
@@ -1325,7 +1354,7 @@
         return Math.round(AudioSystem.getMasterVolume() * MAX_MASTER_VOLUME);
     }
 
-    /** @see AudioManager#getMasterStreamType(int) */
+    /** @see AudioManager#getMasterStreamType()  */
     public int getMasterStreamType() {
         if (mVoiceCapable) {
             return AudioSystem.STREAM_RING;
@@ -1349,6 +1378,10 @@
 
     /** @see AudioManager#setRingerMode(int) */
     public void setRingerMode(int ringerMode) {
+        if (mUseFixedVolume) {
+            return;
+        }
+
         if ((ringerMode == AudioManager.RINGER_MODE_VIBRATE) && !mHasVibrator) {
             ringerMode = AudioManager.RINGER_MODE_SILENT;
         }
@@ -1408,6 +1441,10 @@
     }
 
     private void restoreMasterVolume() {
+        if (mUseFixedVolume) {
+            AudioSystem.setMasterVolume(1.0f);
+            return;
+        }
         if (mUseMasterVolume) {
             float volume = Settings.System.getFloatForUser(mContentResolver,
                     Settings.System.VOLUME_MASTER, -1.0f, UserHandle.USER_CURRENT);
@@ -1634,16 +1671,118 @@
         return mMode;
     }
 
+    //==========================================================================================
+    // Sound Effects
+    //==========================================================================================
+
+    private static final String TAG_AUDIO_ASSETS = "audio_assets";
+    private static final String ATTR_VERSION = "version";
+    private static final String TAG_GROUP = "group";
+    private static final String ATTR_GROUP_NAME = "name";
+    private static final String TAG_ASSET = "asset";
+    private static final String ATTR_ASSET_ID = "id";
+    private static final String ATTR_ASSET_FILE = "file";
+
+    private static final String ASSET_FILE_VERSION = "1.0";
+    private static final String GROUP_TOUCH_SOUNDS = "touch_sounds";
+
+    private static final int SOUND_EFECTS_LOAD_TIMEOUT_MS = 5000;
+
+    class LoadSoundEffectReply {
+        public int mStatus = 1;
+    };
+
+    private void loadTouchSoundAssetDefaults() {
+        SOUND_EFFECT_FILES.add("Effect_Tick.ogg");
+        for (int i = 0; i < AudioManager.NUM_SOUND_EFFECTS; i++) {
+            SOUND_EFFECT_FILES_MAP[i][0] = 0;
+            SOUND_EFFECT_FILES_MAP[i][1] = -1;
+        }
+    }
+
+    private void loadTouchSoundAssets() {
+        XmlResourceParser parser = null;
+
+        // only load assets once.
+        if (!SOUND_EFFECT_FILES.isEmpty()) {
+            return;
+        }
+
+        loadTouchSoundAssetDefaults();
+
+        try {
+            parser = mContext.getResources().getXml(com.android.internal.R.xml.audio_assets);
+
+            XmlUtils.beginDocument(parser, TAG_AUDIO_ASSETS);
+            String version = parser.getAttributeValue(null, ATTR_VERSION);
+            boolean inTouchSoundsGroup = false;
+
+            if (ASSET_FILE_VERSION.equals(version)) {
+                while (true) {
+                    XmlUtils.nextElement(parser);
+                    String element = parser.getName();
+                    if (element == null) {
+                        break;
+                    }
+                    if (element.equals(TAG_GROUP)) {
+                        String name = parser.getAttributeValue(null, ATTR_GROUP_NAME);
+                        if (GROUP_TOUCH_SOUNDS.equals(name)) {
+                            inTouchSoundsGroup = true;
+                            break;
+                        }
+                    }
+                }
+                while (inTouchSoundsGroup) {
+                    XmlUtils.nextElement(parser);
+                    String element = parser.getName();
+                    if (element == null) {
+                        break;
+                    }
+                    if (element.equals(TAG_ASSET)) {
+                        String id = parser.getAttributeValue(null, ATTR_ASSET_ID);
+                        String file = parser.getAttributeValue(null, ATTR_ASSET_FILE);
+                        int fx;
+
+                        try {
+                            Field field = AudioManager.class.getField(id);
+                            fx = field.getInt(null);
+                        } catch (Exception e) {
+                            Log.w(TAG, "Invalid touch sound ID: "+id);
+                            continue;
+                        }
+
+                        int i = SOUND_EFFECT_FILES.indexOf(file);
+                        if (i == -1) {
+                            i = SOUND_EFFECT_FILES.size();
+                            SOUND_EFFECT_FILES.add(file);
+                        }
+                        SOUND_EFFECT_FILES_MAP[fx][0] = i;
+                    } else {
+                        break;
+                    }
+                }
+            }
+        } catch (Resources.NotFoundException e) {
+            Log.w(TAG, "audio assets file not found", e);
+        } catch (XmlPullParserException e) {
+            Log.w(TAG, "XML parser exception reading touch sound assets", e);
+        } catch (IOException e) {
+            Log.w(TAG, "I/O exception reading touch sound assets", e);
+        } finally {
+            if (parser != null) {
+                parser.close();
+            }
+        }
+    }
+
     /** @see AudioManager#playSoundEffect(int) */
     public void playSoundEffect(int effectType) {
-        sendMsg(mAudioHandler, MSG_PLAY_SOUND_EFFECT, SENDMSG_NOOP,
-                effectType, -1, null, 0);
+        playSoundEffectVolume(effectType, -1.0f);
     }
 
     /** @see AudioManager#playSoundEffect(int, float) */
     public void playSoundEffectVolume(int effectType, float volume) {
-        loadSoundEffects();
-        sendMsg(mAudioHandler, MSG_PLAY_SOUND_EFFECT, SENDMSG_NOOP,
+        sendMsg(mAudioHandler, MSG_PLAY_SOUND_EFFECT, SENDMSG_QUEUE,
                 effectType, (int) (volume * 1000), null, 0);
     }
 
@@ -1652,114 +1791,20 @@
      * This method must be called at first when sound effects are enabled
      */
     public boolean loadSoundEffects() {
-        int status;
+        int attempts = 3;
+        LoadSoundEffectReply reply = new LoadSoundEffectReply();
 
-        synchronized (mSoundEffectsLock) {
-            if (!mBootCompleted) {
-                Log.w(TAG, "loadSoundEffects() called before boot complete");
-                return false;
-            }
-
-            if (mSoundPool != null) {
-                return true;
-            }
-            mSoundPool = new SoundPool(NUM_SOUNDPOOL_CHANNELS, AudioSystem.STREAM_SYSTEM, 0);
-
-            try {
-                mSoundPoolCallBack = null;
-                mSoundPoolListenerThread = new SoundPoolListenerThread();
-                mSoundPoolListenerThread.start();
-                // Wait for mSoundPoolCallBack to be set by the other thread
-                mSoundEffectsLock.wait();
-            } catch (InterruptedException e) {
-                Log.w(TAG, "Interrupted while waiting sound pool listener thread.");
-            }
-
-            if (mSoundPoolCallBack == null) {
-                Log.w(TAG, "loadSoundEffects() could not create SoundPool listener or thread");
-                if (mSoundPoolLooper != null) {
-                    mSoundPoolLooper.quit();
-                    mSoundPoolLooper = null;
-                }
-                mSoundPoolListenerThread = null;
-                mSoundPool.release();
-                mSoundPool = null;
-                return false;
-            }
-            /*
-             * poolId table: The value -1 in this table indicates that corresponding
-             * file (same index in SOUND_EFFECT_FILES[] has not been loaded.
-             * Once loaded, the value in poolId is the sample ID and the same
-             * sample can be reused for another effect using the same file.
-             */
-            int[] poolId = new int[SOUND_EFFECT_FILES.length];
-            for (int fileIdx = 0; fileIdx < SOUND_EFFECT_FILES.length; fileIdx++) {
-                poolId[fileIdx] = -1;
-            }
-            /*
-             * Effects whose value in SOUND_EFFECT_FILES_MAP[effect][1] is -1 must be loaded.
-             * If load succeeds, value in SOUND_EFFECT_FILES_MAP[effect][1] is > 0:
-             * this indicates we have a valid sample loaded for this effect.
-             */
-
-            int lastSample = 0;
-            for (int effect = 0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
-                // Do not load sample if this effect uses the MediaPlayer
-                if (SOUND_EFFECT_FILES_MAP[effect][1] == 0) {
-                    continue;
-                }
-                if (poolId[SOUND_EFFECT_FILES_MAP[effect][0]] == -1) {
-                    String filePath = Environment.getRootDirectory()
-                            + SOUND_EFFECTS_PATH
-                            + SOUND_EFFECT_FILES[SOUND_EFFECT_FILES_MAP[effect][0]];
-                    int sampleId = mSoundPool.load(filePath, 0);
-                    if (sampleId <= 0) {
-                        Log.w(TAG, "Soundpool could not load file: "+filePath);
-                    } else {
-                        SOUND_EFFECT_FILES_MAP[effect][1] = sampleId;
-                        poolId[SOUND_EFFECT_FILES_MAP[effect][0]] = sampleId;
-                        lastSample = sampleId;
-                    }
-                } else {
-                    SOUND_EFFECT_FILES_MAP[effect][1] = poolId[SOUND_EFFECT_FILES_MAP[effect][0]];
-                }
-            }
-            // wait for all samples to be loaded
-            if (lastSample != 0) {
-                mSoundPoolCallBack.setLastSample(lastSample);
-
+        synchronized (reply) {
+            sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE, 0, 0, reply, 0);
+            while ((reply.mStatus == 1) && (attempts-- > 0)) {
                 try {
-                    mSoundEffectsLock.wait();
-                    status = mSoundPoolCallBack.status();
-                } catch (java.lang.InterruptedException e) {
-                    Log.w(TAG, "Interrupted while waiting sound pool callback.");
-                    status = -1;
+                    reply.wait(SOUND_EFECTS_LOAD_TIMEOUT_MS);
+                } catch (InterruptedException e) {
+                    Log.w(TAG, "loadSoundEffects Interrupted while waiting sound pool loaded.");
                 }
-            } else {
-                status = -1;
-            }
-
-            if (mSoundPoolLooper != null) {
-                mSoundPoolLooper.quit();
-                mSoundPoolLooper = null;
-            }
-            mSoundPoolListenerThread = null;
-            if (status != 0) {
-                Log.w(TAG,
-                        "loadSoundEffects(), Error "
-                                + ((lastSample != 0) ? mSoundPoolCallBack.status() : -1)
-                                + " while loading samples");
-                for (int effect = 0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
-                    if (SOUND_EFFECT_FILES_MAP[effect][1] > 0) {
-                        SOUND_EFFECT_FILES_MAP[effect][1] = -1;
-                    }
-                }
-
-                mSoundPool.release();
-                mSoundPool = null;
             }
         }
-        return (status == 0);
+        return (reply.mStatus == 0);
     }
 
     /**
@@ -1768,32 +1813,7 @@
      *  sound effects are disabled.
      */
     public void unloadSoundEffects() {
-        synchronized (mSoundEffectsLock) {
-            if (mSoundPool == null) {
-                return;
-            }
-
-            mAudioHandler.removeMessages(MSG_LOAD_SOUND_EFFECTS);
-            mAudioHandler.removeMessages(MSG_PLAY_SOUND_EFFECT);
-
-            int[] poolId = new int[SOUND_EFFECT_FILES.length];
-            for (int fileIdx = 0; fileIdx < SOUND_EFFECT_FILES.length; fileIdx++) {
-                poolId[fileIdx] = 0;
-            }
-
-            for (int effect = 0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
-                if (SOUND_EFFECT_FILES_MAP[effect][1] <= 0) {
-                    continue;
-                }
-                if (poolId[SOUND_EFFECT_FILES_MAP[effect][0]] == 0) {
-                    mSoundPool.unload(SOUND_EFFECT_FILES_MAP[effect][1]);
-                    SOUND_EFFECT_FILES_MAP[effect][1] = -1;
-                    poolId[SOUND_EFFECT_FILES_MAP[effect][0]] = -1;
-                }
-            }
-            mSoundPool.release();
-            mSoundPool = null;
-        }
+        sendMsg(mAudioHandler, MSG_UNLOAD_SOUND_EFFECTS, SENDMSG_QUEUE, 0, 0, null, 0);
     }
 
     class SoundPoolListenerThread extends Thread {
@@ -1821,23 +1841,30 @@
     private final class SoundPoolCallback implements
             android.media.SoundPool.OnLoadCompleteListener {
 
-        int mStatus;
-        int mLastSample;
+        int mStatus = 1; // 1 means neither error nor last sample loaded yet
+        List<Integer> mSamples = new ArrayList<Integer>();
 
         public int status() {
             return mStatus;
         }
 
-        public void setLastSample(int sample) {
-            mLastSample = sample;
+        public void setSamples(int[] samples) {
+            for (int i = 0; i < samples.length; i++) {
+                // do not wait ack for samples rejected upfront by SoundPool
+                if (samples[i] > 0) {
+                    mSamples.add(samples[i]);
+                }
+            }
         }
 
         public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
             synchronized (mSoundEffectsLock) {
-                if (status != 0) {
-                    mStatus = status;
+                int i = mSamples.indexOf(sampleId);
+                if (i >= 0) {
+                    mSamples.remove(i);
                 }
-                if (sampleId == mLastSample) {
+                if ((status != 0) || mSamples. isEmpty()) {
+                    mStatus = status;
                     mSoundEffectsLock.notify();
                 }
             }
@@ -1866,8 +1893,8 @@
                 streamState.readSettings();
 
                 // unmute stream that was muted but is not affect by mute anymore
-                if (streamState.muteCount() != 0 && !isStreamAffectedByMute(streamType) &&
-                        !isStreamMutedByRingerMode(streamType)) {
+                if (streamState.muteCount() != 0 && ((!isStreamAffectedByMute(streamType) &&
+                        !isStreamMutedByRingerMode(streamType)) || mUseFixedVolume)) {
                     int size = streamState.mDeathHandlers.size();
                     for (int i = 0; i < size; i++) {
                         streamState.mDeathHandlers.get(i).mMuteCount = 1;
@@ -1890,7 +1917,7 @@
         }
     }
 
-    /** @see AudioManager#setSpeakerphoneOn() */
+    /** @see AudioManager#setSpeakerphoneOn(boolean) */
     public void setSpeakerphoneOn(boolean on){
         if (!checkAudioSettingsPermission("setSpeakerphoneOn()")) {
             return;
@@ -1906,7 +1933,7 @@
         return (mForcedUseForComm == AudioSystem.FORCE_SPEAKER);
     }
 
-    /** @see AudioManager#setBluetoothScoOn() */
+    /** @see AudioManager#setBluetoothScoOn(boolean) */
     public void setBluetoothScoOn(boolean on){
         if (!checkAudioSettingsPermission("setBluetoothScoOn()")) {
             return;
@@ -1924,7 +1951,7 @@
         return (mForcedUseForComm == AudioSystem.FORCE_BT_SCO);
     }
 
-    /** @see AudioManager#setBluetoothA2dpOn() */
+    /** @see AudioManager#setBluetoothA2dpOn(boolean) */
     public void setBluetoothA2dpOn(boolean on) {
         synchronized (mBluetoothA2dpEnabledLock) {
             mBluetoothA2dpEnabled = on;
@@ -2748,8 +2775,12 @@
         }
 
         public synchronized void readSettings() {
-            int remainingDevices = AudioSystem.DEVICE_OUT_ALL;
-
+            // force maximum volume on all streams if fixed volume property is set
+            if (mUseFixedVolume) {
+                mIndex.put(AudioSystem.DEVICE_OUT_DEFAULT, mIndexMax);
+                mLastAudibleIndex.put(AudioSystem.DEVICE_OUT_DEFAULT, mIndexMax);
+                return;
+            }
             // do not read system stream volume from settings: this stream is always aliased
             // to another stream type and its volume is never persisted. Values in settings can
             // only be stale values
@@ -2770,6 +2801,8 @@
                 return;
             }
 
+            int remainingDevices = AudioSystem.DEVICE_OUT_ALL;
+
             for (int i = 0; remainingDevices != 0; i++) {
                 int device = (1 << i);
                 if ((device & remainingDevices) == 0) {
@@ -2887,7 +2920,7 @@
                     index = mIndexMax;
                 }
             }
-            mIndex.put(device, getValidIndex(index));
+            mIndex.put(device, index);
 
             if (oldIndex != index) {
                 if (lastAudible) {
@@ -3021,7 +3054,7 @@
         private int getValidIndex(int index) {
             if (index < 0) {
                 return 0;
-            } else if (index > mIndexMax) {
+            } else if (mUseFixedVolume || index > mIndexMax) {
                 return mIndexMax;
             }
 
@@ -3243,6 +3276,9 @@
         private void persistVolume(VolumeStreamState streamState,
                                    int persistType,
                                    int device) {
+            if (mUseFixedVolume) {
+                return;
+            }
             if ((persistType & PERSIST_CURRENT) != 0) {
                 System.putIntForUser(mContentResolver,
                           streamState.getSettingNameForDevice(false /* lastAudible */, device),
@@ -3258,11 +3294,166 @@
         }
 
         private void persistRingerMode(int ringerMode) {
+            if (mUseFixedVolume) {
+                return;
+            }
             Settings.Global.putInt(mContentResolver, Settings.Global.MODE_RINGER, ringerMode);
         }
 
-        private void playSoundEffect(int effectType, int volume) {
+        private boolean onLoadSoundEffects() {
+            int status;
+
             synchronized (mSoundEffectsLock) {
+                if (!mBootCompleted) {
+                    Log.w(TAG, "onLoadSoundEffects() called before boot complete");
+                    return false;
+                }
+
+                if (mSoundPool != null) {
+                    return true;
+                }
+
+                loadTouchSoundAssets();
+
+                mSoundPool = new SoundPool(NUM_SOUNDPOOL_CHANNELS, AudioSystem.STREAM_SYSTEM, 0);
+                mSoundPoolCallBack = null;
+                mSoundPoolListenerThread = new SoundPoolListenerThread();
+                mSoundPoolListenerThread.start();
+                int attempts = 3;
+                while ((mSoundPoolCallBack == null) && (attempts-- > 0)) {
+                    try {
+                        // Wait for mSoundPoolCallBack to be set by the other thread
+                        mSoundEffectsLock.wait(SOUND_EFECTS_LOAD_TIMEOUT_MS);
+                    } catch (InterruptedException e) {
+                        Log.w(TAG, "Interrupted while waiting sound pool listener thread.");
+                    }
+                }
+
+                if (mSoundPoolCallBack == null) {
+                    Log.w(TAG, "onLoadSoundEffects() SoundPool listener or thread creation error");
+                    if (mSoundPoolLooper != null) {
+                        mSoundPoolLooper.quit();
+                        mSoundPoolLooper = null;
+                    }
+                    mSoundPoolListenerThread = null;
+                    mSoundPool.release();
+                    mSoundPool = null;
+                    return false;
+                }
+                /*
+                 * poolId table: The value -1 in this table indicates that corresponding
+                 * file (same index in SOUND_EFFECT_FILES[] has not been loaded.
+                 * Once loaded, the value in poolId is the sample ID and the same
+                 * sample can be reused for another effect using the same file.
+                 */
+                int[] poolId = new int[SOUND_EFFECT_FILES.size()];
+                for (int fileIdx = 0; fileIdx < SOUND_EFFECT_FILES.size(); fileIdx++) {
+                    poolId[fileIdx] = -1;
+                }
+                /*
+                 * Effects whose value in SOUND_EFFECT_FILES_MAP[effect][1] is -1 must be loaded.
+                 * If load succeeds, value in SOUND_EFFECT_FILES_MAP[effect][1] is > 0:
+                 * this indicates we have a valid sample loaded for this effect.
+                 */
+
+                int numSamples = 0;
+                for (int effect = 0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
+                    // Do not load sample if this effect uses the MediaPlayer
+                    if (SOUND_EFFECT_FILES_MAP[effect][1] == 0) {
+                        continue;
+                    }
+                    if (poolId[SOUND_EFFECT_FILES_MAP[effect][0]] == -1) {
+                        String filePath = Environment.getRootDirectory()
+                                + SOUND_EFFECTS_PATH
+                                + SOUND_EFFECT_FILES.get(SOUND_EFFECT_FILES_MAP[effect][0]);
+                        int sampleId = mSoundPool.load(filePath, 0);
+                        if (sampleId <= 0) {
+                            Log.w(TAG, "Soundpool could not load file: "+filePath);
+                        } else {
+                            SOUND_EFFECT_FILES_MAP[effect][1] = sampleId;
+                            poolId[SOUND_EFFECT_FILES_MAP[effect][0]] = sampleId;
+                            numSamples++;
+                        }
+                    } else {
+                        SOUND_EFFECT_FILES_MAP[effect][1] =
+                                poolId[SOUND_EFFECT_FILES_MAP[effect][0]];
+                    }
+                }
+                // wait for all samples to be loaded
+                if (numSamples > 0) {
+                    mSoundPoolCallBack.setSamples(poolId);
+
+                    attempts = 3;
+                    status = 1;
+                    while ((status == 1) && (attempts-- > 0)) {
+                        try {
+                            mSoundEffectsLock.wait(SOUND_EFECTS_LOAD_TIMEOUT_MS);
+                            status = mSoundPoolCallBack.status();
+                        } catch (InterruptedException e) {
+                            Log.w(TAG, "Interrupted while waiting sound pool callback.");
+                        }
+                    }
+                } else {
+                    status = -1;
+                }
+
+                if (mSoundPoolLooper != null) {
+                    mSoundPoolLooper.quit();
+                    mSoundPoolLooper = null;
+                }
+                mSoundPoolListenerThread = null;
+                if (status != 0) {
+                    Log.w(TAG,
+                            "onLoadSoundEffects(), Error "+status+ " while loading samples");
+                    for (int effect = 0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
+                        if (SOUND_EFFECT_FILES_MAP[effect][1] > 0) {
+                            SOUND_EFFECT_FILES_MAP[effect][1] = -1;
+                        }
+                    }
+
+                    mSoundPool.release();
+                    mSoundPool = null;
+                }
+            }
+            return (status == 0);
+        }
+
+        /**
+         *  Unloads samples from the sound pool.
+         *  This method can be called to free some memory when
+         *  sound effects are disabled.
+         */
+        private void onUnloadSoundEffects() {
+            synchronized (mSoundEffectsLock) {
+                if (mSoundPool == null) {
+                    return;
+                }
+
+                int[] poolId = new int[SOUND_EFFECT_FILES.size()];
+                for (int fileIdx = 0; fileIdx < SOUND_EFFECT_FILES.size(); fileIdx++) {
+                    poolId[fileIdx] = 0;
+                }
+
+                for (int effect = 0; effect < AudioManager.NUM_SOUND_EFFECTS; effect++) {
+                    if (SOUND_EFFECT_FILES_MAP[effect][1] <= 0) {
+                        continue;
+                    }
+                    if (poolId[SOUND_EFFECT_FILES_MAP[effect][0]] == 0) {
+                        mSoundPool.unload(SOUND_EFFECT_FILES_MAP[effect][1]);
+                        SOUND_EFFECT_FILES_MAP[effect][1] = -1;
+                        poolId[SOUND_EFFECT_FILES_MAP[effect][0]] = -1;
+                    }
+                }
+                mSoundPool.release();
+                mSoundPool = null;
+            }
+        }
+
+        private void onPlaySoundEffect(int effectType, int volume) {
+            synchronized (mSoundEffectsLock) {
+
+                onLoadSoundEffects();
+
                 if (mSoundPool == null) {
                     return;
                 }
@@ -3275,11 +3466,13 @@
                 }
 
                 if (SOUND_EFFECT_FILES_MAP[effectType][1] > 0) {
-                    mSoundPool.play(SOUND_EFFECT_FILES_MAP[effectType][1], volFloat, volFloat, 0, 0, 1.0f);
+                    mSoundPool.play(SOUND_EFFECT_FILES_MAP[effectType][1],
+                                        volFloat, volFloat, 0, 0, 1.0f);
                 } else {
                     MediaPlayer mediaPlayer = new MediaPlayer();
                     try {
-                        String filePath = Environment.getRootDirectory() + SOUND_EFFECTS_PATH + SOUND_EFFECT_FILES[SOUND_EFFECT_FILES_MAP[effectType][0]];
+                        String filePath = Environment.getRootDirectory() + SOUND_EFFECTS_PATH +
+                                    SOUND_EFFECT_FILES.get(SOUND_EFFECT_FILES_MAP[effectType][0]);
                         mediaPlayer.setDataSource(filePath);
                         mediaPlayer.setAudioStreamType(AudioSystem.STREAM_SYSTEM);
                         mediaPlayer.prepare();
@@ -3353,6 +3546,9 @@
                     break;
 
                 case MSG_PERSIST_MASTER_VOLUME:
+                    if (mUseFixedVolume) {
+                        return;
+                    }
                     Settings.System.putFloatForUser(mContentResolver,
                                                     Settings.System.VOLUME_MASTER,
                                                     (float)msg.arg1 / (float)1000.0,
@@ -3360,6 +3556,9 @@
                     break;
 
                 case MSG_PERSIST_MASTER_VOLUME_MUTE:
+                    if (mUseFixedVolume) {
+                        return;
+                    }
                     Settings.System.putIntForUser(mContentResolver,
                                                  Settings.System.VOLUME_MASTER_MUTE,
                                                  msg.arg1,
@@ -3448,12 +3647,25 @@
                     AudioSystem.setParameters("restarting=false");
                     break;
 
+                case MSG_UNLOAD_SOUND_EFFECTS:
+                    onUnloadSoundEffects();
+                    break;
+
                 case MSG_LOAD_SOUND_EFFECTS:
-                    loadSoundEffects();
+                    //FIXME: onLoadSoundEffects() should be executed in a separate thread as it
+                    // can take several dozens of milliseconds to complete
+                    boolean loaded = onLoadSoundEffects();
+                    if (msg.obj != null) {
+                        LoadSoundEffectReply reply = (LoadSoundEffectReply)msg.obj;
+                        synchronized (reply) {
+                            reply.mStatus = loaded ? 0 : -1;
+                            reply.notify();
+                        }
+                    }
                     break;
 
                 case MSG_PLAY_SOUND_EFFECT:
-                    playSoundEffect(msg.arg1, msg.arg2);
+                    onPlaySoundEffect(msg.arg1, msg.arg2);
                     break;
 
                 case MSG_BTA2DP_DOCK_TIMEOUT:
@@ -4001,7 +4213,7 @@
                 }
             } else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
                 mBootCompleted = true;
-                sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_NOOP,
+                sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE,
                         0, 0, null, 0);
 
                 mKeyguardManager =
@@ -4041,7 +4253,7 @@
                 AudioSystem.setParameters("screen_state=on");
             } else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
                 AudioSystem.setParameters("screen_state=off");
-            } else if (action.equalsIgnoreCase(Intent.ACTION_CONFIGURATION_CHANGED)) {
+            } else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
                 handleConfigurationChanged(context);
             } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
                 // attempt to stop music playback for background user
@@ -4210,7 +4422,7 @@
      * Helper function:
      * Called synchronized on mAudioFocusLock
      * Remove a focus listener from the focus stack.
-     * @param focusListenerToRemove the focus listener
+     * @param clientToRemove the focus listener
      * @param signal if true and the listener was at the top of the focus stack, i.e. it was holding
      *   focus, notify the next item in the stack it gained focus.
      */
@@ -4316,7 +4528,7 @@
     }
 
 
-    /** @see AudioManager#requestAudioFocus(IAudioFocusDispatcher, int, int) */
+    /** @see AudioManager#requestAudioFocus(AudioManager.OnAudioFocusChangeListener, int, int)  */
     public int requestAudioFocus(int mainStreamType, int focusChangeHint, IBinder cb,
             IAudioFocusDispatcher fd, String clientId, String callingPackageName) {
         Log.i(TAG, " AudioFocus  requestAudioFocus() from " + clientId);
@@ -4389,7 +4601,7 @@
         return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
     }
 
-    /** @see AudioManager#abandonAudioFocus(IAudioFocusDispatcher) */
+    /** @see AudioManager#abandonAudioFocus(AudioManager.OnAudioFocusChangeListener)  */
     public int abandonAudioFocus(IAudioFocusDispatcher fl, String clientId) {
         Log.i(TAG, " AudioFocus  abandonAudioFocus() from " + clientId);
         try {
@@ -4727,8 +4939,8 @@
      * remote control stack if necessary.
      */
     private class RcClientDeathHandler implements IBinder.DeathRecipient {
-        private IBinder mCb; // To be notified of client's death
-        private PendingIntent mMediaIntent;
+        final private IBinder mCb; // To be notified of client's death
+        final private PendingIntent mMediaIntent;
 
         RcClientDeathHandler(IBinder cb, PendingIntent pi) {
             mCb = cb;
@@ -4793,12 +5005,12 @@
          * The target for the ACTION_MEDIA_BUTTON events.
          * Always non null.
          */
-        public PendingIntent mMediaIntent;
+        final public PendingIntent mMediaIntent;
         /**
          * The registered media button event receiver.
          * Always non null.
          */
-        public ComponentName mReceiverComponent;
+        final public ComponentName mReceiverComponent;
         public String mCallingPackageName;
         public int mCallingUid;
         /**
@@ -4962,7 +5174,7 @@
                 //  evaluated it, traversal order doesn't matter here)
                 while(stackIterator.hasNext()) {
                     RemoteControlStackEntry rcse = (RemoteControlStackEntry)stackIterator.next();
-                    if (packageName.equalsIgnoreCase(rcse.mReceiverComponent.getPackageName())) {
+                    if (packageName.equals(rcse.mMediaIntent.getCreatorPackage())) {
                         // a stack entry is from the package being removed, remove it from the stack
                         stackIterator.remove();
                         rcse.unlinkToRcClientDeath();
@@ -4975,10 +5187,14 @@
                                     null));
                 } else if (oldTop != mRCStack.peek()) {
                     // the top of the stack has changed, save it in the system settings
-                    // by posting a message to persist it
-                    mAudioHandler.sendMessage(
-                            mAudioHandler.obtainMessage(MSG_PERSIST_MEDIABUTTONRECEIVER, 0, 0,
-                                    mRCStack.peek().mReceiverComponent));
+                    // by posting a message to persist it; only do this however if it has
+                    // a concrete component name (is not a transient registration)
+                    RemoteControlStackEntry rcse = mRCStack.peek();
+                    if (rcse.mReceiverComponent != null) {
+                        mAudioHandler.sendMessage(
+                                mAudioHandler.obtainMessage(MSG_PERSIST_MEDIABUTTONRECEIVER, 0, 0,
+                                        rcse.mReceiverComponent));
+                    }
                 }
             }
         }
@@ -5125,7 +5341,7 @@
     /**
      * Update the displays and clients with the new "focused" client generation and name
      * @param newClientGeneration the new generation value matching a client update
-     * @param newClientEventReceiver the media button event receiver associated with the client.
+     * @param newMediaIntent the media button event receiver associated with the client.
      *    May be null, which implies there is no registered media button event receiver.
      * @param clearing true if the new client generation value maps to a remote control update
      *    where the display should be cleared.
diff --git a/media/java/android/media/MediaDrm.java b/media/java/android/media/MediaDrm.java
new file mode 100644
index 0000000..4561d3f
--- /dev/null
+++ b/media/java/android/media/MediaDrm.java
@@ -0,0 +1,366 @@
+/*
+ * Copyright (C) 2013 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.media;
+
+import android.media.MediaDrmException;
+import java.lang.ref.WeakReference;
+import java.util.UUID;
+import java.util.HashMap;
+import java.util.List;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.Bundle;
+import android.util.Log;
+
+/**
+ * MediaDrm class can be used in conjunction with {@link android.media.MediaCrypto}
+ * to obtain licenses for decoding encrypted media data.
+ *
+ * Crypto schemes are assigned 16 byte UUIDs,
+ * the method {@link #isCryptoSchemeSupported} can be used to query if a given
+ * scheme is supported on the device.
+ *
+ * <a name="Callbacks"></a>
+ * <h3>Callbacks</h3>
+ * <p>Applications may want to register for informational events in order
+ * to be informed of some internal state update during playback or streaming.
+ * Registration for these events is done via a call to
+ * {@link #setOnEventListener(OnInfoListener)}setOnInfoListener,
+ * In order to receive the respective callback
+ * associated with this listener, applications are required to create
+ * MediaDrm objects on a thread with its own Looper running (main UI
+ * thread by default has a Looper running).
+ *
+ * @hide -- don't expose yet
+ */
+public final class MediaDrm {
+
+    private final static String TAG = "MediaDrm";
+
+    private EventHandler mEventHandler;
+    private OnEventListener mOnEventListener;
+
+    private int mNativeContext;
+
+    /**
+     * Query if the given scheme identified by its UUID is supported on
+     * this device.
+     * @param uuid The UUID of the crypto scheme.
+     */
+    public static final boolean isCryptoSchemeSupported(UUID uuid) {
+        return isCryptoSchemeSupportedNative(getByteArrayFromUUID(uuid));
+    }
+
+    private static final byte[] getByteArrayFromUUID(UUID uuid) {
+        long msb = uuid.getMostSignificantBits();
+        long lsb = uuid.getLeastSignificantBits();
+
+        byte[] uuidBytes = new byte[16];
+        for (int i = 0; i < 8; ++i) {
+            uuidBytes[i] = (byte)(msb >>> (8 * (7 - i)));
+            uuidBytes[8 + i] = (byte)(lsb >>> (8 * (7 - i)));
+        }
+
+        return uuidBytes;
+    }
+
+    private static final native boolean isCryptoSchemeSupportedNative(byte[] uuid);
+
+    /**
+     * Instantiate a MediaDrm object using opaque, crypto scheme specific
+     * data.
+     * @param uuid The UUID of the crypto scheme.
+     */
+    public MediaDrm(UUID uuid) throws MediaDrmException {
+        Looper looper;
+        if ((looper = Looper.myLooper()) != null) {
+            mEventHandler = new EventHandler(this, looper);
+        } else if ((looper = Looper.getMainLooper()) != null) {
+            mEventHandler = new EventHandler(this, looper);
+        } else {
+            mEventHandler = null;
+        }
+
+        /* Native setup requires a weak reference to our object.
+         * It's easier to create it here than in C++.
+         */
+        native_setup(new WeakReference<MediaDrm>(this),
+                     getByteArrayFromUUID(uuid));
+    }
+
+    /**
+     * Register a callback to be invoked when an event occurs
+     *
+     * @param listener the callback that will be run
+     */
+    public void setOnEventListener(OnEventListener listener)
+    {
+        mOnEventListener = listener;
+    }
+
+    /**
+     * Interface definition for a callback to be invoked when a drm event
+     * occurs.
+     */
+    public interface OnEventListener
+    {
+        /**
+         * Called when an event occurs that requires the app to be notified
+         *
+         * @param md the MediaDrm object on which the event occurred
+         * @param sessionId the DRM session ID on which the event occurred
+         * @param event indicates the event type
+         * @param extra an secondary error code
+         * @param data optional byte array of data that may be associated with the event
+         */
+        void onEvent(MediaDrm md, byte[] sessionId, int event, int extra, byte[] data);
+    }
+
+    /* Do not change these values without updating their counterparts
+     * in include/media/mediadrm.h!
+     */
+    private static final int DRM_EVENT = 200;
+
+    private class EventHandler extends Handler
+    {
+        private MediaDrm mMediaDrm;
+
+        public EventHandler(MediaDrm md, Looper looper) {
+            super(looper);
+            mMediaDrm = md;
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            if (mMediaDrm.mNativeContext == 0) {
+                Log.w(TAG, "MediaDrm went away with unhandled events");
+                return;
+            }
+            switch(msg.what) {
+
+            case DRM_EVENT:
+                Log.i(TAG, "Drm event (" + msg.arg1 + "," + msg.arg2 + ")");
+
+                if (mOnEventListener != null) {
+                    Bundle bundle = msg.getData();
+                    byte[] sessionId = bundle.getByteArray("sessionId");
+                    byte[] data = bundle.getByteArray("data");
+                    mOnEventListener.onEvent(mMediaDrm, sessionId, msg.arg1, msg.arg2, data);
+                }
+                return;
+
+            default:
+                Log.e(TAG, "Unknown message type " + msg.what);
+                return;
+            }
+        }
+    }
+
+    /*
+     * Called from native code when an interesting event happens.  This method
+     * just uses the EventHandler system to post the event back to the main app thread.
+     * We use a weak reference to the original MediaPlayer object so that the native
+     * code is safe from the object disappearing from underneath it.  (This is
+     * the cookie passed to native_setup().)
+     */
+    private static void postEventFromNative(Object mediadrm_ref,
+                                            int what, int arg1, int arg2, Object obj)
+    {
+        MediaDrm md = (MediaDrm)((WeakReference)mediadrm_ref).get();
+        if (md == null) {
+            return;
+        }
+        if (md.mEventHandler != null) {
+            Message m = md.mEventHandler.obtainMessage(what, arg1, arg2, obj);
+            md.mEventHandler.sendMessage(m);
+        }
+    }
+
+    /**
+     *  Open a new session with the MediaDrm object.  A session ID is returned.
+     */
+    public native byte[] openSession() throws MediaDrmException;
+
+    /**
+     *  Close a session on the MediaDrm object.
+     */
+    public native void closeSession(byte[] sessionId) throws MediaDrmException;
+
+    public static final int MEDIA_DRM_LICENSE_TYPE_STREAMING = 1;
+    public static final int MEDIA_DRM_LICENSE_TYPE_OFFLINE = 2;
+
+    public final class LicenseRequest {
+        public LicenseRequest() {}
+        public byte[] data;
+        public String defaultUrl;
+    };
+
+    /**
+     * A license request/response exchange occurs between the app and a License
+     * Server to obtain the keys required to decrypt the content.  getLicenseRequest()
+     * is used to obtain an opaque license request byte array that is delivered to the
+     * license server.  The opaque license request byte array is returned in
+     * LicenseReqeust.data.  The recommended URL to deliver the license request to is
+     * returned in LicenseRequest.defaultUrl
+     *
+     * @param sessonId the session ID for the drm session
+     * @param init container-specific data, its meaning is interpreted based on the
+     * mime type provided in the mimeType parameter.  It could contain, for example,
+     * the content ID, key ID or other data obtained from the content metadata that is
+     * required in generating the license request.
+     * @param mimeType identifies the mime type of the content
+     * @param licenseType specifes if the license is for streaming or offline content
+     * @param optionalParameters are included in the license server request message to
+     * allow a client application to provide additional message parameters to the server.
+     */
+    public native LicenseRequest getLicenseRequest( byte[] sessionId, byte[] init,
+                                                    String mimeType, int licenseType,
+                                                    HashMap<String, String> optionalParameters )
+        throws MediaDrmException;
+
+    /**
+     * After a license response is received by the app, it is provided to the DRM plugin
+     * using provideLicenseResponse.
+     *
+     * @param sessionId the session ID for the DRM session
+     * @param response the byte array response from the server
+     */
+    public native void provideLicenseResponse( byte[] sessionId, byte[] response )
+        throws MediaDrmException;
+
+    /**
+     * Remove the keys associated with a license for a session
+     * @param sessionId the session ID for the DRM session
+     */
+    public native void removeLicense( byte[] sessionId ) throws MediaDrmException;
+
+    /**
+     * Request an informative description of the license for the session.  The status is
+     * in the form of {name, value} pairs.  Since DRM license policies vary by vendor,
+     * the specific status field names are determined by each DRM vendor.  Refer to your
+     * DRM provider documentation for definitions of the field names for a particular
+     * DrmEngine.
+     *
+     * @param sessionId the session ID for the DRM session
+     */
+    public native HashMap<String, String> queryLicenseStatus( byte[] sessionId )
+        throws MediaDrmException;
+
+    public final class ProvisionRequest {
+        public ProvisionRequest() {}
+        public byte[] data;
+        public String defaultUrl;
+    }
+
+    /**
+     * A provision request/response exchange occurs between the app and a provisioning
+     * server to retrieve a device certificate.  getProvisionRequest is used to obtain
+     * an opaque license request byte array that is delivered to the provisioning server.
+     * The opaque provision request byte array is returned in ProvisionRequest.data
+     * The recommended URL to deliver the license request to is returned in
+     * ProvisionRequest.defaultUrl.
+     */
+    public native ProvisionRequest getProvisionRequest() throws MediaDrmException;
+
+    /**
+     * After a provision response is received by the app, it is provided to the DRM
+     * plugin using this method.
+     *
+     * @param response the opaque provisioning response byte array to provide to the
+     * DrmEngine.
+     */
+    public native void provideProvisionResponse( byte[] response )
+        throws MediaDrmException;
+
+    /**
+     * A means of enforcing the contractual requirement for a concurrent stream limit
+     * per subscriber across devices is provided via SecureStop.  SecureStop is a means
+     * of securely monitoring the lifetime of sessions. Since playback on a device can
+     * be interrupted due to reboot, power failure, etc. a means of persisting the
+     * lifetime information on the device is needed.
+     *
+     * A signed version of the sessionID is written to persistent storage on the device
+     * when each MediaCrypto object is created. The sessionID is signed by the device
+     * private key to prevent tampering.
+     *
+     * In the normal case, playback will be completed, the session destroyed and the
+     * Secure Stops will be queried. The App queries secure stops and forwards the
+     * secure stop message to the server which verifies the signature and notifies the
+     * server side database that the session destruction has been confirmed. The persisted
+     * record on the client is only removed after positive confirmation that the server
+     * received the message using releaseSecureStops().
+     */
+    public native List<byte[]> getSecureStops() throws MediaDrmException;
+
+
+    /**
+     * Process the SecureStop server response message ssRelease.  After authenticating
+     * the message, remove the SecureStops identiied in the response.
+     *
+     * @param ssRelease the server response indicating which secure stops to release
+     */
+    public native void releaseSecureStops( byte[] ssRelease )
+        throws MediaDrmException;
+
+
+    /**
+     * Read a Drm plugin property value, given the property name string.  There are several
+     * forms of property access functions, depending on the data type returned.
+     *
+     * Standard fields names are:
+     *   vendor         String - identifies the maker of the plugin
+     *   version        String - identifies the version of the plugin
+     *   description    String - describes the plugin
+     *   deviceUniqueId byte[] - The device unique identifier is established during device
+     *                             provisioning and provides a means of uniquely identifying
+     *                             each device
+     */
+    public native String getPropertyString( String propertyName )
+        throws MediaDrmException;
+
+    public native byte[] getPropertyByteArray( String propertyName )
+        throws MediaDrmException;
+
+    /**
+     * Write a Drm plugin property value.  There are several forms of property setting
+     * functions, depending on the data type being set.
+     */
+    public native void setPropertyString( String propertyName, String value )
+        throws MediaDrmException;
+
+    public native void setPropertyByteArray( String propertyName, byte[] value )
+        throws MediaDrmException;
+
+    @Override
+    protected void finalize() {
+        native_finalize();
+    }
+
+    public native final void release();
+    private static native final void native_init();
+
+    private native final void native_setup(Object mediadrm_this, byte[] uuid)
+        throws MediaDrmException;
+
+    private native final void native_finalize();
+
+    static {
+        System.loadLibrary("media_jni");
+        native_init();
+    }
+}
diff --git a/media/java/android/media/MediaDrmException.java b/media/java/android/media/MediaDrmException.java
new file mode 100644
index 0000000..6f81f90
--- /dev/null
+++ b/media/java/android/media/MediaDrmException.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2013 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.media;
+
+/**
+ * Exception thrown if MediaDrm object could not be instantiated for
+ * whatever reason.
+ *
+ * @hide -- don't expose yet
+ */
+public final class MediaDrmException extends Exception {
+    public MediaDrmException(String detailMessage) {
+        super(detailMessage);
+    }
+}
diff --git a/media/java/android/media/MediaMuxer.java b/media/java/android/media/MediaMuxer.java
index c3cc1e6..1f5ca35 100644
--- a/media/java/android/media/MediaMuxer.java
+++ b/media/java/android/media/MediaMuxer.java
@@ -91,6 +91,8 @@
     private static native void nativeStop(int nativeObject);
     private static native int nativeAddTrack(int nativeObject, String[] keys,
             Object[] values);
+    private static native void nativeSetOrientationHint(int nativeObject,
+            int degrees);
     private static native void nativeWriteSampleData(int nativeObject,
             int trackIndex, ByteBuffer byteBuf,
             int offset, int size, long presentationTimeUs, int flags);
@@ -109,7 +111,7 @@
     private int mNativeObject;
 
     /**
-     * Constructor
+     * Constructor.
      * Creates a media muxer that writes to the specified path.
      * @param path The path of the output media file.
      * @param format The format of the output media file.
@@ -139,6 +141,31 @@
     }
 
     /**
+     * Sets the orientation hint for output video playback.
+     * <p>This method should be called before {@link #start}. Calling this
+     * method will not rotate the video frame when muxer is generating the file,
+     * but add a composition matrix containing the rotation angle in the output
+     * video if the output format is
+     * {@link OutputFormat#MUXER_OUTPUT_MPEG_4} so that a video player can
+     * choose the proper orientation for playback. Note that some video players
+     * may choose to ignore the composition matrix in a video during playback.
+     * By default, the rotation degree is 0.</p>
+     * @param degrees the angle to be rotated clockwise in degrees.
+     * The supported angles are 0, 90, 180, and 270 degrees.
+     */
+    public void setOrientationHint(int degrees) {
+        if (degrees != 0 && degrees != 90  && degrees != 180 && degrees != 270) {
+            throw new IllegalArgumentException("Unsupported angle: " + degrees);
+        }
+        if (mState == MUXER_STATE_INITIALIZED) {
+            nativeSetOrientationHint(mNativeObject, degrees);
+        } else {
+            throw new IllegalStateException("Can't set rotation degrees due" +
+                    " to wrong state.");
+        }
+    }
+
+    /**
      * Starts the muxer.
      * <p>Make sure this is called after {@link #addTrack} and before
      * {@link #writeSampleData}.</p>
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index ac8fb74..6873060 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -5,6 +5,7 @@
     android_media_MediaCrypto.cpp \
     android_media_MediaCodec.cpp \
     android_media_MediaCodecList.cpp \
+    android_media_MediaDrm.cpp \
     android_media_MediaExtractor.cpp \
     android_media_MediaMuxer.cpp \
     android_media_MediaPlayer.cpp \
diff --git a/media/jni/android_media_MediaCrypto.cpp b/media/jni/android_media_MediaCrypto.cpp
index 517a293..d0f56ea 100644
--- a/media/jni/android_media_MediaCrypto.cpp
+++ b/media/jni/android_media_MediaCrypto.cpp
@@ -74,7 +74,7 @@
 
     sp<ICrypto> crypto = service->makeCrypto();
 
-    if (crypto == NULL || crypto->initCheck() != OK) {
+    if (crypto == NULL || (crypto->initCheck() != OK && crypto->initCheck() != NO_INIT)) {
         return NULL;
     }
 
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
new file mode 100644
index 0000000..9938f76
--- /dev/null
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -0,0 +1,817 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "MediaDrm-JNI"
+#include <utils/Log.h>
+
+#include "android_media_MediaDrm.h"
+
+#include "android_runtime/AndroidRuntime.h"
+#include "jni.h"
+#include "JNIHelp.h"
+
+#include <binder/IServiceManager.h>
+#include <media/IDrm.h>
+#include <media/IMediaPlayerService.h>
+#include <media/stagefright/foundation/ADebug.h>
+
+namespace android {
+
+#define FIND_CLASS(var, className) \
+    var = env->FindClass(className); \
+    LOG_FATAL_IF(! var, "Unable to find class " className);
+
+#define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
+    var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
+    LOG_FATAL_IF(! var, "Unable to find field " fieldName);
+
+#define GET_METHOD_ID(var, clazz, fieldName, fieldDescriptor) \
+    var = env->GetMethodID(clazz, fieldName, fieldDescriptor); \
+    LOG_FATAL_IF(! var, "Unable to find method " fieldName);
+
+struct RequestFields {
+    jfieldID data;
+    jfieldID defaultUrl;
+};
+
+struct ArrayListFields {
+    jmethodID init;
+    jmethodID add;
+};
+
+struct HashmapFields {
+    jmethodID init;
+    jmethodID get;
+    jmethodID put;
+    jmethodID entrySet;
+};
+
+struct SetFields {
+    jmethodID iterator;
+};
+
+struct IteratorFields {
+    jmethodID next;
+    jmethodID hasNext;
+};
+
+struct EntryFields {
+    jmethodID getKey;
+    jmethodID getValue;
+};
+
+struct fields_t {
+    jfieldID context;
+    RequestFields licenseRequest;
+    RequestFields provisionRequest;
+    ArrayListFields arraylist;
+    HashmapFields hashmap;
+    SetFields set;
+    IteratorFields iterator;
+    EntryFields entry;
+};
+
+static fields_t gFields;
+
+static bool throwExceptionAsNecessary(
+        JNIEnv *env, status_t err, const char *msg = NULL) {
+
+    if (err == BAD_VALUE) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", msg);
+        return true;
+    } else if (err != OK) {
+        jniThrowException(env, "java/lang/IllegalStateException", msg);
+        return true;
+    }
+    return false;
+}
+
+static sp<IDrm> GetDrm(JNIEnv *env, jobject thiz) {
+    JDrm *jdrm = (JDrm *)env->GetIntField(thiz, gFields.context);
+    return jdrm ? jdrm->getDrm() : NULL;
+}
+
+JDrm::JDrm(
+        JNIEnv *env, jobject thiz, const uint8_t uuid[16]) {
+    mObject = env->NewWeakGlobalRef(thiz);
+    mDrm = MakeDrm(uuid);
+}
+
+JDrm::~JDrm() {
+    mDrm.clear();
+
+    JNIEnv *env = AndroidRuntime::getJNIEnv();
+
+    env->DeleteWeakGlobalRef(mObject);
+    mObject = NULL;
+}
+
+// static
+sp<IDrm> JDrm::MakeDrm() {
+    sp<IServiceManager> sm = defaultServiceManager();
+
+    sp<IBinder> binder =
+        sm->getService(String16("media.player"));
+
+    sp<IMediaPlayerService> service =
+        interface_cast<IMediaPlayerService>(binder);
+
+    if (service == NULL) {
+        return NULL;
+    }
+
+    sp<IDrm> drm = service->makeDrm();
+
+    if (drm == NULL || (drm->initCheck() != OK && drm->initCheck() != NO_INIT)) {
+        return NULL;
+    }
+
+    return drm;
+}
+
+// static
+sp<IDrm> JDrm::MakeDrm(const uint8_t uuid[16]) {
+    sp<IDrm> drm = MakeDrm();
+
+    if (drm == NULL) {
+        return NULL;
+    }
+
+    status_t err = drm->createPlugin(uuid);
+
+    if (err != OK) {
+        return NULL;
+    }
+
+    return drm;
+}
+
+// static
+bool JDrm::IsCryptoSchemeSupported(const uint8_t uuid[16]) {
+    sp<IDrm> drm = MakeDrm();
+
+    if (drm == NULL) {
+        return false;
+    }
+
+    return drm->isCryptoSchemeSupported(uuid);
+}
+
+status_t JDrm::initCheck() const {
+    return mDrm == NULL ? NO_INIT : OK;
+}
+
+// JNI conversion utilities
+static Vector<uint8_t> JByteArrayToVector(JNIEnv *env, jbyteArray const &byteArray) {
+    Vector<uint8_t> vector;
+    size_t length = env->GetArrayLength(byteArray);
+    vector.insertAt((size_t)0, length);
+    env->GetByteArrayRegion(byteArray, 0, length, (jbyte *)vector.editArray());
+    return vector;
+}
+
+static jbyteArray VectorToJByteArray(JNIEnv *env, Vector<uint8_t> const &vector) {
+    size_t length = vector.size();
+    jbyteArray result = env->NewByteArray(length);
+    if (result != NULL) {
+        env->SetByteArrayRegion(result, 0, length, (jbyte *)vector.array());
+    }
+    return result;
+}
+
+static String8 JStringToString8(JNIEnv *env, jstring const &jstr) {
+    jboolean isCopy;
+    String8 result;
+
+    const char *s = env->GetStringUTFChars(jstr, &isCopy);
+    if (s) {
+        result = s;
+        env->ReleaseStringUTFChars(jstr, s);
+    }
+    return result;
+}
+/*
+    import java.util.HashMap;
+    import java.util.Set;
+    import java.Map.Entry;
+    import jav.util.Iterator;
+
+    HashMap<k, v> hm;
+    Set<Entry<k, v> > s = hm.entrySet();
+    Iterator i = s.iterator();
+    Entry e = s.next();
+*/
+
+static KeyedVector<String8, String8> HashMapToKeyedVector(JNIEnv *env, jobject &hashMap) {
+    jclass clazz;
+    FIND_CLASS(clazz, "java/lang/String");
+    KeyedVector<String8, String8> keyedVector;
+
+    jobject entrySet = env->CallObjectMethod(hashMap, gFields.hashmap.entrySet);
+    if (entrySet) {
+        jobject iterator = env->CallObjectMethod(entrySet, gFields.set.iterator);
+        if (iterator) {
+            jboolean hasNext = env->CallBooleanMethod(iterator, gFields.iterator.hasNext);
+            while (hasNext) {
+                jobject entry = env->CallObjectMethod(iterator, gFields.iterator.next);
+                if (entry) {
+                    jobject obj = env->CallObjectMethod(entry, gFields.entry.getKey);
+                    if (!env->IsInstanceOf(obj, clazz)) {
+                        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+                    }
+                    jstring jkey = static_cast<jstring>(obj);
+
+                    obj = env->CallObjectMethod(entry, gFields.entry.getValue);
+                    if (!env->IsInstanceOf(obj, clazz)) {
+                        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+                    }
+                    jstring jvalue = static_cast<jstring>(obj);
+
+                    String8 key = JStringToString8(env, jkey);
+                    String8 value = JStringToString8(env, jvalue);
+                    keyedVector.add(key, value);
+
+                    env->DeleteLocalRef(jkey);
+                    env->DeleteLocalRef(jvalue);
+                    hasNext = env->CallBooleanMethod(iterator, gFields.iterator.hasNext);
+                }
+                env->DeleteLocalRef(entry);
+            }
+            env->DeleteLocalRef(iterator);
+        }
+        env->DeleteLocalRef(entrySet);
+    }
+    return keyedVector;
+}
+
+static jobject KeyedVectorToHashMap (JNIEnv *env, KeyedVector<String8, String8> const &map) {
+    jclass clazz;
+    FIND_CLASS(clazz, "java/util/HashMap");
+    jobject hashMap = env->NewObject(clazz, gFields.hashmap.init);
+    for (size_t i = 0; i < map.size(); ++i) {
+        jstring jkey = env->NewStringUTF(map.keyAt(i).string());
+        jstring jvalue = env->NewStringUTF(map.valueAt(i).string());
+        env->CallObjectMethod(hashMap, gFields.hashmap.put, jkey, jvalue);
+        env->DeleteLocalRef(jkey);
+        env->DeleteLocalRef(jvalue);
+    }
+    return hashMap;
+}
+
+static jobject ListOfVectorsToArrayListOfByteArray(JNIEnv *env,
+                                                   List<Vector<uint8_t> > list) {
+    jclass clazz;
+    FIND_CLASS(clazz, "java/util/ArrayList");
+    jobject arrayList = env->NewObject(clazz, gFields.arraylist.init);
+    List<Vector<uint8_t> >::iterator iter = list.begin();
+    while (iter != list.end()) {
+        jbyteArray byteArray = VectorToJByteArray(env, *iter);
+        env->CallBooleanMethod(arrayList, gFields.arraylist.add, byteArray);
+        env->DeleteLocalRef(byteArray);
+        iter++;
+    }
+
+    return arrayList;
+}
+
+}  // namespace android
+
+using namespace android;
+
+static sp<JDrm> setDrm(
+        JNIEnv *env, jobject thiz, const sp<JDrm> &drm) {
+    sp<JDrm> old = (JDrm *)env->GetIntField(thiz, gFields.context);
+    if (drm != NULL) {
+        drm->incStrong(thiz);
+    }
+    if (old != NULL) {
+        old->decStrong(thiz);
+    }
+    env->SetIntField(thiz, gFields.context, (int)drm.get());
+
+    return old;
+}
+
+static bool CheckSession(JNIEnv *env, const sp<IDrm> &drm, jbyteArray const &jsessionId)
+{
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return false;
+    }
+
+    if (jsessionId == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return false;
+    }
+    return true;
+}
+
+static void android_media_MediaDrm_release(JNIEnv *env, jobject thiz) {
+    setDrm(env, thiz, NULL);
+}
+
+static void android_media_MediaDrm_native_init(JNIEnv *env) {
+    jclass clazz;
+    FIND_CLASS(clazz, "android/media/MediaDrm");
+    GET_FIELD_ID(gFields.context, clazz, "mNativeContext", "I");
+
+    FIND_CLASS(clazz, "android/media/MediaDrm$LicenseRequest");
+    GET_FIELD_ID(gFields.licenseRequest.data, clazz, "data", "[B");
+    GET_FIELD_ID(gFields.licenseRequest.defaultUrl, clazz, "defaultUrl", "Ljava/lang/String;");
+
+    FIND_CLASS(clazz, "android/media/MediaDrm$ProvisionRequest");
+    GET_FIELD_ID(gFields.provisionRequest.data, clazz, "data", "[B");
+    GET_FIELD_ID(gFields.provisionRequest.defaultUrl, clazz, "defaultUrl", "Ljava/lang/String;");
+
+    FIND_CLASS(clazz, "java/util/ArrayList");
+    GET_METHOD_ID(gFields.arraylist.init, clazz, "<init>", "()V");
+    GET_METHOD_ID(gFields.arraylist.add, clazz, "add", "(Ljava/lang/Object;)Z");
+
+    FIND_CLASS(clazz, "java/util/HashMap");
+    GET_METHOD_ID(gFields.hashmap.init, clazz, "<init>", "()V");
+    GET_METHOD_ID(gFields.hashmap.get, clazz, "get", "(Ljava/lang/Object;)Ljava/lang/Object;");
+    GET_METHOD_ID(gFields.hashmap.put, clazz, "put",
+                  "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
+    GET_METHOD_ID(gFields.hashmap.entrySet, clazz, "entrySet", "()Ljava/util/Set;");
+
+    FIND_CLASS(clazz, "java/util/Set");
+    GET_METHOD_ID(gFields.set.iterator, clazz, "iterator", "()Ljava/util/Iterator;");
+
+    FIND_CLASS(clazz, "java/util/Iterator");
+    GET_METHOD_ID(gFields.iterator.next, clazz, "next", "()Ljava/lang/Object;");
+    GET_METHOD_ID(gFields.iterator.hasNext, clazz, "hasNext", "()Z");
+
+    FIND_CLASS(clazz, "java/util/Map$Entry");
+    GET_METHOD_ID(gFields.entry.getKey, clazz, "getKey", "()Ljava/lang/Object;");
+    GET_METHOD_ID(gFields.entry.getValue, clazz, "getValue", "()Ljava/lang/Object;");
+}
+
+static void android_media_MediaDrm_native_setup(
+        JNIEnv *env, jobject thiz,
+        jobject weak_this, jbyteArray uuidObj) {
+
+    if (uuidObj == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return;
+    }
+
+    Vector<uint8_t> uuid = JByteArrayToVector(env, uuidObj);
+
+    if (uuid.size() != 16) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return;
+    }
+
+    sp<JDrm> drm = new JDrm(env, thiz, uuid.array());
+
+    status_t err = drm->initCheck();
+
+    if (err != OK) {
+        jniThrowException(
+                env,
+                "android/media/MediaDrmException",
+                "Failed to instantiate drm object.");
+        return;
+    }
+
+    setDrm(env, thiz, drm);
+}
+
+static void android_media_MediaDrm_native_finalize(
+        JNIEnv *env, jobject thiz) {
+    android_media_MediaDrm_release(env, thiz);
+}
+
+static jboolean android_media_MediaDrm_isCryptoSchemeSupportedNative(
+        JNIEnv *env, jobject thiz, jbyteArray uuidObj) {
+
+    if (uuidObj == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return false;
+    }
+
+    Vector<uint8_t> uuid = JByteArrayToVector(env, uuidObj);
+
+    if (uuid.size() != 16) {
+        jniThrowException(
+                env,
+                "java/lang/IllegalArgumentException",
+                NULL);
+        return false;
+    }
+
+    return JDrm::IsCryptoSchemeSupported(uuid.array());
+}
+
+static jbyteArray android_media_MediaDrm_openSession(
+    JNIEnv *env, jobject thiz) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return NULL;
+    }
+
+    Vector<uint8_t> sessionId;
+    status_t err = drm->openSession(sessionId);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to open session")) {
+        return NULL;
+    }
+
+    return VectorToJByteArray(env, sessionId);
+}
+
+static void android_media_MediaDrm_closeSession(
+    JNIEnv *env, jobject thiz, jbyteArray jsessionId) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (!CheckSession(env, drm, jsessionId)) {
+        return;
+    }
+
+    Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
+
+    status_t err = drm->closeSession(sessionId);
+
+    throwExceptionAsNecessary(env, err, "Failed to close session");
+}
+
+static jobject android_media_MediaDrm_getLicenseRequest(
+    JNIEnv *env, jobject thiz, jbyteArray jsessionId, jbyteArray jinitData,
+    jstring jmimeType, jint jlicenseType, jobject joptParams) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (!CheckSession(env, drm, jsessionId)) {
+        return NULL;
+    }
+
+    Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
+
+    Vector<uint8_t> initData;
+    if (jinitData != NULL) {
+        initData = JByteArrayToVector(env, jinitData);
+    }
+
+    String8 mimeType;
+    if (jmimeType != NULL) {
+        mimeType = JStringToString8(env, jmimeType);
+    }
+
+    DrmPlugin::LicenseType licenseType = (DrmPlugin::LicenseType)jlicenseType;
+
+    KeyedVector<String8, String8> optParams;
+    if (joptParams != NULL) {
+        optParams = HashMapToKeyedVector(env, joptParams);
+    }
+
+    Vector<uint8_t> request;
+    String8 defaultUrl;
+
+    status_t err = drm->getLicenseRequest(sessionId, initData, mimeType,
+                                          licenseType, optParams, request, defaultUrl);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to get license request")) {
+        return NULL;
+    }
+
+    // Fill out return obj
+    jclass clazz;
+    FIND_CLASS(clazz, "android/media/MediaDrm$LicenseRequest");
+
+    jobject licenseObj = NULL;
+
+    if (clazz) {
+        licenseObj = env->AllocObject(clazz);
+        jbyteArray jrequest = VectorToJByteArray(env, request);
+        env->SetObjectField(licenseObj, gFields.licenseRequest.data, jrequest);
+
+        jstring jdefaultUrl = env->NewStringUTF(defaultUrl.string());
+        env->SetObjectField(licenseObj, gFields.licenseRequest.defaultUrl, jdefaultUrl);
+    }
+
+    return licenseObj;
+}
+
+static void android_media_MediaDrm_provideLicenseResponse(
+    JNIEnv *env, jobject thiz, jbyteArray jsessionId, jbyteArray jresponse) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (!CheckSession(env, drm, jsessionId)) {
+        return;
+    }
+
+    Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
+
+    if (jresponse == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return;
+    }
+    Vector<uint8_t> response(JByteArrayToVector(env, jresponse));
+
+    status_t err = drm->provideLicenseResponse(sessionId, response);
+
+    throwExceptionAsNecessary(env, err, "Failed to handle license response");
+}
+
+static void android_media_MediaDrm_removeLicense(
+    JNIEnv *env, jobject thiz, jbyteArray jsessionId) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (!CheckSession(env, drm, jsessionId)) {
+        return;
+    }
+
+    Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
+
+    status_t err = drm->removeLicense(sessionId);
+
+    throwExceptionAsNecessary(env, err, "Failed to remove license");
+}
+
+static jobject android_media_MediaDrm_queryLicenseStatus(
+    JNIEnv *env, jobject thiz, jbyteArray jsessionId) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (!CheckSession(env, drm, jsessionId)) {
+        return NULL;
+    }
+    Vector<uint8_t> sessionId(JByteArrayToVector(env, jsessionId));
+
+    KeyedVector<String8, String8> infoMap;
+
+    status_t err = drm->queryLicenseStatus(sessionId, infoMap);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to query license")) {
+        return NULL;
+    }
+
+    return KeyedVectorToHashMap(env, infoMap);
+}
+
+static jobject android_media_MediaDrm_getProvisionRequest(
+    JNIEnv *env, jobject thiz) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return NULL;
+    }
+
+    Vector<uint8_t> request;
+    String8 defaultUrl;
+
+    status_t err = drm->getProvisionRequest(request, defaultUrl);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to get provision request")) {
+        return NULL;
+    }
+
+    // Fill out return obj
+    jclass clazz;
+    FIND_CLASS(clazz, "android/media/MediaDrm$ProvisionRequest");
+
+    jobject provisionObj = NULL;
+
+    if (clazz) {
+        provisionObj = env->AllocObject(clazz);
+        jbyteArray jrequest = VectorToJByteArray(env, request);
+        env->SetObjectField(provisionObj, gFields.provisionRequest.data, jrequest);
+
+        jstring jdefaultUrl = env->NewStringUTF(defaultUrl.string());
+        env->SetObjectField(provisionObj, gFields.provisionRequest.defaultUrl, jdefaultUrl);
+    }
+
+    return provisionObj;
+}
+
+static void android_media_MediaDrm_provideProvisionResponse(
+    JNIEnv *env, jobject thiz, jbyteArray jresponse) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return;
+    }
+
+    if (jresponse == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return;
+    }
+
+    Vector<uint8_t> response(JByteArrayToVector(env, jresponse));
+
+    status_t err = drm->provideProvisionResponse(response);
+
+    throwExceptionAsNecessary(env, err, "Failed to handle provision response");
+}
+
+static jobject android_media_MediaDrm_getSecureStops(
+    JNIEnv *env, jobject thiz) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return NULL;
+    }
+
+    List<Vector<uint8_t> > secureStops;
+
+    status_t err = drm->getSecureStops(secureStops);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to get secure stops")) {
+        return NULL;
+    }
+
+    return ListOfVectorsToArrayListOfByteArray(env, secureStops);
+}
+
+static void android_media_MediaDrm_releaseSecureStops(
+    JNIEnv *env, jobject thiz, jbyteArray jssRelease) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return;
+    }
+
+    Vector<uint8_t> ssRelease(JByteArrayToVector(env, jssRelease));
+
+    status_t err = drm->releaseSecureStops(ssRelease);
+
+    throwExceptionAsNecessary(env, err, "Failed to release secure stops");
+}
+
+static jstring android_media_MediaDrm_getPropertyString(
+    JNIEnv *env, jobject thiz, jstring jname) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return NULL;
+    }
+
+    if (jname == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return NULL;
+    }
+
+    String8 name = JStringToString8(env, jname);
+    String8 value;
+
+    status_t err = drm->getPropertyString(name, value);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to get property")) {
+        return NULL;
+    }
+
+    return env->NewStringUTF(value.string());
+}
+
+static jbyteArray android_media_MediaDrm_getPropertyByteArray(
+    JNIEnv *env, jobject thiz, jstring jname) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return NULL;
+    }
+
+    if (jname == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return NULL;
+    }
+
+    String8 name = JStringToString8(env, jname);
+    Vector<uint8_t> value;
+
+    status_t err = drm->getPropertyByteArray(name, value);
+
+    if (throwExceptionAsNecessary(env, err, "Failed to get property")) {
+        return NULL;
+    }
+
+    return VectorToJByteArray(env, value);
+}
+
+static void android_media_MediaDrm_setPropertyString(
+    JNIEnv *env, jobject thiz, jstring jname, jstring jvalue) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return;
+    }
+
+    if (jname == NULL || jvalue == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return;
+    }
+
+    String8 name = JStringToString8(env, jname);
+    String8 value = JStringToString8(env, jvalue);
+
+    status_t err = drm->setPropertyString(name, value);
+
+    throwExceptionAsNecessary(env, err, "Failed to set property");
+}
+
+static void android_media_MediaDrm_setPropertyByteArray(
+    JNIEnv *env, jobject thiz, jstring jname, jbyteArray jvalue) {
+    sp<IDrm> drm = GetDrm(env, thiz);
+
+    if (drm == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException", NULL);
+        return;
+    }
+
+    if (jname == NULL || jvalue == NULL) {
+        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+        return;
+    }
+
+    String8 name = JStringToString8(env, jname);
+    Vector<uint8_t> value = JByteArrayToVector(env, jvalue);
+
+    status_t err = drm->setPropertyByteArray(name, value);
+
+    throwExceptionAsNecessary(env, err, "Failed to set property");
+}
+
+
+static JNINativeMethod gMethods[] = {
+    { "release", "()V", (void *)android_media_MediaDrm_release },
+    { "native_init", "()V", (void *)android_media_MediaDrm_native_init },
+
+    { "native_setup", "(Ljava/lang/Object;[B)V",
+      (void *)android_media_MediaDrm_native_setup },
+
+    { "native_finalize", "()V",
+      (void *)android_media_MediaDrm_native_finalize },
+
+    { "isCryptoSchemeSupportedNative", "([B)Z",
+      (void *)android_media_MediaDrm_isCryptoSchemeSupportedNative },
+
+    { "openSession", "()[B",
+      (void *)android_media_MediaDrm_openSession },
+
+    { "closeSession", "([B)V",
+      (void *)android_media_MediaDrm_closeSession },
+
+    { "getLicenseRequest", "([B[BLjava/lang/String;ILjava/util/HashMap;)"
+      "Landroid/media/MediaDrm$LicenseRequest;",
+      (void *)android_media_MediaDrm_getLicenseRequest },
+
+    { "provideLicenseResponse", "([B[B)V",
+      (void *)android_media_MediaDrm_provideLicenseResponse },
+
+    { "removeLicense", "([B)V",
+      (void *)android_media_MediaDrm_removeLicense },
+
+    { "queryLicenseStatus", "([B)Ljava/util/HashMap;",
+      (void *)android_media_MediaDrm_queryLicenseStatus },
+
+    { "getProvisionRequest", "()Landroid/media/MediaDrm$ProvisionRequest;",
+      (void *)android_media_MediaDrm_getProvisionRequest },
+
+    { "provideProvisionResponse", "([B)V",
+      (void *)android_media_MediaDrm_provideProvisionResponse },
+
+    { "getSecureStops", "()Ljava/util/List;",
+      (void *)android_media_MediaDrm_getSecureStops },
+
+    { "releaseSecureStops", "([B)V",
+      (void *)android_media_MediaDrm_releaseSecureStops },
+
+    { "getPropertyString", "(Ljava/lang/String;)Ljava/lang/String;",
+      (void *)android_media_MediaDrm_getPropertyString },
+
+    { "getPropertyByteArray", "(Ljava/lang/String;)[B",
+      (void *)android_media_MediaDrm_getPropertyByteArray },
+
+    { "setPropertyString", "(Ljava/lang/String;Ljava/lang/String;)V",
+      (void *)android_media_MediaDrm_setPropertyString },
+
+    { "setPropertyByteArray", "(Ljava/lang/String;[B)V",
+      (void *)android_media_MediaDrm_setPropertyByteArray },
+};
+
+int register_android_media_Drm(JNIEnv *env) {
+    return AndroidRuntime::registerNativeMethods(env,
+                "android/media/MediaDrm", gMethods, NELEM(gMethods));
+}
+
diff --git a/media/jni/android_media_MediaDrm.h b/media/jni/android_media_MediaDrm.h
new file mode 100644
index 0000000..01067c4
--- /dev/null
+++ b/media/jni/android_media_MediaDrm.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013, 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.
+ */
+
+#ifndef _ANDROID_MEDIA_DRM_H_
+#define _ANDROID_MEDIA_DRM_H_
+
+#include "jni.h"
+
+#include <media/stagefright/foundation/ABase.h>
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+
+namespace android {
+
+struct IDrm;
+
+struct JDrm : public RefBase {
+    static bool IsCryptoSchemeSupported(const uint8_t uuid[16]);
+
+    JDrm(JNIEnv *env, jobject thiz, const uint8_t uuid[16]);
+
+    status_t initCheck() const;
+
+    sp<IDrm> getDrm() { return mDrm; }
+
+protected:
+    virtual ~JDrm();
+
+private:
+    jweak mObject;
+    sp<IDrm> mDrm;
+
+    static sp<IDrm> MakeDrm();
+    static sp<IDrm> MakeDrm(const uint8_t uuid[16]);
+
+    DISALLOW_EVIL_CONSTRUCTORS(JDrm);
+};
+
+}  // namespace android
+
+#endif  // _ANDROID_MEDIA_DRM_H_
diff --git a/media/jni/android_media_MediaMuxer.cpp b/media/jni/android_media_MediaMuxer.cpp
index 30ebb00..7517e85 100644
--- a/media/jni/android_media_MediaMuxer.cpp
+++ b/media/jni/android_media_MediaMuxer.cpp
@@ -146,6 +146,24 @@
     return int(muxer.get());
 }
 
+static void android_media_MediaMuxer_setOrientationHint(
+        JNIEnv *env, jclass clazz, jint nativeObject, jint degrees) {
+    sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
+    if (muxer == NULL) {
+        jniThrowException(env, "java/lang/IllegalStateException",
+                          "Muxer was not set up correctly");
+        return;
+    }
+    status_t err = muxer->setOrientationHint(degrees);
+
+    if (err != OK) {
+        jniThrowException(env, "java/lang/IllegalStateException",
+                          "Failed to set orientation hint");
+        return;
+    }
+
+}
+
 static void android_media_MediaMuxer_start(JNIEnv *env, jclass clazz,
                                            jint nativeObject) {
     sp<MediaMuxer> muxer(reinterpret_cast<MediaMuxer *>(nativeObject));
@@ -195,6 +213,9 @@
     { "nativeAddTrack", "(I[Ljava/lang/String;[Ljava/lang/Object;)I",
         (void *)android_media_MediaMuxer_addTrack },
 
+    { "nativeSetOrientationHint", "(II)V",
+        (void *)android_media_MediaMuxer_setOrientationHint},
+
     { "nativeStart", "(I)V", (void *)android_media_MediaMuxer_start},
 
     { "nativeWriteSampleData", "(IILjava/nio/ByteBuffer;IIJI)V",
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index e9f6a1e..c5098ce 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -879,6 +879,7 @@
 }
 
 extern int register_android_media_Crypto(JNIEnv *env);
+extern int register_android_media_Drm(JNIEnv *env);
 extern int register_android_media_MediaCodec(JNIEnv *env);
 extern int register_android_media_MediaExtractor(JNIEnv *env);
 extern int register_android_media_MediaCodecList(JNIEnv *env);
@@ -979,6 +980,11 @@
         goto bail;
     }
 
+    if (register_android_media_Drm(env) < 0) {
+        ALOGE("ERROR: MediaDrm native registration failed");
+        goto bail;
+    }
+
     /* success -- return valid version number */
     result = JNI_VERSION_1_4;
 
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
index a80fc13..53eb990 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaTestUtil.java
@@ -101,7 +101,9 @@
             Log.v(TAG, e.toString());
         }
         String[] poList = memoryUsage.split("\r|\n|\r\n");
-        String memusage = poList[1].concat("\n");
+        // Skip the first two lines since there
+        // is a new media.log introudced recently.
+        String memusage = poList[2].concat("\n");
         return memusage;
     }
 
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java
index 7967ce7..e232338 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/audio/MediaAudioManagerTest.java
@@ -42,6 +42,7 @@
     private final static int WAIT_FOR_LOOPER_TO_INITIALIZE_MS = 60000;  // 60s
     private int[] ringtoneMode = {AudioManager.RINGER_MODE_NORMAL,
              AudioManager.RINGER_MODE_SILENT, AudioManager.RINGER_MODE_VIBRATE};
+    private boolean mUseFixedVolume;
 
     public MediaAudioManagerTest() {
         super("com.android.mediaframeworktest", MediaFrameworkTest.class);
@@ -65,6 +66,10 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+
+        mUseFixedVolume = getActivity().getResources().getBoolean(
+                com.android.internal.R.bool.config_useFixedVolume);
+
         synchronized(mLooperLock) {
             initializeAudioManagerWithLooper();
             try {
@@ -91,10 +96,12 @@
 
      public boolean validateSetRingTone(int i) {
          int getRingtone = mAudioManager.getRingerMode();
-         if (i != getRingtone)
-             return false;
-         else
-             return true;
+
+         if (mUseFixedVolume) {
+             return (getRingtone == AudioManager.RINGER_MODE_NORMAL);
+         } else {
+             return (getRingtone == i);
+         }
      }
 
      // Test case 1: Simple test case to validate the set ringtone mode
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
index 1c60401..be12c7f 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
@@ -328,7 +328,15 @@
             Log.v(TAG, e.toString());
         }
         String[] poList = memoryUsage.split("\r|\n|\r\n");
-        String memusage = poList[1].concat("\n");
+        // A new media.log is enabled with ro.test_harness is set.
+        // The output of "ps mediaserver" will include the
+        // media.log process in the first line. Update the parsing
+        // to only read the thrid line.
+        // Smaple ps mediaserver output:
+        // USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
+        // media     131   1     13676  4796  ffffffff 400b1bd0 S media.log
+        // media     219   131   37768  6892  ffffffff 400b236c S /system/bin/mediaserver
+        String memusage = poList[2].concat("\n");
         return memusage;
     }
 
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 54dcaaa..5a2e261 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -1445,6 +1445,7 @@
                                 Log.i("GLThread", "waiting tid=" + getId()
                                     + " mHaveEglContext: " + mHaveEglContext
                                     + " mHaveEglSurface: " + mHaveEglSurface
+                                    + " mFinishedCreatingEglSurface: " + mFinishedCreatingEglSurface
                                     + " mPaused: " + mPaused
                                     + " mHasSurface: " + mHasSurface
                                     + " mSurfaceIsBad: " + mSurfaceIsBad
@@ -1468,8 +1469,14 @@
                         if (LOG_SURFACE) {
                             Log.w("GLThread", "egl createSurface");
                         }
-                        if (!mEglHelper.createSurface()) {
+                        if (mEglHelper.createSurface()) {
                             synchronized(sGLThreadManager) {
+                                mFinishedCreatingEglSurface = true;
+                                sGLThreadManager.notifyAll();
+                            }
+                        } else {
+                            synchronized(sGLThreadManager) {
+                                mFinishedCreatingEglSurface = true;
                                 mSurfaceIsBad = true;
                                 sGLThreadManager.notifyAll();
                             }
@@ -1595,8 +1602,11 @@
                     Log.i("GLThread", "surfaceCreated tid=" + getId());
                 }
                 mHasSurface = true;
+                mFinishedCreatingEglSurface = false;
                 sGLThreadManager.notifyAll();
-                while((mWaitingForSurface) && (!mExited)) {
+                while (mWaitingForSurface
+                       && !mFinishedCreatingEglSurface
+                       && !mExited) {
                     try {
                         sGLThreadManager.wait();
                     } catch (InterruptedException e) {
@@ -1735,6 +1745,7 @@
         private boolean mWaitingForSurface;
         private boolean mHaveEglContext;
         private boolean mHaveEglSurface;
+        private boolean mFinishedCreatingEglSurface;
         private boolean mShouldReleaseEglContext;
         private int mWidth;
         private int mHeight;
diff --git a/packages/Shell/src/com/android/shell/BugreportReceiver.java b/packages/Shell/src/com/android/shell/BugreportReceiver.java
index de04909..7a659ee 100644
--- a/packages/Shell/src/com/android/shell/BugreportReceiver.java
+++ b/packages/Shell/src/com/android/shell/BugreportReceiver.java
@@ -87,6 +87,7 @@
         final Notification.Builder builder = new Notification.Builder(context);
         builder.setSmallIcon(com.android.internal.R.drawable.stat_sys_adb);
         builder.setContentTitle(context.getString(R.string.bugreport_finished_title));
+        builder.setTicker(context.getString(R.string.bugreport_finished_title));
         builder.setContentText(context.getString(R.string.bugreport_finished_text));
         builder.setContentIntent(PendingIntent.getActivity(
                 context, 0, notifIntent, PendingIntent.FLAG_CANCEL_CURRENT));
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
index b51b333..b06166d 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
@@ -41,7 +41,8 @@
             android:fadingEdge="horizontal"
             android:scrollbars="none"
             android:layout_gravity="right"
-            android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length">
+            android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length"
+            android:fitsSystemWindows="true">
 
             <LinearLayout android:id="@+id/recents_linear_layout"
                 android:layout_width="wrap_content"
diff --git a/packages/SystemUI/res/layout/status_bar_recent_panel.xml b/packages/SystemUI/res/layout/status_bar_recent_panel.xml
index 4bbe277..305aaf2 100644
--- a/packages/SystemUI/res/layout/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout/status_bar_recent_panel.xml
@@ -45,7 +45,8 @@
             android:fadingEdgeLength="@dimen/status_bar_recents_scroll_fading_edge_length"
             android:layout_gravity="bottom|start"
             android:clipToPadding="false"
-            android:clipChildren="false">
+            android:clipChildren="false"
+            android:fitsSystemWindows="true">
 
             <LinearLayout android:id="@+id/recents_linear_layout"
                 android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout/system_bar_recent_panel.xml b/packages/SystemUI/res/layout/system_bar_recent_panel.xml
index aed8a8c..3d15d9b 100644
--- a/packages/SystemUI/res/layout/system_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout/system_bar_recent_panel.xml
@@ -49,7 +49,8 @@
             android:fadingEdgeLength="20dip"
             android:layout_gravity="bottom|start"
             android:clipToPadding="false"
-            android:clipChildren="false">
+            android:clipChildren="false"
+            android:fitsSystemWindows="true">
 
             <LinearLayout android:id="@+id/recents_linear_layout"
                 android:layout_width="wrap_content"
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
index 676326a..c325937 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsActivity.java
@@ -177,6 +177,7 @@
         setContentView(R.layout.status_bar_recent_panel);
         mRecentsPanel = (RecentsPanelView) findViewById(R.id.recents_root);
         mRecentsPanel.setOnTouchListener(new TouchOutsideListener(mRecentsPanel));
+        mRecentsPanel.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
 
         final RecentTasksLoader recentTasksLoader = RecentTasksLoader.getInstance(this);
         recentTasksLoader.setRecentsPanel(mRecentsPanel, mRecentsPanel);
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 3330301..217b7fd 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -256,7 +256,7 @@
             mPerformanceHelper.drawCallback(canvas,
                     left, right, top, bottom, mScrollX, mScrollY,
                     0, 0,
-                    getLeftFadingEdgeStrength(), getRightFadingEdgeStrength());
+                    getLeftFadingEdgeStrength(), getRightFadingEdgeStrength(), mPaddingTop);
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
index 71cc1e4..f17766b 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsScrollViewPerformanceHelper.java
@@ -38,6 +38,10 @@
     private int mFadingEdgeLength;
     private boolean mIsVertical;
     private boolean mSoftwareRendered = false;
+    private Paint mBlackPaint;
+    private Paint mFadePaint;
+    private Matrix mFadeMatrix;
+    private LinearGradient mFade;
 
     public static RecentsScrollViewPerformanceHelper create(Context context,
             AttributeSet attrs, View scrollView, boolean isVertical) {
@@ -81,18 +85,19 @@
     public void drawCallback(Canvas canvas,
             int left, int right, int top, int bottom, int scrollX, int scrollY,
             float topFadingEdgeStrength, float bottomFadingEdgeStrength,
-            float leftFadingEdgeStrength, float rightFadingEdgeStrength) {
+            float leftFadingEdgeStrength, float rightFadingEdgeStrength, int mPaddingTop) {
 
         if ((mSoftwareRendered && OPTIMIZE_SW_RENDERED_RECENTS)
                 || USE_DARK_FADE_IN_HW_ACCELERATED_MODE) {
-            Paint p = new Paint();
-            Matrix matrix = new Matrix();
-            // use use a height of 1, and then wack the matrix each time we
-            // actually use it.
-            Shader fade = new LinearGradient(0, 0, 0, 1, 0xCC000000, 0, Shader.TileMode.CLAMP);
-            // PULL OUT THIS CONSTANT
-
-            p.setShader(fade);
+            if (mFadePaint == null) {
+                mFadePaint = new Paint();
+                mFadeMatrix = new Matrix();
+                // use use a height of 1, and then wack the matrix each time we
+                // actually use it.
+                mFade = new LinearGradient(0, 0, 0, 1, 0xCC000000, 0, Shader.TileMode.CLAMP);
+                // PULL OUT THIS CONSTANT
+                mFadePaint.setShader(mFade);
+            }
 
             // draw the fade effect
             boolean drawTop = false;
@@ -134,34 +139,41 @@
             }
 
             if (drawTop) {
-                matrix.setScale(1, fadeHeight * topFadeStrength);
-                matrix.postTranslate(left, top);
-                fade.setLocalMatrix(matrix);
-                canvas.drawRect(left, top, right, top + length, p);
+                mFadeMatrix.setScale(1, fadeHeight * topFadeStrength);
+                mFadeMatrix.postTranslate(left, top);
+                mFade.setLocalMatrix(mFadeMatrix);
+                canvas.drawRect(left, top, right, top + length, mFadePaint);
+
+                if (mBlackPaint == null) {
+                    // Draw under the status bar at the top
+                    mBlackPaint = new Paint();
+                    mBlackPaint.setColor(0xFF000000);
+                }
+                canvas.drawRect(left, top - mPaddingTop, right, top, mBlackPaint);
             }
 
             if (drawBottom) {
-                matrix.setScale(1, fadeHeight * bottomFadeStrength);
-                matrix.postRotate(180);
-                matrix.postTranslate(left, bottom);
-                fade.setLocalMatrix(matrix);
-                canvas.drawRect(left, bottom - length, right, bottom, p);
+                mFadeMatrix.setScale(1, fadeHeight * bottomFadeStrength);
+                mFadeMatrix.postRotate(180);
+                mFadeMatrix.postTranslate(left, bottom);
+                mFade.setLocalMatrix(mFadeMatrix);
+                canvas.drawRect(left, bottom - length, right, bottom, mFadePaint);
             }
 
             if (drawLeft) {
-                matrix.setScale(1, fadeHeight * leftFadeStrength);
-                matrix.postRotate(-90);
-                matrix.postTranslate(left, top);
-                fade.setLocalMatrix(matrix);
-                canvas.drawRect(left, top, left + length, bottom, p);
+                mFadeMatrix.setScale(1, fadeHeight * leftFadeStrength);
+                mFadeMatrix.postRotate(-90);
+                mFadeMatrix.postTranslate(left, top);
+                mFade.setLocalMatrix(mFadeMatrix);
+                canvas.drawRect(left, top, left + length, bottom, mFadePaint);
             }
 
             if (drawRight) {
-                matrix.setScale(1, fadeHeight * rightFadeStrength);
-                matrix.postRotate(90);
-                matrix.postTranslate(right, top);
-                fade.setLocalMatrix(matrix);
-                canvas.drawRect(right - length, top, right, bottom, p);
+                mFadeMatrix.setScale(1, fadeHeight * rightFadeStrength);
+                mFadeMatrix.postRotate(90);
+                mFadeMatrix.postTranslate(right, top);
+                mFade.setLocalMatrix(mFadeMatrix);
+                canvas.drawRect(right - length, top, right, bottom, mFadePaint);
             }
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index b3adbaf..403c643f 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -21,6 +21,7 @@
 import android.content.res.Configuration;
 import android.database.DataSetObserver;
 import android.graphics.Canvas;
+import android.graphics.Paint;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.util.FloatMath;
@@ -68,7 +69,7 @@
     }
 
     private int scrollPositionOfMostRecent() {
-        return mLinearLayout.getHeight() - getHeight();
+        return mLinearLayout.getHeight() - getHeight() + mPaddingTop;
     }
 
     private void addToRecycledViews(View v) {
@@ -265,7 +266,7 @@
             mPerformanceHelper.drawCallback(canvas,
                     left, right, top, bottom, mScrollX, mScrollY,
                     getTopFadingEdgeStrength(), getBottomFadingEdgeStrength(),
-                    0, 0);
+                    0, 0, mPaddingTop);
         }
     }
 
diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java
index 761eb2d..a2ac8fe 100755
--- a/policy/src/com/android/internal/policy/impl/GlobalActions.java
+++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java
@@ -102,6 +102,7 @@
     private boolean mIsWaitingForEcmExit = false;
     private boolean mHasTelephony;
     private boolean mHasVibrator;
+    private final boolean mShowSilentToggle;
 
     /**
      * @param context everything needs a context :(
@@ -132,6 +133,9 @@
                 mAirplaneModeObserver);
         Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
         mHasVibrator = vibrator != null && vibrator.hasVibrator();
+
+        mShowSilentToggle = SHOW_SILENT_TOGGLE && !mContext.getResources().getBoolean(
+                com.android.internal.R.bool.config_useFixedVolume);
     }
 
     /**
@@ -309,7 +313,7 @@
         }
 
         // last: silent mode
-        if (SHOW_SILENT_TOGGLE) {
+        if (mShowSilentToggle) {
             mItems.add(mSilentModeAction);
         }
 
@@ -390,7 +394,7 @@
         mAirplaneModeOn.updateState(mAirplaneState);
         mAdapter.notifyDataSetChanged();
         mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
-        if (SHOW_SILENT_TOGGLE) {
+        if (mShowSilentToggle) {
             IntentFilter filter = new IntentFilter(AudioManager.RINGER_MODE_CHANGED_ACTION);
             mContext.registerReceiver(mRingerModeReceiver, filter);
         }
@@ -407,7 +411,7 @@
 
     /** {@inheritDoc} */
     public void onDismiss(DialogInterface dialog) {
-        if (SHOW_SILENT_TOGGLE) {
+        if (mShowSilentToggle) {
             try {
                 mContext.unregisterReceiver(mRingerModeReceiver);
             } catch (IllegalArgumentException ie) {
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/EmergencyCarrierArea.java b/policy/src/com/android/internal/policy/impl/keyguard/EmergencyCarrierArea.java
new file mode 100644
index 0000000..cfe1ef4
--- /dev/null
+++ b/policy/src/com/android/internal/policy/impl/keyguard/EmergencyCarrierArea.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 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.policy.impl.keyguard;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import com.android.internal.R;
+
+public class EmergencyCarrierArea extends LinearLayout {
+
+    private CarrierText mCarrierText;
+    private EmergencyButton mEmergencyButton;
+
+    public EmergencyCarrierArea(Context context) {
+        super(context);
+    }
+
+    public EmergencyCarrierArea(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        mCarrierText = (CarrierText) findViewById(R.id.carrier_text);
+        mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button);
+
+        // The emergency button overlaps the carrier text, only noticeable when highlighted.
+        // So temporarily hide the carrier text while the emergency button is pressed.
+        mEmergencyButton.setOnTouchListener(new OnTouchListener(){
+            @Override
+            public boolean onTouch(View v, MotionEvent event) {
+                switch(event.getAction()) {
+                    case MotionEvent.ACTION_DOWN:
+                        mCarrierText.animate().alpha(0);
+                        break;
+                    case MotionEvent.ACTION_UP:
+                        mCarrierText.animate().alpha(1);
+                        break;
+                }
+                return false;
+            }});
+    }
+}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 78d7caa..4885407 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -35,6 +35,7 @@
 import android.content.res.Resources;
 import android.graphics.Canvas;
 import android.graphics.Rect;
+import android.media.RemoteControlClient;
 import android.os.Looper;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -55,6 +56,7 @@
 
 import com.android.internal.R;
 import com.android.internal.policy.impl.keyguard.KeyguardSecurityModel.SecurityMode;
+import com.android.internal.policy.impl.keyguard.KeyguardUpdateMonitor.DisplayClientState;
 import com.android.internal.widget.LockPatternUtils;
 
 import java.io.File;
@@ -62,9 +64,16 @@
 
 public class KeyguardHostView extends KeyguardViewBase {
     private static final String TAG = "KeyguardHostView";
+    // transport control states
+    static final int TRANSPORT_GONE = 0;
+    static final int TRANSPORT_INVISIBLE = 1;
+    static final int TRANSPORT_VISIBLE = 2;
+
+    private int mTransportState = TRANSPORT_GONE;
 
     // Use this to debug all of keyguard
     public static boolean DEBUG = KeyguardViewMediator.DEBUG;
+    public static boolean DEBUGXPORT = true; // debug music transport control
 
     // Found in KeyguardAppWidgetPickActivity.java
     static final int APPWIDGET_HOST_ID = 0x4B455947;
@@ -109,11 +118,8 @@
 
     private KeyguardMultiUserSelectorView mKeyguardMultiUserSelectorView;
 
-    /*package*/ interface TransportCallback {
-        void onListenerDetached();
-        void onListenerAttached();
-        void onPlayStateChanged();
-    }
+    protected int mPlaybackState;
+    protected int mClientGeneration;
 
     /*package*/ interface UserSwitcherCallback {
         void hideSecurityView(int duration);
@@ -141,6 +147,16 @@
         // In other words, mUserId should never change - hence it's marked final.
         mUserId = mLockPatternUtils.getCurrentUser();
 
+        DevicePolicyManager dpm =
+                (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
+        if (dpm != null) {
+            mDisabledFeatures = getDisabledFeatures(dpm);
+            mCameraDisabled = dpm.getCameraDisabled(null);
+        }
+
+        mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled();
+
+        // These need to be created with the user context...
         Context userContext = null;
         try {
             final String packageName = "system";
@@ -153,29 +169,13 @@
             userContext = context;
         }
 
-        // These need to be created with the user context...
         mAppWidgetHost = new AppWidgetHost(userContext, APPWIDGET_HOST_ID, mOnClickHandler,
                 Looper.myLooper());
+
+        cleanupAppWidgetIds();
+
         mAppWidgetManager = AppWidgetManager.getInstance(userContext);
 
-        cleanupAppWidgetIds();
-
-        mSecurityModel = new KeyguardSecurityModel(context);
-
-        mViewStateManager = new KeyguardViewStateManager(this);
-
-        DevicePolicyManager dpm =
-                (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
-        if (dpm != null) {
-            mDisabledFeatures = getDisabledFeatures(dpm);
-            mCameraDisabled = dpm.getCameraDisabled(null);
-        }
-
-        mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled();
-
-        cleanupAppWidgetIds();
-
-        mAppWidgetManager = AppWidgetManager.getInstance(mContext);
         mSecurityModel = new KeyguardSecurityModel(context);
 
         mViewStateManager = new KeyguardViewStateManager(this);
@@ -183,6 +183,9 @@
         mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(),
                 Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
 
+        // Ensure we have the current state *before* we call showAppropriateWidgetPage()
+        getInitialTransportState();
+
         if (mSafeModeEnabled) {
             Log.v(TAG, "Keyguard widgets disabled by safe mode");
         }
@@ -194,6 +197,14 @@
         }
     }
 
+    private void getInitialTransportState() {
+        DisplayClientState dcs = KeyguardUpdateMonitor.getInstance(mContext)
+                .getCachedDisplayClientState();
+        mTransportState = (dcs.clearing ? TRANSPORT_GONE :
+            (isMusicPlaying(dcs.playbackState) ? TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE));
+        mPlaybackState = dcs.playbackState;
+    }
+
     private void cleanupAppWidgetIds() {
         // Since this method may delete a widget (which we can't do until boot completed) we
         // may have to defer it until after boot complete.
@@ -249,8 +260,44 @@
                 mKeyguardMultiUserSelectorView.finalizeActiveUserView(true);
             }
         }
+        @Override
+        void onMusicClientIdChanged(
+                int clientGeneration, boolean clearing, android.app.PendingIntent intent) {
+            // Set transport state to invisible until we know music is playing (below)
+            if (DEBUGXPORT && (mClientGeneration != clientGeneration || clearing)) {
+                Log.v(TAG, (clearing ? "hide" : "show") + " transport, gen:" + clientGeneration);
+            }
+            mClientGeneration = clientGeneration;
+            mTransportState = (clearing ? TRANSPORT_GONE : TRANSPORT_INVISIBLE);
+            KeyguardHostView.this.post(mSwitchPageRunnable);
+        }
+        @Override
+        public void onMusicPlaybackStateChanged(int playbackState, long eventTime) {
+            mPlaybackState = playbackState;
+            if (DEBUGXPORT) Log.v(TAG, "music state changed: " + playbackState);
+            if (mTransportState != TRANSPORT_GONE) {
+                mTransportState = (isMusicPlaying(mPlaybackState) ?
+                        TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE);
+            }
+            KeyguardHostView.this.post(mSwitchPageRunnable);
+        }
     };
 
+    private static final boolean isMusicPlaying(int playbackState) {
+        // This should agree with the list in AudioService.isPlaystateActive()
+        switch (playbackState) {
+            case RemoteControlClient.PLAYSTATE_PLAYING:
+            case RemoteControlClient.PLAYSTATE_BUFFERING:
+            case RemoteControlClient.PLAYSTATE_FAST_FORWARDING:
+            case RemoteControlClient.PLAYSTATE_REWINDING:
+            case RemoteControlClient.PLAYSTATE_SKIPPING_BACKWARDS:
+            case RemoteControlClient.PLAYSTATE_SKIPPING_FORWARDS:
+                return true;
+            default:
+                return false;
+        }
+    }
+
     private SlidingChallengeLayout mSlidingChallengeLayout;
 
     @Override
@@ -1125,10 +1172,8 @@
     }
 
     private void addDefaultWidgets() {
-        LayoutInflater inflater = LayoutInflater.from(mContext);
-        inflater.inflate(R.layout.keyguard_transport_control_view, this, true);
-
         if (!mSafeModeEnabled && !widgetsDisabledByDpm()) {
+            LayoutInflater inflater = LayoutInflater.from(mContext);
             View addWidget = inflater.inflate(R.layout.keyguard_add_widget, this, false);
             mAppWidgetContainer.addWidget(addWidget, 0);
             View addWidgetButton = addWidget.findViewById(R.id.keyguard_add_widget_view);
@@ -1154,66 +1199,19 @@
         }
 
         enableUserSelectorIfNecessary();
-        initializeTransportControl();
     }
 
-    private boolean removeTransportFromWidgetPager() {
-        int page = getWidgetPosition(R.id.keyguard_transport_control);
-        if (page != -1) {
-            mAppWidgetContainer.removeWidget(mTransportControl);
-
-            // XXX keep view attached so we still get show/hide events from AudioManager
-            KeyguardHostView.this.addView(mTransportControl);
-            mTransportControl.setVisibility(View.GONE);
-            mViewStateManager.setTransportState(KeyguardViewStateManager.TRANSPORT_GONE);
-            return true;
+    /**
+     * Create KeyguardTransportControlView on demand.
+     * @return
+     */
+    private KeyguardTransportControlView getTransportControlView() {
+        if (mTransportControl == null) {
+            LayoutInflater inflater = LayoutInflater.from(mContext);
+            mTransportControl = (KeyguardTransportControlView)
+                    inflater.inflate(R.layout.keyguard_transport_control_view, this, false);
         }
-        return false;
-    }
-
-    private void addTransportToWidgetPager() {
-        if (getWidgetPosition(R.id.keyguard_transport_control) == -1) {
-            KeyguardHostView.this.removeView(mTransportControl);
-            // insert to left of camera if it exists, otherwise after right-most widget
-            int lastWidget = mAppWidgetContainer.getChildCount() - 1;
-            int position = 0; // handle no widget case
-            if (lastWidget >= 0) {
-                position = mAppWidgetContainer.isCameraPage(lastWidget) ?
-                        lastWidget : lastWidget + 1;
-            }
-            mAppWidgetContainer.addWidget(mTransportControl, position);
-            mTransportControl.setVisibility(View.VISIBLE);
-        }
-    }
-
-    private void initializeTransportControl() {
-        mTransportControl =
-            (KeyguardTransportControlView) findViewById(R.id.keyguard_transport_control);
-        mTransportControl.setVisibility(View.GONE);
-
-        // This code manages showing/hiding the transport control. We keep it around and only
-        // add it to the hierarchy if it needs to be present.
-        if (mTransportControl != null) {
-            mTransportControl.setKeyguardCallback(new TransportCallback() {
-                @Override
-                public void onListenerDetached() {
-                    if (removeTransportFromWidgetPager()) {
-                        mTransportControl.post(mSwitchPageRunnable);
-                    }
-                }
-
-                @Override
-                public void onListenerAttached() {
-                    // Transport will be added when playstate changes...
-                    mTransportControl.post(mSwitchPageRunnable);
-                }
-
-                @Override
-                public void onPlayStateChanged() {
-                    mTransportControl.post(mSwitchPageRunnable);
-                }
-            });
-        }
+        return mTransportControl;
     }
 
     private int getInsertPageIndex() {
@@ -1385,7 +1383,7 @@
         if (DEBUG) Log.d(TAG, "onSaveInstanceState");
         Parcelable superState = super.onSaveInstanceState();
         SavedState ss = new SavedState(superState);
-        ss.transportState = mViewStateManager.getTransportState();
+        ss.transportState = mTransportState;
         ss.appWidgetToShow = mAppWidgetToShow;
         return ss;
     }
@@ -1399,7 +1397,7 @@
         }
         SavedState ss = (SavedState) state;
         super.onRestoreInstanceState(ss.getSuperState());
-        mViewStateManager.setTransportState(ss.transportState);
+        mTransportState = (ss.transportState);
         mAppWidgetToShow = ss.appWidgetToShow;
         post(mSwitchPageRunnable);
     }
@@ -1420,19 +1418,33 @@
     }
 
     private void showAppropriateWidgetPage() {
-        int state = mViewStateManager.getTransportState();
-        boolean isMusicPlaying = mTransportControl.isMusicPlaying()
-                || state == KeyguardViewStateManager.TRANSPORT_VISIBLE;
-        if (isMusicPlaying) {
-            mViewStateManager.setTransportState(KeyguardViewStateManager.TRANSPORT_VISIBLE);
-            addTransportToWidgetPager();
-        } else if (state == KeyguardViewStateManager.TRANSPORT_VISIBLE) {
-            mViewStateManager.setTransportState(KeyguardViewStateManager.TRANSPORT_INVISIBLE);
-        }
-        int pageToShow = getAppropriateWidgetPage(isMusicPlaying);
+        int state = mTransportState;
+        ensureTransportPresentOrRemoved(state);
+        int pageToShow = getAppropriateWidgetPage(state);
         mAppWidgetContainer.setCurrentPage(pageToShow);
     }
 
+    private void ensureTransportPresentOrRemoved(int state) {
+        int page = getWidgetPosition(R.id.keyguard_transport_control);
+        if (state == TRANSPORT_INVISIBLE || state == TRANSPORT_VISIBLE) {
+            if (page == -1) {
+                if (DEBUGXPORT) Log.v(TAG, "add transport");
+                // insert to left of camera if it exists, otherwise after right-most widget
+                int lastWidget = mAppWidgetContainer.getChildCount() - 1;
+                int position = 0; // handle no widget case
+                if (lastWidget >= 0) {
+                    position = mAppWidgetContainer.isCameraPage(lastWidget) ?
+                            lastWidget : lastWidget + 1;
+                }
+                mAppWidgetContainer.addWidget(getTransportControlView(), position);
+            }
+        } else if (page != -1) {
+            if (DEBUGXPORT) Log.v(TAG, "remove transport");
+            mAppWidgetContainer.removeWidget(getTransportControlView());
+            mTransportControl = null;
+        }
+    }
+
     private CameraWidgetFrame findCameraPage() {
         for (int i = mAppWidgetContainer.getChildCount() - 1; i >= 0; i--) {
             if (mAppWidgetContainer.isCameraPage(i)) {
@@ -1446,7 +1458,7 @@
         return pageIndex >= 0 && pageIndex == getWidgetPosition(R.id.keyguard_transport_control);
     }
 
-    private int getAppropriateWidgetPage(boolean isMusicPlaying) {
+    private int getAppropriateWidgetPage(int musicTransportState) {
         // assumes at least one widget (besides camera + add)
         if (mAppWidgetToShow != AppWidgetManager.INVALID_APPWIDGET_ID) {
             final int childCount = mAppWidgetContainer.getChildCount();
@@ -1459,9 +1471,9 @@
             mAppWidgetToShow = AppWidgetManager.INVALID_APPWIDGET_ID;
         }
         // if music playing, show transport
-        if (isMusicPlaying) {
+        if (musicTransportState == TRANSPORT_VISIBLE) {
             if (DEBUG) Log.d(TAG, "Music playing, show transport");
-            return mAppWidgetContainer.getWidgetPageIndex(mTransportControl);
+            return mAppWidgetContainer.getWidgetPageIndex(getTransportControlView());
         }
 
         // else show the right-most widget (except for camera)
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
index fda47d5..9712ea8 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
@@ -74,7 +74,6 @@
     private int mCurrentPlayState;
     private AudioManager mAudioManager;
     private IRemoteControlDisplayWeak mIRCD;
-    private boolean mMusicClientPresent = true;
 
     /**
      * The metadata which should be populated into the view once we've been attached
@@ -110,12 +109,6 @@
                 break;
 
             case MSG_SET_GENERATION_ID:
-                if (msg.arg2 != 0) {
-                    // This means nobody is currently registered. Hide the view.
-                    onListenerDetached();
-                } else {
-                    onListenerAttached();
-                }
                 if (DEBUG) Log.v(TAG, "New genId = " + msg.arg1 + ", clearing = " + msg.arg2);
                 mClientGeneration = msg.arg1;
                 mClientIntent = (PendingIntent) msg.obj;
@@ -124,7 +117,6 @@
             }
         }
     };
-    private KeyguardHostView.TransportCallback mTransportCallback;
 
     /**
      * This class is required to have weak linkage to the current TransportControlView
@@ -195,26 +187,6 @@
         mIRCD = new IRemoteControlDisplayWeak(mHandler);
     }
 
-    protected void onListenerDetached() {
-        mMusicClientPresent = false;
-        if (DEBUG) Log.v(TAG, "onListenerDetached()");
-        if (mTransportCallback != null) {
-            mTransportCallback.onListenerDetached();
-        } else {
-            Log.w(TAG, "onListenerDetached: no callback");
-        }
-    }
-
-    private void onListenerAttached() {
-        mMusicClientPresent = true;
-        if (DEBUG) Log.v(TAG, "onListenerAttached()");
-        if (mTransportCallback != null) {
-            mTransportCallback.onListenerAttached();
-        } else {
-            Log.w(TAG, "onListenerAttached(): no callback");
-        }
-    }
-
     private void updateTransportControls(int transportControlFlags) {
         mTransportControlFlags = transportControlFlags;
     }
@@ -342,11 +314,6 @@
         updatePlayPauseState(mCurrentPlayState);
     }
 
-    public boolean isMusicPlaying() {
-       return mCurrentPlayState == RemoteControlClient.PLAYSTATE_PLAYING
-               || mCurrentPlayState == RemoteControlClient.PLAYSTATE_BUFFERING;
-    }
-
     private static void setVisibilityBasedOnFlag(View view, int flags, int flag) {
         if ((flags & flag) != 0) {
             view.setVisibility(View.VISIBLE);
@@ -390,7 +357,6 @@
         mBtnPlay.setImageResource(imageResId);
         mBtnPlay.setContentDescription(getResources().getString(imageDescId));
         mCurrentPlayState = state;
-        mTransportCallback.onPlayStateChanged();
     }
 
     static class SavedState extends BaseSavedState {
@@ -423,28 +389,6 @@
         };
     }
 
-    @Override
-    public Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-        SavedState ss = new SavedState(superState);
-        ss.clientPresent = mMusicClientPresent;
-        return ss;
-    }
-
-    @Override
-    public void onRestoreInstanceState(Parcelable state) {
-        if (!(state instanceof SavedState)) {
-            super.onRestoreInstanceState(state);
-            return;
-        }
-        SavedState ss = (SavedState) state;
-        super.onRestoreInstanceState(ss.getSuperState());
-        if (ss.clientPresent) {
-            if (DEBUG) Log.v(TAG, "Reattaching client because it was attached");
-            onListenerAttached();
-        }
-    }
-
     public void onClick(View v) {
         int keyCode = -1;
         if (v == mBtnPrev) {
@@ -522,8 +466,4 @@
                 return false;
         }
     }
-
-    public void setKeyguardCallback(KeyguardHostView.TransportCallback transportCallback) {
-        mTransportCallback = transportCallback;
-    }
 }
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
index c9bffbe..27d816e 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java
@@ -18,12 +18,15 @@
 
 import android.app.ActivityManagerNative;
 import android.app.IUserSwitchObserver;
+import android.app.PendingIntent;
 import android.app.admin.DevicePolicyManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.database.ContentObserver;
+import android.graphics.Bitmap;
+
 import static android.os.BatteryManager.BATTERY_STATUS_FULL;
 import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
 import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
@@ -32,7 +35,9 @@
 import static android.os.BatteryManager.EXTRA_LEVEL;
 import static android.os.BatteryManager.EXTRA_HEALTH;
 import android.media.AudioManager;
+import android.media.IRemoteControlDisplay;
 import android.os.BatteryManager;
+import android.os.Bundle;
 import android.os.Handler;
 import android.os.IRemoteCallback;
 import android.os.Message;
@@ -84,6 +89,8 @@
     private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 312;
     protected static final int MSG_BOOT_COMPLETED = 313;
     private static final int MSG_USER_SWITCH_COMPLETE = 314;
+    private static final int MSG_SET_CURRENT_CLIENT_ID = 315;
+    protected static final int MSG_SET_PLAYBACK_STATE = 316;
 
 
     private static KeyguardUpdateMonitor sInstance;
@@ -163,11 +170,66 @@
                 case MSG_BOOT_COMPLETED:
                     handleBootCompleted();
                     break;
-
+                case MSG_SET_CURRENT_CLIENT_ID:
+                    handleSetGenerationId(msg.arg1, msg.arg2 != 0, (PendingIntent) msg.obj);
+                    break;
+                case MSG_SET_PLAYBACK_STATE:
+                    handleSetPlaybackState(msg.arg1, msg.arg2, (Long) msg.obj);
+                    break;
             }
         }
     };
 
+    private AudioManager mAudioManager;
+
+    static class DisplayClientState {
+        public int clientGeneration;
+        public boolean clearing;
+        public PendingIntent intent;
+        public int playbackState;
+        public long playbackEventTime;
+    }
+
+    private DisplayClientState mDisplayClientState = new DisplayClientState();
+
+    /**
+     * This currently implements the bare minimum required to enable showing and hiding
+     * KeyguardTransportControl.  There's a lot of client state to maintain which is why
+     * KeyguardTransportControl maintains an independent connection while it's showing.
+     */
+    private final IRemoteControlDisplay.Stub mRemoteControlDisplay =
+                new IRemoteControlDisplay.Stub() {
+
+        public void setPlaybackState(int generationId, int state, long stateChangeTimeMs) {
+            Message msg = mHandler.obtainMessage(MSG_SET_PLAYBACK_STATE,
+                    generationId, state, stateChangeTimeMs);
+            mHandler.sendMessage(msg);
+        }
+
+        public void setMetadata(int generationId, Bundle metadata) {
+
+        }
+
+        public void setTransportControlFlags(int generationId, int flags) {
+
+        }
+
+        public void setArtwork(int generationId, Bitmap bitmap) {
+
+        }
+
+        public void setAllMetadata(int generationId, Bundle metadata, Bitmap bitmap) {
+
+        }
+
+        public void setCurrentClientId(int clientGeneration, PendingIntent mediaIntent,
+                boolean clearing) throws RemoteException {
+            Message msg = mHandler.obtainMessage(MSG_SET_CURRENT_CLIENT_ID,
+                        clientGeneration, (clearing ? 1 : 0), mediaIntent);
+            mHandler.sendMessage(msg);
+        }
+    };
+
     private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
 
         public void onReceive(Context context, Intent intent) {
@@ -324,6 +386,32 @@
         return sInstance;
     }
 
+
+    protected void handleSetGenerationId(int clientGeneration, boolean clearing, PendingIntent p) {
+        mDisplayClientState.clientGeneration = clientGeneration;
+        mDisplayClientState.clearing = clearing;
+        mDisplayClientState.intent = p;
+        for (int i = 0; i < mCallbacks.size(); i++) {
+            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
+            if (cb != null) {
+                cb.onMusicClientIdChanged(clientGeneration, clearing, p);
+            }
+        }
+    }
+
+    protected void handleSetPlaybackState(int generationId, int playbackState, long eventTime) {
+        if (generationId == mDisplayClientState.clientGeneration) {
+            for (int i = 0; i < mCallbacks.size(); i++) {
+                KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
+                if (cb != null) {
+                    cb.onMusicPlaybackStateChanged(playbackState, eventTime);
+                }
+            }
+        } else {
+            Log.w(TAG, "Ignoring generation id " + generationId + " because it's not current");
+        }
+    }
+
     private KeyguardUpdateMonitor(Context context) {
         mContext = context;
 
@@ -457,6 +545,8 @@
      */
     protected void handleBootCompleted() {
         mBootCompleted = true;
+        mAudioManager = new AudioManager(mContext);
+        mAudioManager.registerRemoteControlDisplay(mRemoteControlDisplay);
         for (int i = 0; i < mCallbacks.size(); i++) {
             KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
             if (cb != null) {
@@ -466,7 +556,7 @@
     }
 
     /**
-     * We need to store this state in the KeyguardUpdateMonitor since this class will not be 
+     * We need to store this state in the KeyguardUpdateMonitor since this class will not be
      * destroyed.
      */
     public boolean hasBootCompleted() {
@@ -735,6 +825,12 @@
         callback.onRefreshCarrierInfo(mTelephonyPlmn, mTelephonySpn);
         callback.onClockVisibilityChanged();
         callback.onSimStateChanged(mSimState);
+        callback.onMusicClientIdChanged(
+                mDisplayClientState.clientGeneration,
+                mDisplayClientState.clearing,
+                mDisplayClientState.intent);
+        callback.onMusicPlaybackStateChanged(mDisplayClientState.playbackState,
+                mDisplayClientState.playbackEventTime);
     }
 
     public void sendKeyguardVisibilityChanged(boolean showing) {
@@ -838,4 +934,8 @@
                 || simState == IccCardConstants.State.PUK_REQUIRED
                 || simState == IccCardConstants.State.PERM_DISABLED);
     }
+
+    public DisplayClientState getCachedDisplayClientState() {
+        return mDisplayClientState;
+    }
 }
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitorCallback.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitorCallback.java
index 2126f06..368ccb3 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitorCallback.java
@@ -15,6 +15,7 @@
  */
 package com.android.internal.policy.impl.keyguard;
 
+import android.app.PendingIntent;
 import android.app.admin.DevicePolicyManager;
 import android.media.AudioManager;
 
@@ -112,4 +113,17 @@
      * KeyguardUpdateMonitor.
      */
     void onBootCompleted() { }
+
+    /**
+     * Called when audio client attaches or detaches from AudioManager.
+     */
+    void onMusicClientIdChanged(int clientGeneration, boolean clearing, PendingIntent intent) { }
+
+    /**
+     * Called when the audio playback state changes.
+     * @param playbackState
+     * @param eventTime
+     */
+    public void onMusicPlaybackStateChanged(int playbackState, long eventTime) { }
+
 }
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
index 0a166e1..4410063 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewStateManager.java
@@ -15,7 +15,6 @@
  */
 package com.android.internal.policy.impl.keyguard;
 
-import android.appwidget.AppWidgetManager;
 import android.os.Handler;
 import android.os.Looper;
 import android.view.View;
@@ -35,13 +34,6 @@
     private static final int SCREEN_ON_RING_HINT_DELAY = 300;
     Handler mMainQueue = new Handler(Looper.myLooper());
 
-    // transport control states
-    static final int TRANSPORT_GONE = 0;
-    static final int TRANSPORT_INVISIBLE = 1;
-    static final int TRANSPORT_VISIBLE = 2;
-
-    private int mTransportState = TRANSPORT_GONE;
-
     int mLastScrollState = SlidingChallengeLayout.SCROLL_STATE_IDLE;
 
     // Paged view state
@@ -310,14 +302,6 @@
         }
     }
 
-    public void setTransportState(int state) {
-        mTransportState = state;
-    }
-
-    public int getTransportState() {
-        return mTransportState;
-    }
-
     // ChallengeLayout.OnBouncerStateChangedListener
     @Override
     public void onBouncerStateChanged(boolean bouncerActive) {
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index 0465215..23a846b 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -538,7 +538,9 @@
 }
 
 bool InputDispatcher::isAppSwitchKeyCode(int32_t keyCode) {
-    return keyCode == AKEYCODE_HOME || keyCode == AKEYCODE_ENDCALL;
+    return keyCode == AKEYCODE_HOME
+            || keyCode == AKEYCODE_ENDCALL
+            || keyCode == AKEYCODE_APP_SWITCH;
 }
 
 bool InputDispatcher::isAppSwitchKeyEventLocked(KeyEntry* keyEntry) {
diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h
index d4f932e..430721e 100644
--- a/services/input/InputDispatcher.h
+++ b/services/input/InputDispatcher.h
@@ -165,6 +165,8 @@
  * Input dispatcher configuration.
  *
  * Specifies various options that modify the behavior of the input dispatcher.
+ * The values provided here are merely defaults. The actual values will come from ViewConfiguration
+ * and are passed into the dispatcher during initialization.
  */
 struct InputDispatcherConfiguration {
     // The key repeat initial timeout.
diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java
index 6eea928..fb2828b 100644
--- a/services/java/com/android/server/AppWidgetServiceImpl.java
+++ b/services/java/com/android/server/AppWidgetServiceImpl.java
@@ -177,18 +177,20 @@
     // Manages persistent references to RemoteViewsServices from different App Widgets
     private final HashMap<FilterComparison, HashSet<Integer>> mRemoteViewsServicesAppWidgets = new HashMap<FilterComparison, HashSet<Integer>>();
 
-    Context mContext;
+    final Context mContext;
+    final IPackageManager mPm;
+    final AlarmManager mAlarmManager;
+    final ArrayList<Provider> mInstalledProviders = new ArrayList<Provider>();
+    final int mUserId;
+    final boolean mHasFeature;
+
     Locale mLocale;
-    IPackageManager mPm;
-    AlarmManager mAlarmManager;
-    ArrayList<Provider> mInstalledProviders = new ArrayList<Provider>();
     int mNextAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID + 1;
     final ArrayList<AppWidgetId> mAppWidgetIds = new ArrayList<AppWidgetId>();
-    ArrayList<Host> mHosts = new ArrayList<Host>();
+    final ArrayList<Host> mHosts = new ArrayList<Host>();
     // set of package names
-    HashSet<String> mPackagesWithBindWidgetPermission = new HashSet<String>();
+    final HashSet<String> mPackagesWithBindWidgetPermission = new HashSet<String>();
     boolean mSafeMode;
-    int mUserId;
     boolean mStateLoaded;
     int mMaxWidgetBitmapMemory;
 
@@ -204,6 +206,8 @@
         mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
         mUserId = userId;
         mSaveStateHandler = saveStateHandler;
+        mHasFeature = context.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_APP_WIDGETS);
         computeMaximumWidgetBitmapMemory();
     }
 
@@ -426,6 +430,9 @@
 
     private void ensureStateLoadedLocked() {
         if (!mStateLoaded) {
+            if (!mHasFeature) {
+                return;
+            }
             loadAppWidgetListLocked();
             loadStateLocked();
             mStateLoaded = true;
@@ -435,6 +442,9 @@
     public int allocateAppWidgetId(String packageName, int hostId) {
         int callingUid = enforceSystemOrCallingUid(packageName);
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return -1;
+            }
             ensureStateLoadedLocked();
             int appWidgetId = mNextAppWidgetId++;
 
@@ -456,6 +466,9 @@
 
     public void deleteAppWidgetId(int appWidgetId) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             ensureStateLoadedLocked();
             AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
             if (id != null) {
@@ -467,6 +480,9 @@
 
     public void deleteHost(int hostId) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             ensureStateLoadedLocked();
             int callingUid = Binder.getCallingUid();
             Host host = lookupHostLocked(callingUid, hostId);
@@ -479,6 +495,9 @@
 
     public void deleteAllHosts() {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             ensureStateLoadedLocked();
             int callingUid = Binder.getCallingUid();
             final int N = mHosts.size();
@@ -561,6 +580,9 @@
         final long ident = Binder.clearCallingIdentity();
         try {
             synchronized (mAppWidgetIds) {
+                if (!mHasFeature) {
+                    return;
+                }
                 options = cloneIfLocalBinder(options);
                 ensureStateLoadedLocked();
                 AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
@@ -622,6 +644,9 @@
 
     public boolean bindAppWidgetIdIfAllowed(
             String packageName, int appWidgetId, ComponentName provider, Bundle options) {
+        if (!mHasFeature) {
+            return false;
+        }
         try {
             mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BIND_APPWIDGET, null);
         } catch (SecurityException se) {
@@ -649,6 +674,9 @@
     }
 
     public boolean hasBindAppWidgetPermission(String packageName) {
+        if (!mHasFeature) {
+            return false;
+        }
         mContext.enforceCallingPermission(
                 android.Manifest.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS,
                 "hasBindAppWidgetPermission packageName=" + packageName);
@@ -660,6 +688,9 @@
     }
 
     public void setBindAppWidgetPermission(String packageName, boolean permission) {
+        if (!mHasFeature) {
+            return;
+        }
         mContext.enforceCallingPermission(
                 android.Manifest.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS,
                 "setBindAppWidgetPermission packageName=" + packageName);
@@ -678,6 +709,9 @@
     // Binds to a specific RemoteViewsService
     public void bindRemoteViewsService(int appWidgetId, Intent intent, IBinder connection) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             ensureStateLoadedLocked();
             AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
             if (id == null) {
@@ -735,6 +769,9 @@
     // Unbinds from a specific RemoteViewsService
     public void unbindRemoteViewsService(int appWidgetId, Intent intent) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             ensureStateLoadedLocked();
             // Unbind from the RemoteViewsService (which will trigger a callback to the bound
             // RemoteViewsAdapter)
@@ -846,6 +883,9 @@
 
     public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return null;
+            }
             ensureStateLoadedLocked();
             AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
             if (id != null && id.provider != null && !id.provider.zombie) {
@@ -858,6 +898,9 @@
     public RemoteViews getAppWidgetViews(int appWidgetId) {
         if (DBG) log("getAppWidgetViews id=" + appWidgetId);
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return null;
+            }
             ensureStateLoadedLocked();
             AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
             if (id != null) {
@@ -870,6 +913,9 @@
 
     public List<AppWidgetProviderInfo> getInstalledProviders(int categoryFilter) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return new ArrayList<AppWidgetProviderInfo>(0);
+            }
             ensureStateLoadedLocked();
             final int N = mInstalledProviders.size();
             ArrayList<AppWidgetProviderInfo> result = new ArrayList<AppWidgetProviderInfo>(N);
@@ -884,6 +930,9 @@
     }
 
     public void updateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
+        if (!mHasFeature) {
+            return;
+        }
         if (appWidgetIds == null) {
             return;
         }
@@ -929,6 +978,9 @@
 
     public void updateAppWidgetOptions(int appWidgetId, Bundle options) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             options = cloneIfLocalBinder(options);
             ensureStateLoadedLocked();
             AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
@@ -953,6 +1005,9 @@
 
     public Bundle getAppWidgetOptions(int appWidgetId) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return Bundle.EMPTY;
+            }
             ensureStateLoadedLocked();
             AppWidgetId id = lookupAppWidgetIdLocked(appWidgetId);
             if (id != null && id.options != null) {
@@ -964,6 +1019,9 @@
     }
 
     public void partiallyUpdateAppWidgetIds(int[] appWidgetIds, RemoteViews views) {
+        if (!mHasFeature) {
+            return;
+        }
         if (appWidgetIds == null) {
             return;
         }
@@ -987,6 +1045,9 @@
     }
 
     public void notifyAppWidgetViewDataChanged(int[] appWidgetIds, int viewId) {
+        if (!mHasFeature) {
+            return;
+        }
         if (appWidgetIds == null) {
             return;
         }
@@ -1005,6 +1066,9 @@
     }
 
     public void updateAppWidgetProvider(ComponentName provider, RemoteViews views) {
+        if (!mHasFeature) {
+            return;
+        }
         synchronized (mAppWidgetIds) {
             ensureStateLoadedLocked();
             Provider p = lookupProviderLocked(provider);
@@ -1147,6 +1211,9 @@
 
     public int[] startListening(IAppWidgetHost callbacks, String packageName, int hostId,
             List<RemoteViews> updatedViews) {
+        if (!mHasFeature) {
+            return new int[0];
+        }
         int callingUid = enforceCallingUid(packageName);
         synchronized (mAppWidgetIds) {
             ensureStateLoadedLocked();
@@ -1169,6 +1236,9 @@
 
     public void stopListening(int hostId) {
         synchronized (mAppWidgetIds) {
+            if (!mHasFeature) {
+                return;
+            }
             ensureStateLoadedLocked();
             Host host = lookupHostLocked(Binder.getCallingUid(), hostId);
             if (host != null) {
@@ -1558,6 +1628,9 @@
     }
 
     void saveStateLocked() {
+        if (!mHasFeature) {
+            return;
+        }
         AtomicFile file = savedStateFile();
         FileOutputStream stream;
         try {
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 328b503..2a3c87e 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -63,6 +63,7 @@
 import android.os.PowerManager;
 import android.os.Process;
 import android.os.RemoteException;
+import android.os.SELinux;
 import android.os.ServiceManager;
 import android.os.SystemClock;
 import android.os.UserHandle;
@@ -746,6 +747,9 @@
         // correct directory.
         mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup");
         mBaseStateDir.mkdirs();
+        if (!SELinux.restorecon(mBaseStateDir)) {
+            Slog.e(TAG, "SELinux restorecon failed on " + mBaseStateDir);
+        }
         mDataDir = Environment.getDownloadCacheDirectory();
 
         mPasswordHashFile = new File(mBaseStateDir, "pwhash");
@@ -2136,6 +2140,10 @@
                         ParcelFileDescriptor.MODE_CREATE |
                         ParcelFileDescriptor.MODE_TRUNCATE);
 
+                if (!SELinux.restorecon(mBackupDataName)) {
+                    Slog.e(TAG, "SELinux restorecon failed on " + mBackupDataName);
+                }
+
                 mNewState = ParcelFileDescriptor.open(mNewStateName,
                         ParcelFileDescriptor.MODE_READ_WRITE |
                         ParcelFileDescriptor.MODE_CREATE |
@@ -3931,7 +3939,7 @@
                 b.append(String.format(" %9d ", info.size));
 
                 Date stamp = new Date(info.mtime);
-                b.append(new SimpleDateFormat("MMM dd kk:mm:ss ").format(stamp));
+                b.append(new SimpleDateFormat("MMM dd HH:mm:ss ").format(stamp));
 
                 b.append(info.packageName);
                 b.append(" :: ");
@@ -4697,6 +4705,10 @@
                             ParcelFileDescriptor.MODE_CREATE |
                             ParcelFileDescriptor.MODE_TRUNCATE);
 
+                if (!SELinux.restorecon(mBackupDataName)) {
+                    Slog.e(TAG, "SElinux restorecon failed for " + mBackupDataName);
+                }
+
                 if (mTransport.getRestoreData(mBackupData) != BackupConstants.TRANSPORT_OK) {
                     // Transport-level failure, so we wind everything up and
                     // terminate the restore operation.
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 72d249a..6dcb403 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -2256,26 +2256,27 @@
         if (resetMask != 0 || resetDns) {
             LinkProperties linkProperties = mNetTrackers[netType].getLinkProperties();
             if (linkProperties != null) {
-                String iface = linkProperties.getInterfaceName();
-                if (TextUtils.isEmpty(iface) == false) {
-                    if (resetMask != 0) {
-                        if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")");
-                        NetworkUtils.resetConnections(iface, resetMask);
+                for (String iface : linkProperties.getAllInterfaceNames()) {
+                    if (TextUtils.isEmpty(iface) == false) {
+                        if (resetMask != 0) {
+                            if (DBG) log("resetConnections(" + iface + ", " + resetMask + ")");
+                            NetworkUtils.resetConnections(iface, resetMask);
 
-                        // Tell VPN the interface is down. It is a temporary
-                        // but effective fix to make VPN aware of the change.
-                        if ((resetMask & NetworkUtils.RESET_IPV4_ADDRESSES) != 0) {
-                            mVpn.interfaceStatusChanged(iface, false);
+                            // Tell VPN the interface is down. It is a temporary
+                            // but effective fix to make VPN aware of the change.
+                            if ((resetMask & NetworkUtils.RESET_IPV4_ADDRESSES) != 0) {
+                                mVpn.interfaceStatusChanged(iface, false);
+                            }
                         }
-                    }
-                    if (resetDns) {
-                        flushVmDnsCache();
-                        if (VDBG) log("resetting DNS cache for " + iface);
-                        try {
-                            mNetd.flushInterfaceDnsCache(iface);
-                        } catch (Exception e) {
-                            // never crash - catch them all
-                            if (DBG) loge("Exception resetting dns cache: " + e);
+                        if (resetDns) {
+                            flushVmDnsCache();
+                            if (VDBG) log("resetting DNS cache for " + iface);
+                            try {
+                                mNetd.flushInterfaceDnsCache(iface);
+                            } catch (Exception e) {
+                                // never crash - catch them all
+                                if (DBG) loge("Exception resetting dns cache: " + e);
+                            }
                         }
                     }
                 }
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index 18b4ec1..d3e7c24 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -41,10 +41,14 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.IPackageManager;
+import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.Signature;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.ResolveInfo;
+import android.net.Uri;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.Environment;
@@ -62,6 +66,7 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
+import android.util.AtomicFile;
 import android.util.PrintWriterPrinter;
 import android.util.Printer;
 import android.util.Slog;
@@ -88,10 +93,11 @@
  * Implementation of the device policy APIs.
  */
 public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
-    private static final String DEVICE_POLICIES_XML = "device_policies.xml";
 
     private static final String TAG = "DevicePolicyManagerService";
 
+    private static final String DEVICE_POLICIES_XML = "device_policies.xml";
+
     private static final int REQUEST_EXPIRE_PASSWORD = 5571;
 
     private static final long MS_PER_DAY = 86400 * 1000;
@@ -109,6 +115,8 @@
     IPowerManager mIPowerManager;
     IWindowManager mIWindowManager;
 
+    private DeviceOwner mDeviceOwner;
+
     public static class DevicePolicyData {
         int mActivePasswordQuality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
         int mActivePasswordLength = 0;
@@ -507,6 +515,7 @@
         filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
         filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
         filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
+        filter.addAction(Intent.ACTION_PACKAGE_ADDED);
         filter.addDataScheme("package");
         context.registerReceiverAsUser(mReceiver, UserHandle.ALL, filter, null, mHandler);
     }
@@ -545,6 +554,14 @@
         }
     }
 
+    void loadDeviceOwner() {
+        synchronized (this) {
+            if (DeviceOwner.isRegistered()) {
+                mDeviceOwner = new DeviceOwner();
+            }
+        }
+    }
+
     /**
      * Set an alarm for an upcoming event - expiration warning, expiration, or post-expiration
      * reminders.  Clears alarm if no expirations are configured.
@@ -709,7 +726,9 @@
         Intent resolveIntent = new Intent();
         resolveIntent.setComponent(adminName);
         List<ResolveInfo> infos = mContext.getPackageManager().queryBroadcastReceivers(
-                resolveIntent, PackageManager.GET_META_DATA, userHandle);
+                resolveIntent,
+                PackageManager.GET_META_DATA | PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS,
+                userHandle);
         if (infos == null || infos.size() <= 0) {
             throw new IllegalArgumentException("Unknown admin: " + adminName);
         }
@@ -994,6 +1013,7 @@
     public void systemReady() {
         synchronized (this) {
             loadSettingsLocked(getUserData(UserHandle.USER_OWNER), UserHandle.USER_OWNER);
+            loadDeviceOwner();
         }
     }
 
@@ -1052,6 +1072,7 @@
                 }
                 if (replaceIndex == -1) {
                     policy.mAdminList.add(newAdmin);
+                    enableIfNecessary(info.getPackageName(), userHandle);
                 } else {
                     policy.mAdminList.set(replaceIndex, newAdmin);
                 }
@@ -1119,6 +1140,11 @@
                 return;
             }
             if (admin.getUid() != Binder.getCallingUid()) {
+                // If trying to remove device owner, refuse when the caller is not the owner.
+                if (mDeviceOwner != null
+                        && adminReceiver.getPackageName().equals(mDeviceOwner.getPackageName())) {
+                    return;
+                }
                 mContext.enforceCallingOrSelfPermission(
                         android.Manifest.permission.BIND_DEVICE_ADMIN, null);
             }
@@ -2351,6 +2377,49 @@
         }
     }
 
+    @Override
+    public boolean setDeviceOwner(String packageName) {
+        if (packageName == null
+                || !DeviceOwner.isInstalled(packageName, mContext.getPackageManager())) {
+            throw new IllegalArgumentException("Invalid package name " + packageName
+                    + " for device owner");
+        }
+        synchronized (this) {
+            if (mDeviceOwner == null && !isDeviceProvisioned()) {
+                mDeviceOwner = new DeviceOwner(packageName);
+                mDeviceOwner.writeOwnerFile();
+                return true;
+            } else {
+                throw new IllegalStateException("Trying to set device owner to " + packageName
+                        + ", owner=" + mDeviceOwner.getPackageName()
+                        + ", device_provisioned=" + isDeviceProvisioned());
+            }
+        }
+    }
+
+    @Override
+    public boolean isDeviceOwner(String packageName) {
+        synchronized (this) {
+            return mDeviceOwner != null
+                    && mDeviceOwner.getPackageName().equals(packageName);
+        }
+    }
+
+    @Override
+    public String getDeviceOwner() {
+        synchronized (this) {
+            if (mDeviceOwner != null) {
+                return mDeviceOwner.getPackageName();
+            }
+        }
+        return null;
+    }
+
+    private boolean isDeviceProvisioned() {
+        return Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.DEVICE_PROVISIONED, 0) > 0;
+    }
+
     private void enforceCrossUserPermission(int userHandle) {
         if (userHandle < 0) {
             throw new IllegalArgumentException("Invalid userId " + userHandle);
@@ -2364,6 +2433,22 @@
         }
     }
 
+    private void enableIfNecessary(String packageName, int userId) {
+        try {
+            IPackageManager ipm = AppGlobals.getPackageManager();
+            ApplicationInfo ai = ipm.getApplicationInfo(packageName,
+                    PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS,
+                    userId);
+            if (ai.enabledSetting
+                    == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) {
+                ipm.setApplicationEnabledSetting(packageName,
+                        PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
+                        PackageManager.DONT_KILL_APP, userId);
+            }
+        } catch (RemoteException e) {
+        }
+    }
+
     @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
@@ -2399,4 +2484,92 @@
             }
         }
     }
+
+    static class DeviceOwner {
+        private static final String DEVICE_OWNER_XML = "device_owner.xml";
+        private static final String TAG_DEVICE_OWNER = "device-owner";
+        private static final String ATTR_PACKAGE = "package";
+        private String mPackageName;
+
+        DeviceOwner() {
+            readOwnerFile();
+        }
+
+        DeviceOwner(String packageName) {
+            this.mPackageName = packageName;
+        }
+
+        static boolean isRegistered() {
+            return new File(Environment.getSystemSecureDirectory(),
+                    DEVICE_OWNER_XML).exists();
+        }
+
+        String getPackageName() {
+            return mPackageName;
+        }
+
+        static boolean isInstalled(String packageName, PackageManager pm) {
+            try {
+                PackageInfo pi;
+                if ((pi = pm.getPackageInfo(packageName, 0)) != null) {
+                    if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+                        return true;
+                    }
+                }
+            } catch (NameNotFoundException nnfe) {
+                Slog.w(TAG, "Device Owner package " + packageName + " not installed.");
+            }
+            return false;
+        }
+
+        void readOwnerFile() {
+            AtomicFile file = new AtomicFile(new File(Environment.getSystemSecureDirectory(),
+                    DEVICE_OWNER_XML));
+            try {
+                FileInputStream input = file.openRead();
+                XmlPullParser parser = Xml.newPullParser();
+                parser.setInput(input, null);
+                int type;
+                while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+                        && type != XmlPullParser.START_TAG) {
+                }
+                String tag = parser.getName();
+                if (!TAG_DEVICE_OWNER.equals(tag)) {
+                    throw new XmlPullParserException(
+                            "Device Owner file does not start with device-owner tag: found " + tag);
+                }
+                mPackageName = parser.getAttributeValue(null, ATTR_PACKAGE);
+                input.close();
+            } catch (XmlPullParserException xppe) {
+                Slog.e(TAG, "Error parsing device-owner file\n" + xppe);
+            } catch (IOException ioe) {
+                Slog.e(TAG, "IO Exception when reading device-owner file\n" + ioe);
+            }
+        }
+
+        void writeOwnerFile() {
+            synchronized (this) {
+                writeOwnerFileLocked();
+            }
+        }
+
+        private void writeOwnerFileLocked() {
+            AtomicFile file = new AtomicFile(new File(Environment.getSystemSecureDirectory(),
+                    DEVICE_OWNER_XML));
+            try {
+                FileOutputStream output = file.startWrite();
+                XmlSerializer out = new FastXmlSerializer();
+                out.setOutput(output, "utf-8");
+                out.startDocument(null, true);
+                out.startTag(null, TAG_DEVICE_OWNER);
+                out.attribute(null, ATTR_PACKAGE, mPackageName);
+                out.endTag(null, TAG_DEVICE_OWNER);
+                out.endDocument();
+                out.flush();
+                file.finishWrite(output);
+            } catch (IOException ioe) {
+                Slog.e(TAG, "IO Exception when writing device-owner file\n" + ioe);
+            }
+        }
+    }
 }
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index f6c9d82..2d53023 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -23,7 +23,7 @@
 import com.android.internal.util.FastXmlSerializer;
 import com.android.internal.view.IInputContext;
 import com.android.internal.view.IInputMethod;
-import com.android.internal.view.IInputMethodCallback;
+import com.android.internal.view.IInputSessionCallback;
 import com.android.internal.view.IInputMethodClient;
 import com.android.internal.view.IInputMethodManager;
 import com.android.internal.view.IInputMethodSession;
@@ -88,6 +88,7 @@
 import android.util.Slog;
 import android.util.Xml;
 import android.view.IWindowManager;
+import android.view.InputChannel;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -164,12 +165,13 @@
     final SettingsObserver mSettingsObserver;
     final IWindowManager mIWindowManager;
     final HandlerCaller mCaller;
+    final boolean mHasFeature;
     private InputMethodFileManager mFileManager;
     private InputMethodAndSubtypeListManager mImListManager;
     private final HardKeyboardListener mHardKeyboardListener;
     private final WindowManagerService mWindowManagerService;
 
-    final InputBindResult mNoBinding = new InputBindResult(null, null, -1);
+    final InputBindResult mNoBinding = new InputBindResult(null, null, null, -1);
 
     // All known input methods.  mMethodMap also serves as the global
     // lock for this class.
@@ -201,7 +203,9 @@
     class SessionState {
         final ClientState client;
         final IInputMethod method;
-        final IInputMethodSession session;
+
+        IInputMethodSession session;
+        InputChannel channel;
 
         @Override
         public String toString() {
@@ -210,18 +214,20 @@
                             System.identityHashCode(method))
                     + " session " + Integer.toHexString(
                             System.identityHashCode(session))
+                    + " channel " + channel
                     + "}";
         }
 
         SessionState(ClientState _client, IInputMethod _method,
-                IInputMethodSession _session) {
+                IInputMethodSession _session, InputChannel _channel) {
             client = _client;
             method = _method;
             session = _session;
+            channel = _channel;
         }
     }
 
-    class ClientState {
+    static final class ClientState {
         final IInputMethodClient client;
         final IInputContext inputContext;
         final int uid;
@@ -554,22 +560,21 @@
         }
     }
 
-    private static class MethodCallback extends IInputMethodCallback.Stub {
-        private final IInputMethod mMethod;
+    private static final class MethodCallback extends IInputSessionCallback.Stub {
         private final InputMethodManagerService mParentIMMS;
+        private final IInputMethod mMethod;
+        private final InputChannel mChannel;
 
-        MethodCallback(final IInputMethod method, final InputMethodManagerService imms) {
-            mMethod = method;
+        MethodCallback(InputMethodManagerService imms, IInputMethod method,
+                InputChannel channel) {
             mParentIMMS = imms;
+            mMethod = method;
+            mChannel = channel;
         }
 
         @Override
-        public void finishedEvent(int seq, boolean handled) throws RemoteException {
-        }
-
-        @Override
-        public void sessionCreated(IInputMethodSession session) throws RemoteException {
-            mParentIMMS.onSessionCreated(mMethod, session);
+        public void sessionCreated(IInputMethodSession session) {
+            mParentIMMS.onSessionCreated(mMethod, session, mChannel);
         }
     }
 
@@ -612,6 +617,8 @@
         }, true /*asyncHandler*/);
         mWindowManagerService = windowManager;
         mHardKeyboardListener = new HardKeyboardListener();
+        mHasFeature = context.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_INPUT_METHODS);
 
         mImeSwitcherNotification = new Notification();
         mImeSwitcherNotification.icon = com.android.internal.R.drawable.ic_notification_ime_default;
@@ -985,7 +992,10 @@
             return;
         }
         synchronized (mMethodMap) {
-            mClients.remove(client.asBinder());
+            ClientState cs = mClients.remove(client.asBinder());
+            if (cs != null) {
+                clearClientSessionLocked(cs);
+            }
         }
     }
 
@@ -1060,7 +1070,7 @@
             if (DEBUG) Slog.v(TAG, "Attach new input asks to show input");
             showCurrentInputLocked(getAppShowFlags(), null);
         }
-        return new InputBindResult(session.session, mCurId, mCurSeq);
+        return new InputBindResult(session.session, session.channel, mCurId, mCurSeq);
     }
 
     InputBindResult startInputLocked(IInputMethodClient client,
@@ -1138,16 +1148,10 @@
             }
             if (mHaveConnection) {
                 if (mCurMethod != null) {
-                    if (!cs.sessionRequested) {
-                        cs.sessionRequested = true;
-                        if (DEBUG) Slog.v(TAG, "Creating new session for client " + cs);
-                        executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
-                                MSG_CREATE_SESSION, mCurMethod,
-                                new MethodCallback(mCurMethod, this)));
-                    }
                     // Return to client, and we will get back with it when
                     // we have had a session made for it.
-                    return new InputBindResult(null, mCurId, mCurSeq);
+                    requestClientSessionLocked(cs);
+                    return new InputBindResult(null, null, mCurId, mCurSeq);
                 } else if (SystemClock.uptimeMillis()
                         < (mLastBindTime+TIME_TO_RECONNECT)) {
                     // In this case we have connected to the service, but
@@ -1157,7 +1161,7 @@
                     // we can report back.  If it has been too long, we want
                     // to fall through so we can try a disconnect/reconnect
                     // to see if we can get back in touch with the service.
-                    return new InputBindResult(null, mCurId, mCurSeq);
+                    return new InputBindResult(null, null, mCurId, mCurSeq);
                 } else {
                     EventLog.writeEvent(EventLogTags.IMF_FORCE_RECONNECT_IME,
                             mCurMethodId, SystemClock.uptimeMillis()-mLastBindTime, 0);
@@ -1176,7 +1180,7 @@
         if (!mSystemReady) {
             // If the system is not yet ready, we shouldn't be running third
             // party code.
-            return new InputBindResult(null, mCurMethodId, mCurSeq);
+            return new InputBindResult(null, null, mCurMethodId, mCurSeq);
         }
 
         InputMethodInfo info = mMethodMap.get(mCurMethodId);
@@ -1204,7 +1208,7 @@
                         WindowManager.LayoutParams.TYPE_INPUT_METHOD);
             } catch (RemoteException e) {
             }
-            return new InputBindResult(null, mCurId, mCurSeq);
+            return new InputBindResult(null, null, mCurId, mCurSeq);
         } else {
             mCurIntent = null;
             Slog.w(TAG, "Failure connecting to input method service: "
@@ -1247,32 +1251,34 @@
                 executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
                         MSG_ATTACH_TOKEN, mCurMethod, mCurToken));
                 if (mCurClient != null) {
-                    if (DEBUG) Slog.v(TAG, "Creating first session while with client "
-                            + mCurClient);
-                    executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
-                            MSG_CREATE_SESSION, mCurMethod,
-                            new MethodCallback(mCurMethod, this)));
+                    clearClientSessionLocked(mCurClient);
+                    requestClientSessionLocked(mCurClient);
                 }
             }
         }
     }
 
-    void onSessionCreated(IInputMethod method, IInputMethodSession session) {
+    void onSessionCreated(IInputMethod method, IInputMethodSession session,
+            InputChannel channel) {
         synchronized (mMethodMap) {
             if (mCurMethod != null && method != null
                     && mCurMethod.asBinder() == method.asBinder()) {
                 if (mCurClient != null) {
+                    clearClientSessionLocked(mCurClient);
                     mCurClient.curSession = new SessionState(mCurClient,
-                            method, session);
-                    mCurClient.sessionRequested = false;
+                            method, session, channel);
                     InputBindResult res = attachNewInputLocked(true);
                     if (res.method != null) {
                         executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO(
                                 MSG_BIND_METHOD, mCurClient.client, res));
                     }
+                    return;
                 }
             }
         }
+
+        // Session abandoned.  Close its associated input channel.
+        channel.dispose();
     }
 
     void unbindCurrentMethodLocked(boolean reportToClient, boolean savePosition) {
@@ -1307,14 +1313,38 @@
                     MSG_UNBIND_METHOD, mCurSeq, mCurClient.client));
         }
     }
-    
-    private void finishSession(SessionState sessionState) {
-        if (sessionState != null && sessionState.session != null) {
-            try {
-                sessionState.session.finishSession();
-            } catch (RemoteException e) {
-                Slog.w(TAG, "Session failed to close due to remote exception", e);
-                setImeWindowVisibilityStatusHiddenLocked();
+
+    void requestClientSessionLocked(ClientState cs) {
+        if (!cs.sessionRequested) {
+            if (DEBUG) Slog.v(TAG, "Creating new session for client " + cs);
+            InputChannel[] channels = InputChannel.openInputChannelPair(cs.toString());
+            cs.sessionRequested = true;
+            executeOrSendMessage(mCurMethod, mCaller.obtainMessageOOO(
+                    MSG_CREATE_SESSION, mCurMethod, channels[1],
+                    new MethodCallback(this, mCurMethod, channels[0])));
+        }
+    }
+
+    void clearClientSessionLocked(ClientState cs) {
+        finishSessionLocked(cs.curSession);
+        cs.curSession = null;
+        cs.sessionRequested = false;
+    }
+
+    private void finishSessionLocked(SessionState sessionState) {
+        if (sessionState != null) {
+            if (sessionState.session != null) {
+                try {
+                    sessionState.session.finishSession();
+                } catch (RemoteException e) {
+                    Slog.w(TAG, "Session failed to close due to remote exception", e);
+                    setImeWindowVisibilityStatusHiddenLocked();
+                }
+                sessionState.session = null;
+            }
+            if (sessionState.channel != null) {
+                sessionState.channel.dispose();
+                sessionState.channel = null;
             }
         }
     }
@@ -1322,12 +1352,10 @@
     void clearCurMethodLocked() {
         if (mCurMethod != null) {
             for (ClientState cs : mClients.values()) {
-                cs.sessionRequested = false;
-                finishSession(cs.curSession);
-                cs.curSession = null;
+                clearClientSessionLocked(cs);
             }
 
-            finishSession(mEnabledSession);
+            finishSessionLocked(mEnabledSession);
             mEnabledSession = null;
             mCurMethod = null;
         }
@@ -2326,15 +2354,21 @@
                 }
                 args.recycle();
                 return true;
-            case MSG_CREATE_SESSION:
+            case MSG_CREATE_SESSION: {
                 args = (SomeArgs)msg.obj;
+                InputChannel channel = (InputChannel)args.arg2;
                 try {
-                    ((IInputMethod)args.arg1).createSession(
-                            (IInputMethodCallback)args.arg2);
+                    ((IInputMethod)args.arg1).createSession(channel,
+                            (IInputSessionCallback)args.arg3);
                 } catch (RemoteException e) {
+                } finally {
+                    if (channel != null) {
+                        channel.dispose();
+                    }
                 }
                 args.recycle();
                 return true;
+            }
             // ---------------------------------------------------------
 
             case MSG_START_INPUT:
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 2e0c977..e8d7882 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -596,6 +596,26 @@
         }
     };
 
+    private final BroadcastReceiver mIdleMaintenanceReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            waitForReady();
+            String action = intent.getAction();
+            // Since fstrim will be run on a daily basis we do not expect
+            // fstrim to be too long, so it is not interruptible. We will
+            // implement interruption only in case we see issues.
+            if (Intent.ACTION_IDLE_MAINTENANCE_START.equals(action)) {
+                try {
+                    // This method runs on the handler thread,
+                    // so it is safe to directly call into vold.
+                    mConnector.execute("fstrim", "dotrim");
+                } catch (NativeDaemonConnectorException ndce) {
+                    Slog.e(TAG, "Failed to run fstrim!");
+                }
+            }
+        }
+    };
+
     private final class MountServiceBinderListener implements IBinder.DeathRecipient {
         final IMountServiceListener mListener;
 
@@ -1301,6 +1321,12 @@
                     mUsbReceiver, new IntentFilter(UsbManager.ACTION_USB_STATE), null, mHandler);
         }
 
+        // Watch for idle maintenance changes
+        IntentFilter idleMaintenanceFilter = new IntentFilter();
+        idleMaintenanceFilter.addAction(Intent.ACTION_IDLE_MAINTENANCE_START);
+        mContext.registerReceiverAsUser(mIdleMaintenanceReceiver, UserHandle.ALL,
+                idleMaintenanceFilter, null, mHandler);
+
         // Add OBB Action Handler to MountService thread.
         mObbActionHandler = new ObbActionHandler(mHandlerThread.getLooper());
 
@@ -1577,7 +1603,7 @@
             boolean mounted = false;
             try {
                 mounted = Environment.MEDIA_MOUNTED.equals(getVolumeState(primary.getPath()));
-            } catch (IllegalStateException e) {
+            } catch (IllegalArgumentException e) {
             }
 
             if (!mounted) {
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 9e036d1..5cf1c28 100644
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -50,12 +50,11 @@
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
-import android.os.Parcel;
-import android.os.Parcelable;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.os.Vibrator;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
@@ -124,6 +123,7 @@
 
     final Context mContext;
     final IActivityManager mAm;
+    final UserManager mUserManager;
     final IBinder mForegroundToken = new Binder();
 
     private WorkerHandler mHandler;
@@ -164,6 +164,7 @@
     private final AppOpsManager mAppOps;
 
     private ArrayList<NotificationListenerInfo> mListeners = new ArrayList<NotificationListenerInfo>();
+    private ArrayList<String> mEnabledListenersForCurrentUser = new ArrayList<String>();
 
     // Notification control database. For now just contains disabled packages.
     private AtomicFile mPolicyFile;
@@ -180,20 +181,27 @@
 
     private class NotificationListenerInfo implements DeathRecipient {
         INotificationListener listener;
+        String pkg;
         int userid;
-        public NotificationListenerInfo(INotificationListener listener, int userid) {
+        boolean isSystem;
+
+        public NotificationListenerInfo(INotificationListener listener, String pkg, int userid,
+                boolean isSystem) {
             this.listener = listener;
+            this.pkg = pkg;
             this.userid = userid;
+            this.isSystem = isSystem;
         }
 
-        boolean userMatches(StatusBarNotification sbn) {
+        boolean enabledAndUserMatches(StatusBarNotification sbn) {
+            final int nid = sbn.getUserId();
+            if (!(isSystem || isEnabledForUser(nid))) return false;
             if (this.userid == UserHandle.USER_ALL) return true;
-            int nid = sbn.getUserId();
             return (nid == UserHandle.USER_ALL || nid == this.userid);
         }
 
         public void notifyPostedIfUserMatch(StatusBarNotification sbn) {
-            if (!userMatches(sbn)) return;
+            if (!enabledAndUserMatches(sbn)) return;
             try {
                 listener.onNotificationPosted(sbn);
             } catch (RemoteException ex) {
@@ -202,7 +210,7 @@
         }
 
         public void notifyRemovedIfUserMatch(StatusBarNotification sbn) {
-            if (!userMatches(sbn)) return;
+            if (!enabledAndUserMatches(sbn)) return;
             try {
                 listener.onNotificationRemoved(sbn);
             } catch (RemoteException ex) {
@@ -214,6 +222,14 @@
         public void binderDied() {
             unregisterListener(this.listener, this.userid);
         }
+
+        /** convenience method for looking in mEnabledListenersForCurrentUser */
+        public boolean isEnabledForUser(int userid) {
+            for (int i=0; i<mEnabledListenersForCurrentUser.size(); i++) {
+                if (this.pkg.equals(mEnabledListenersForCurrentUser.get(i))) return true;
+            }
+            return false;
+        }
     }
 
     private static class Archive {
@@ -413,12 +429,14 @@
     }
 
     public StatusBarNotification[] getActiveNotifications(String callingPkg) {
+        // enforce() will ensure the calling uid has the correct permission
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NOTIFICATIONS,
                 "NotificationManagerService.getActiveNotifications");
 
         StatusBarNotification[] tmp = null;
         int uid = Binder.getCallingUid();
 
+        // noteOp will check to make sure the callingPkg matches the uid
         if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ACCESS_NOTIFICATIONS, uid, callingPkg)
                 == AppOpsManager.MODE_ALLOWED) {
             synchronized (mNotificationList) {
@@ -433,12 +451,14 @@
     }
 
     public StatusBarNotification[] getHistoricalNotifications(String callingPkg, int count) {
+        // enforce() will ensure the calling uid has the correct permission
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NOTIFICATIONS,
                 "NotificationManagerService.getHistoricalNotifications");
 
         StatusBarNotification[] tmp = null;
         int uid = Binder.getCallingUid();
 
+        // noteOp will check to make sure the callingPkg matches the uid
         if (mAppOps.noteOpNoThrow(AppOpsManager.OP_ACCESS_NOTIFICATIONS, uid, callingPkg)
                 == AppOpsManager.MODE_ALLOWED) {
             synchronized (mArchive) {
@@ -448,12 +468,27 @@
         return tmp;
     }
 
+    boolean packageCanTapNotificationsForUser(final int uid, final String pkg) {
+        // Make sure the package and uid match, and that the package is allowed access
+        return (AppOpsManager.MODE_ALLOWED
+            == mAppOps.checkOpNoThrow(AppOpsManager.OP_ACCESS_NOTIFICATIONS, uid, pkg));
+    }
+
     @Override
-    public void registerListener(final INotificationListener listener, final int userid) {
-        checkCallerIsSystem();
+    public void registerListener(final INotificationListener listener,
+            final String pkg, final int userid) {
+        // ensure system or allowed pkg
+        int uid = Binder.getCallingUid();
+        boolean isSystem = (UserHandle.getAppId(uid) == Process.SYSTEM_UID || uid == 0);
+        if (!(isSystem || packageCanTapNotificationsForUser(uid, pkg))) {
+            throw new SecurityException("Package " + pkg
+                    + " may not listen for notifications");
+        }
+
         synchronized (mNotificationList) {
             try {
-                NotificationListenerInfo info = new NotificationListenerInfo(listener, userid);
+                NotificationListenerInfo info
+                        = new NotificationListenerInfo(listener, pkg, userid, isSystem);
                 listener.asBinder().linkToDeath(info, 0);
                 mListeners.add(info);
             } catch (RemoteException e) {
@@ -464,7 +499,9 @@
 
     @Override
     public void unregisterListener(INotificationListener listener, int userid) {
-        checkCallerIsSystem();
+        // no need to check permissions; if your listener binder is in the list,
+        // that's proof that you had permission to add it in the first place
+
         synchronized (mNotificationList) {
             final int N = mListeners.size();
             for (int i=N-1; i>=0; i--) {
@@ -740,37 +777,67 @@
             } else if (action.equals(Intent.ACTION_USER_PRESENT)) {
                 // turn off LED when user passes through lock screen
                 mNotificationLight.turnOff();
+            } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
+                // reload per-user settings
+                mSettingsObserver.update(null);
             }
         }
     };
 
     class SettingsObserver extends ContentObserver {
+        private final Uri NOTIFICATION_LIGHT_PULSE_URI
+                = Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE);
+
+        private final Uri ENABLED_NOTIFICATION_LISTENERS_URI
+                = Settings.System.getUriFor(Settings.Secure.ENABLED_NOTIFICATION_LISTENERS);
+
         SettingsObserver(Handler handler) {
             super(handler);
         }
 
         void observe() {
             ContentResolver resolver = mContext.getContentResolver();
-            resolver.registerContentObserver(Settings.System.getUriFor(
-                    Settings.System.NOTIFICATION_LIGHT_PULSE), false, this);
-            update();
+            resolver.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI,
+                    false, this);
+            resolver.registerContentObserver(ENABLED_NOTIFICATION_LISTENERS_URI,
+                    false, this);
+            update(null);
         }
 
-        @Override public void onChange(boolean selfChange) {
-            update();
+        @Override public void onChange(boolean selfChange, Uri uri) {
+            update(uri);
         }
 
-        public void update() {
+        public void update(Uri uri) {
             ContentResolver resolver = mContext.getContentResolver();
-            boolean pulseEnabled = Settings.System.getInt(resolver,
-                        Settings.System.NOTIFICATION_LIGHT_PULSE, 0) != 0;
-            if (mNotificationPulseEnabled != pulseEnabled) {
-                mNotificationPulseEnabled = pulseEnabled;
-                updateNotificationPulse();
+            if (uri == null || NOTIFICATION_LIGHT_PULSE_URI.equals(uri)) {
+                boolean pulseEnabled = Settings.System.getInt(resolver,
+                            Settings.System.NOTIFICATION_LIGHT_PULSE, 0) != 0;
+                if (mNotificationPulseEnabled != pulseEnabled) {
+                    mNotificationPulseEnabled = pulseEnabled;
+                    updateNotificationPulse();
+                }
+            }
+            if (uri == null || ENABLED_NOTIFICATION_LISTENERS_URI.equals(uri)) {
+                String pkglist = Settings.Secure.getString(
+                        mContext.getContentResolver(),
+                        Settings.Secure.ENABLED_NOTIFICATION_LISTENERS);
+                mEnabledListenersForCurrentUser.clear();
+                if (pkglist != null) {
+                    String[] pkgs = pkglist.split(";");
+                    for (int i=0; i<pkgs.length; i++) {
+                        final String pkg = pkgs[i];
+                        if (pkg != null && ! "".equals(pkg)) {
+                            mEnabledListenersForCurrentUser.add(pkgs[i]);
+                        }
+                    }
+                }
             }
         }
     }
 
+    private SettingsObserver mSettingsObserver;
+
     static long[] getLongArray(Resources r, int resid, int maxlen, long[] def) {
         int[] ar = r.getIntArray(resid);
         if (ar == null) {
@@ -791,6 +858,7 @@
         mContext = context;
         mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
         mAm = ActivityManagerNative.getDefault();
+        mUserManager = (UserManager)context.getSystemService(Context.USER_SERVICE);
         mToastQueue = new ArrayList<ToastRecord>();
         mHandler = new WorkerHandler();
 
@@ -838,6 +906,7 @@
         filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
         filter.addAction(Intent.ACTION_USER_PRESENT);
         filter.addAction(Intent.ACTION_USER_STOPPED);
+        filter.addAction(Intent.ACTION_USER_SWITCHED);
         mContext.registerReceiver(mIntentReceiver, filter);
         IntentFilter pkgFilter = new IntentFilter();
         pkgFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
@@ -849,8 +918,8 @@
         IntentFilter sdFilter = new IntentFilter(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
         mContext.registerReceiver(mIntentReceiver, sdFilter);
 
-        SettingsObserver observer = new SettingsObserver(mHandler);
-        observer.observe();
+        mSettingsObserver = new SettingsObserver(mHandler);
+        mSettingsObserver.observe();
     }
 
     /**
@@ -1706,6 +1775,18 @@
 
         pw.println("Current Notification Manager state:");
 
+        pw.print("  Enabled listeners: [");
+        for (String pkg : mEnabledListenersForCurrentUser) {
+            pw.print(" " + pkg);
+        }
+        pw.println(" ]");
+
+        pw.println("  Live listeners:");
+        for (NotificationListenerInfo info : mListeners) {
+            pw.println("    " + info.pkg + " (user " + info.userid + "): " + info.listener
+                + (info.isSystem?" SYSTEM":""));
+        }
+
         int N;
 
         synchronized (mToastQueue) {
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index b2a8ad8..1663106 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -29,6 +29,7 @@
 import android.os.BatteryManager;
 import android.os.Debug;
 import android.os.Handler;
+import android.os.Looper;
 import android.os.Message;
 import android.os.Process;
 import android.os.ServiceManager;
@@ -114,6 +115,10 @@
      * Used for scheduling monitor callbacks and checking memory usage.
      */
     final class HeartbeatHandler extends Handler {
+        HeartbeatHandler(Looper looper) {
+            super(looper);
+        }
+
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
@@ -183,7 +188,9 @@
 
     private Watchdog() {
         super("watchdog");
-        mHandler = new HeartbeatHandler();
+        // Explicitly bind the HeartbeatHandler to run on the ServerThread, so
+        // that it can't get accidentally bound to another thread.
+        mHandler = new HeartbeatHandler(Looper.getMainLooper());
     }
 
     public void init(Context context, BatteryService battery,
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index d84018f..527e891 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1070,14 +1070,6 @@
                 if (userState.mBindingServices.contains(componentName)) {
                     continue;
                 }
-                // No enabled installed services => disable accessibility to avoid
-                // sending accessibility events with no recipient across processes.
-                if (userState.mEnabledServices.isEmpty()) {
-                    userState.mIsAccessibilityEnabled = false;
-                    Settings.Secure.putIntForUser(mContext.getContentResolver(),
-                            Settings.Secure.ACCESSIBILITY_ENABLED, 0, userState.mUserId);
-                    return;
-                }
                 if (userState.mEnabledServices.contains(componentName)) {
                     if (service == null) {
                         service = new Service(userState.mUserId, componentName, installedService);
@@ -1098,6 +1090,14 @@
                 }
             }
         }
+
+        // No enabled installed services => disable accessibility to avoid
+        // sending accessibility events with no recipient across processes.
+        if (isEnabled && userState.mEnabledServices.isEmpty()) {
+            userState.mIsAccessibilityEnabled = false;
+            Settings.Secure.putIntForUser(mContext.getContentResolver(),
+                    Settings.Secure.ACCESSIBILITY_ENABLED, 0, userState.mUserId);
+        }
     }
 
     private void scheduleUpdateClientsIfNeededLocked(UserState userState) {
diff --git a/services/java/com/android/server/accounts/AccountManagerService.java b/services/java/com/android/server/accounts/AccountManagerService.java
index 49295f5..c4b98ad 100644
--- a/services/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/java/com/android/server/accounts/AccountManagerService.java
@@ -455,7 +455,6 @@
 
     @Override
     public void onServiceChanged(AuthenticatorDescription desc, int userId, boolean removed) {
-        Slog.d(TAG, "onServiceChanged() for userId " + userId);
         validateAccountsInternal(getUserAccounts(userId), false /* invalidateAuthenticatorCache */);
     }
 
@@ -588,16 +587,12 @@
                     if (result != null) {
                         if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) {
                             // Create a Session for the target user and pass in the bundle
-                            Slog.i(TAG, "getAccountCredentialsForCloning returned success, "
-                                    + "sending result to target user");
                             completeCloningAccount(result, account, toAccounts);
                         } else {
-                            Slog.e(TAG, "getAccountCredentialsForCloning returned failure");
                             clonePassword(fromAccounts, toAccounts, account);
                         }
                         return;
                     } else {
-                        Slog.e(TAG, "getAccountCredentialsForCloning returned null");
                         clonePassword(fromAccounts, toAccounts, account);
                         super.onResult(result);
                     }
@@ -645,15 +640,12 @@
                     if (result != null) {
                         if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, false)) {
                             // TODO: Anything?
-                            Slog.i(TAG, "addAccount returned success");
                         } else {
                             // TODO: Show error notification
                             // TODO: Should we remove the shadow account to avoid retries?
-                            Slog.e(TAG, "addAccountFromCredentials returned failure");
                         }
                         return;
                     } else {
-                        Slog.e(TAG, "addAccountFromCredentials returned null");
                         super.onResult(result);
                     }
                 }
@@ -1433,6 +1425,17 @@
         if (accountType == null) throw new IllegalArgumentException("accountType is null");
         checkManageAccountsPermission();
 
+        // Is user disallowed from modifying accounts?
+        if (getUserManager().getUserRestrictions(Binder.getCallingUserHandle())
+                .getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
+            try {
+                response.onError(AccountManager.ERROR_CODE_USER_RESTRICTED,
+                        "User is not allowed to add an account!");
+            } catch (RemoteException re) {
+            }
+            return;
+        }
+
         UserAccounts accounts = getUserAccountsForCaller();
         final int pid = Binder.getCallingPid();
         final int uid = Binder.getCallingUid();
@@ -1573,17 +1576,19 @@
         private volatile Account[] mAccountsOfType = null;
         private volatile ArrayList<Account> mAccountsWithFeatures = null;
         private volatile int mCurrentAccount = 0;
+        private int mCallingUid;
 
         public GetAccountsByTypeAndFeatureSession(UserAccounts accounts,
-                IAccountManagerResponse response, String type, String[] features) {
+                IAccountManagerResponse response, String type, String[] features, int callingUid) {
             super(accounts, response, type, false /* expectActivityLaunch */,
                     true /* stripAuthTokenFromResult */);
+            mCallingUid = callingUid;
             mFeatures = features;
         }
 
         public void run() throws RemoteException {
             synchronized (mAccounts.cacheLock) {
-                mAccountsOfType = getAccountsFromCacheLocked(mAccounts, mAccountType);
+                mAccountsOfType = getAccountsFromCacheLocked(mAccounts, mAccountType, mCallingUid);
             }
             // check whether each account matches the requested features
             mAccountsWithFeatures = new ArrayList<Account>(mAccountsOfType.length);
@@ -1668,10 +1673,11 @@
     public Account[] getAccounts(int userId) {
         checkReadAccountsPermission();
         UserAccounts accounts = getUserAccounts(userId);
+        int callingUid = Binder.getCallingUid();
         long identityToken = clearCallingIdentity();
         try {
             synchronized (accounts.cacheLock) {
-                return getAccountsFromCacheLocked(accounts, null);
+                return getAccountsFromCacheLocked(accounts, null, callingUid);
             }
         } finally {
             restoreCallingIdentity(identityToken);
@@ -1711,7 +1717,8 @@
                 UserAccounts userAccounts = getUserAccounts(userId);
                 if (userAccounts == null) continue;
                 synchronized (userAccounts.cacheLock) {
-                    Account[] accounts = getAccountsFromCacheLocked(userAccounts, null);
+                    Account[] accounts = getAccountsFromCacheLocked(userAccounts, null,
+                            Binder.getCallingUid());
                     for (int a = 0; a < accounts.length; a++) {
                         runningAccounts.add(new AccountAndUser(accounts[a], userId));
                     }
@@ -1725,9 +1732,10 @@
 
     @Override
     public Account[] getAccountsAsUser(String type, int userId) {
+        final int callingUid = Binder.getCallingUid();
         // Only allow the system process to read accounts of other users
         if (userId != UserHandle.getCallingUserId()
-                && Binder.getCallingUid() != android.os.Process.myUid()) {
+                && callingUid != android.os.Process.myUid()) {
             throw new SecurityException("User " + UserHandle.getCallingUserId()
                     + " trying to get account for " + userId);
         }
@@ -1742,7 +1750,7 @@
         long identityToken = clearCallingIdentity();
         try {
             synchronized (accounts.cacheLock) {
-                return getAccountsFromCacheLocked(accounts, type);
+                return getAccountsFromCacheLocked(accounts, type, callingUid);
             }
         } finally {
             restoreCallingIdentity(identityToken);
@@ -1826,19 +1834,21 @@
         if (type == null) throw new IllegalArgumentException("accountType is null");
         checkReadAccountsPermission();
         UserAccounts userAccounts = getUserAccountsForCaller();
+        int callingUid = Binder.getCallingUid();
         long identityToken = clearCallingIdentity();
         try {
             if (features == null || features.length == 0) {
                 Account[] accounts;
                 synchronized (userAccounts.cacheLock) {
-                    accounts = getAccountsFromCacheLocked(userAccounts, type);
+                    accounts = getAccountsFromCacheLocked(userAccounts, type, callingUid);
                 }
                 Bundle result = new Bundle();
                 result.putParcelableArray(AccountManager.KEY_ACCOUNTS, accounts);
                 onResult(response, result);
                 return;
             }
-            new GetAccountsByTypeAndFeatureSession(userAccounts, response, type, features).bind();
+            new GetAccountsByTypeAndFeatureSession(userAccounts, response, type, features,
+                    callingUid).bind();
         } finally {
             restoreCallingIdentity(identityToken);
         }
@@ -2352,7 +2362,8 @@
                     }
                 }
             } else {
-                Account[] accounts = getAccountsFromCacheLocked(userAccounts, null /* type */);
+                Account[] accounts = getAccountsFromCacheLocked(userAccounts, null /* type */,
+                        android.os.Process.myUid());
                 fout.println("Accounts: " + accounts.length);
                 for (Account account : accounts) {
                     fout.println("  " + account);
@@ -2561,7 +2572,7 @@
         if (callingUid != android.os.Process.myUid()) {
             Bundle restrictions = getUserManager().getUserRestrictions(
                     new UserHandle(UserHandle.getUserId(callingUid)));
-            if (!restrictions.getBoolean(UserManager.ALLOW_MODIFY_ACCOUNTS)) {
+            if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
                 return false;
             }
         }
@@ -2691,13 +2702,56 @@
         accounts.accountCache.put(account.type, newAccountsForType);
     }
 
-    protected Account[] getAccountsFromCacheLocked(UserAccounts userAccounts, String accountType) {
+    private Account[] filterSharedAccounts(UserAccounts userAccounts, Account[] unfiltered,
+            int callingUid) {
+        if (getUserManager() == null || userAccounts == null || userAccounts.userId < 0
+                || callingUid == android.os.Process.myUid()) {
+            return unfiltered;
+        }
+        if (mUserManager.getUserInfo(userAccounts.userId).isRestricted()) {
+            String[] packages = mPackageManager.getPackagesForUid(callingUid);
+            // If any of the packages includes a white listed package, return the full set,
+            // otherwise return non-shared accounts only.
+            // This might be a temporary way to specify a whitelist
+            String whiteList = mContext.getResources().getString(
+                    com.android.internal.R.string.config_appsAuthorizedForSharedAccounts);
+            for (String packageName : packages) {
+                if (whiteList.contains(";" + packageName + ";")) {
+                    return unfiltered;
+                }
+            }
+            ArrayList<Account> allowed = new ArrayList<Account>();
+            Account[] sharedAccounts = getSharedAccountsAsUser(userAccounts.userId);
+            if (sharedAccounts == null || sharedAccounts.length == 0) return unfiltered;
+            for (Account account : unfiltered) {
+                boolean found = false;
+                for (Account shared : sharedAccounts) {
+                    if (shared.equals(account)) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    allowed.add(account);
+                }
+            }
+            Account[] filtered = new Account[allowed.size()];
+            allowed.toArray(filtered);
+            return filtered;
+        } else {
+            return unfiltered;
+        }
+    }
+
+    protected Account[] getAccountsFromCacheLocked(UserAccounts userAccounts, String accountType,
+            int callingUid) {
         if (accountType != null) {
             final Account[] accounts = userAccounts.accountCache.get(accountType);
             if (accounts == null) {
                 return EMPTY_ACCOUNT_ARRAY;
             } else {
-                return Arrays.copyOf(accounts, accounts.length);
+                return filterSharedAccounts(userAccounts, Arrays.copyOf(accounts, accounts.length),
+                        callingUid);
             }
         } else {
             int totalLength = 0;
@@ -2714,7 +2768,7 @@
                         accountsOfType.length);
                 totalLength += accountsOfType.length;
             }
-            return accounts;
+            return filterSharedAccounts(userAccounts, accounts, callingUid);
         }
     }
 
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 6f092bf..88ef884 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -19,6 +19,7 @@
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 
 import android.app.AppOpsManager;
+import android.appwidget.AppWidgetManager;
 import com.android.internal.R;
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.internal.os.ProcessStats;
@@ -2194,7 +2195,7 @@
             // the PID of the new process, or else throw a RuntimeException.
             Process.ProcessStartResult startResult = Process.start("android.app.ActivityThread",
                     app.processName, uid, uid, gids, debugFlags, mountExternal,
-                    app.info.targetSdkVersion, null, null);
+                    app.info.targetSdkVersion, app.info.seinfo, null);
 
             BatteryStatsImpl bs = app.batteryStats.getBatteryStats();
             synchronized (bs) {
@@ -11791,6 +11792,32 @@
                             + callingPid + ", uid=" + callingUid;
                     Slog.w(TAG, msg);
                     throw new SecurityException(msg);
+                } else if (AppWidgetManager.ACTION_APPWIDGET_CONFIGURE.equals(intent.getAction())) {
+                    // Special case for compatibility: we don't want apps to send this,
+                    // but historically it has not been protected and apps may be using it
+                    // to poke their own app widget.  So, instead of making it protected,
+                    // just limit it to the caller.
+                    if (callerApp == null) {
+                        String msg = "Permission Denial: not allowed to send broadcast "
+                                + intent.getAction() + " from unknown caller.";
+                        Slog.w(TAG, msg);
+                        throw new SecurityException(msg);
+                    } else if (intent.getComponent() != null) {
+                        // They are good enough to send to an explicit component...  verify
+                        // it is being sent to the calling app.
+                        if (!intent.getComponent().getPackageName().equals(
+                                callerApp.info.packageName)) {
+                            String msg = "Permission Denial: not allowed to send broadcast "
+                                    + intent.getAction() + " to "
+                                    + intent.getComponent().getPackageName() + " from "
+                                    + callerApp.info.packageName;
+                            Slog.w(TAG, msg);
+                            throw new SecurityException(msg);
+                        }
+                    } else {
+                        // Limit broadcast to their own package.
+                        intent.setPackage(callerApp.info.packageName);
+                    }
                 }
             } catch (RemoteException e) {
                 Slog.w(TAG, "Remote exception", e);
diff --git a/services/java/com/android/server/am/BroadcastQueue.java b/services/java/com/android/server/am/BroadcastQueue.java
index e8e8f25..ac7eb89 100644
--- a/services/java/com/android/server/am/BroadcastQueue.java
+++ b/services/java/com/android/server/am/BroadcastQueue.java
@@ -29,7 +29,6 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -1080,6 +1079,9 @@
                 pw.print("  #"); pw.print(i); pw.print(": "); pw.println(r);
                 pw.print("    ");
                 pw.println(r.intent.toShortString(false, true, true, false));
+                if (r.targetComp != null && r.targetComp != r.intent.getComponent()) {
+                    pw.print("    targetComp: "); pw.println(r.targetComp.toShortString());
+                }
                 Bundle bundle = r.intent.getExtras();
                 if (bundle != null) {
                     pw.print("    extras: "); pw.println(bundle.toString());
diff --git a/services/java/com/android/server/am/BroadcastRecord.java b/services/java/com/android/server/am/BroadcastRecord.java
index a98afb6..83cc0ea 100644
--- a/services/java/com/android/server/am/BroadcastRecord.java
+++ b/services/java/com/android/server/am/BroadcastRecord.java
@@ -38,6 +38,7 @@
  */
 class BroadcastRecord extends Binder {
     final Intent intent;    // the original intent that generated us
+    final ComponentName targetComp; // original component name set on the intent
     final ProcessRecord callerApp; // process that sent this
     final String callerPackage; // who sent this
     final int callingPid;   // the pid of who sent this
@@ -84,9 +85,12 @@
 
         pw.print(prefix); pw.print(this); pw.print(" to user "); pw.println(userId);
         pw.print(prefix); pw.println(intent.toInsecureString());
+        if (targetComp != null && targetComp != intent.getComponent()) {
+            pw.print(prefix); pw.print("  targetComp: "); pw.println(targetComp.toShortString());
+        }
         Bundle bundle = intent.getExtras();
         if (bundle != null) {
-            pw.print(prefix); pw.print("extras: "); pw.println(bundle.toString());
+            pw.print(prefix); pw.print("  extras: "); pw.println(bundle.toString());
         }
         pw.print(prefix); pw.print("caller="); pw.print(callerPackage); pw.print(" ");
                 pw.print(callerApp != null ? callerApp.toShortString() : "null");
@@ -174,6 +178,7 @@
             int _userId) {
         queue = _queue;
         intent = _intent;
+        targetComp = _intent.getComponent();
         callerApp = _callerApp;
         callerPackage = _callerPackage;
         callingPid = _callingPid;
diff --git a/services/java/com/android/server/am/ServiceRecord.java b/services/java/com/android/server/am/ServiceRecord.java
index 1ac6bdf..8ff1c7d 100644
--- a/services/java/com/android/server/am/ServiceRecord.java
+++ b/services/java/com/android/server/am/ServiceRecord.java
@@ -16,6 +16,9 @@
 
 package com.android.server.am;
 
+import android.app.PendingIntent;
+import android.net.Uri;
+import android.provider.Settings;
 import com.android.internal.os.BatteryStatsImpl;
 import com.android.server.NotificationManagerService;
 
@@ -369,6 +372,44 @@
                     }
                     try {
                         if (foregroundNoti.icon == 0) {
+                            // It is not correct for the caller to supply a notification
+                            // icon, but this used to be able to slip through, so for
+                            // those dirty apps give it the app's icon.
+                            foregroundNoti.icon = appInfo.icon;
+                            if (foregroundNoti.contentView == null) {
+                                // In this case the app may not have specified a
+                                // content view...  so we'll give them something to show.
+                                CharSequence appName = appInfo.loadLabel(
+                                        ams.mContext.getPackageManager());
+                                if (appName == null) {
+                                    appName = appInfo.packageName;
+                                }
+                                Context ctx = null;
+                                try {
+                                    ctx = ams.mContext.createPackageContext(
+                                            appInfo.packageName, 0);
+                                    Intent runningIntent = new Intent(
+                                            Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+                                    runningIntent.setData(Uri.fromParts("package",
+                                            appInfo.packageName, null));
+                                    PendingIntent pi = PendingIntent.getActivity(ams.mContext, 0,
+                                            runningIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+                                    foregroundNoti.setLatestEventInfo(ctx,
+                                            ams.mContext.getString(
+                                                    com.android.internal.R.string
+                                                            .app_running_notification_title,
+                                                    appName),
+                                            ams.mContext.getString(
+                                                    com.android.internal.R.string
+                                                            .app_running_notification_text,
+                                                    appName),
+                                            pi);
+                                } catch (PackageManager.NameNotFoundException e) {
+                                    foregroundNoti.icon = 0;
+                                }
+                            }
+                        }
+                        if (foregroundNoti.icon == 0) {
                             // Notifications whose icon is 0 are defined to not show
                             // a notification, silently ignoring it.  We don't want to
                             // just ignore it, we want to prevent the service from
diff --git a/services/java/com/android/server/content/ContentService.java b/services/java/com/android/server/content/ContentService.java
index 3b92338..545ec93 100644
--- a/services/java/com/android/server/content/ContentService.java
+++ b/services/java/com/android/server/content/ContentService.java
@@ -37,7 +37,9 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.UserHandle;
+import android.text.format.DateUtils;
 import android.util.Log;
+import android.util.Slog;
 import android.util.SparseIntArray;
 
 import java.io.FileDescriptor;
@@ -406,6 +408,12 @@
                 "no permission to write the sync settings");
         int userId = UserHandle.getCallingUserId();
 
+        if (pollFrequency <= DateUtils.MINUTE_IN_MILLIS) {
+            Slog.w(TAG, "Requested poll frequency of " + pollFrequency
+                    + "ms being rounded up to 60 seconds.");
+            pollFrequency = DateUtils.MINUTE_IN_MILLIS;
+        }
+
         long identityToken = clearCallingIdentity();
         try {
             getSyncManager().getSyncStorageEngine().addPeriodicSync(
diff --git a/services/java/com/android/server/net/NetworkPolicyManagerService.java b/services/java/com/android/server/net/NetworkPolicyManagerService.java
index 3ae652a..a82f421 100644
--- a/services/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -63,13 +63,13 @@
 import static android.text.format.DateUtils.DAY_IN_MILLIS;
 import static com.android.internal.util.ArrayUtils.appendInt;
 import static com.android.internal.util.Preconditions.checkNotNull;
+import static com.android.internal.util.XmlUtils.readBooleanAttribute;
+import static com.android.internal.util.XmlUtils.readIntAttribute;
+import static com.android.internal.util.XmlUtils.readLongAttribute;
+import static com.android.internal.util.XmlUtils.writeBooleanAttribute;
+import static com.android.internal.util.XmlUtils.writeIntAttribute;
+import static com.android.internal.util.XmlUtils.writeLongAttribute;
 import static com.android.server.NetworkManagementService.LIMIT_GLOBAL_ALERT;
-import static com.android.server.net.NetworkPolicyManagerService.XmlUtils.readBooleanAttribute;
-import static com.android.server.net.NetworkPolicyManagerService.XmlUtils.readIntAttribute;
-import static com.android.server.net.NetworkPolicyManagerService.XmlUtils.readLongAttribute;
-import static com.android.server.net.NetworkPolicyManagerService.XmlUtils.writeBooleanAttribute;
-import static com.android.server.net.NetworkPolicyManagerService.XmlUtils.writeIntAttribute;
-import static com.android.server.net.NetworkPolicyManagerService.XmlUtils.writeLongAttribute;
 import static com.android.server.net.NetworkStatsService.ACTION_NETWORK_STATS_UPDATED;
 import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
 import static org.xmlpull.v1.XmlPullParser.START_TAG;
@@ -149,7 +149,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.net.ProtocolException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -2088,44 +2087,4 @@
         }
         fout.print("]");
     }
-
-    public static class XmlUtils {
-        public static int readIntAttribute(XmlPullParser in, String name) throws IOException {
-            final String value = in.getAttributeValue(null, name);
-            try {
-                return Integer.parseInt(value);
-            } catch (NumberFormatException e) {
-                throw new ProtocolException("problem parsing " + name + "=" + value + " as int");
-            }
-        }
-
-        public static void writeIntAttribute(XmlSerializer out, String name, int value)
-                throws IOException {
-            out.attribute(null, name, Integer.toString(value));
-        }
-
-        public static long readLongAttribute(XmlPullParser in, String name) throws IOException {
-            final String value = in.getAttributeValue(null, name);
-            try {
-                return Long.parseLong(value);
-            } catch (NumberFormatException e) {
-                throw new ProtocolException("problem parsing " + name + "=" + value + " as long");
-            }
-        }
-
-        public static void writeLongAttribute(XmlSerializer out, String name, long value)
-                throws IOException {
-            out.attribute(null, name, Long.toString(value));
-        }
-
-        public static boolean readBooleanAttribute(XmlPullParser in, String name) {
-            final String value = in.getAttributeValue(null, name);
-            return Boolean.parseBoolean(value);
-        }
-
-        public static void writeBooleanAttribute(XmlSerializer out, String name, boolean value)
-                throws IOException {
-            out.attribute(null, name, Boolean.toString(value));
-        }
-    }
 }
diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java
index 02a2c1b..d9c85bf 100644
--- a/services/java/com/android/server/pm/Installer.java
+++ b/services/java/com/android/server/pm/Installer.java
@@ -188,7 +188,7 @@
         }
     }
 
-    public int install(String name, int uid, int gid) {
+    public int install(String name, int uid, int gid, String seinfo) {
         StringBuilder builder = new StringBuilder("install");
         builder.append(' ');
         builder.append(name);
@@ -196,6 +196,8 @@
         builder.append(uid);
         builder.append(' ');
         builder.append(gid);
+        builder.append(' ');
+        builder.append(seinfo != null ? seinfo : "!");
         return execute(builder.toString());
     }
 
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 2d12a77..afdd294 100644
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -362,6 +362,9 @@
     final HashMap<String, FeatureInfo> mAvailableFeatures =
             new HashMap<String, FeatureInfo>();
 
+    // If mac_permissions.xml was found for seinfo labeling.
+    boolean mFoundPolicyFile;
+
     // All available activities, for your resolving pleasure.
     final ActivityIntentResolver mActivities =
             new ActivityIntentResolver();
@@ -1029,8 +1032,11 @@
 
             readPermissions();
 
+            mFoundPolicyFile = SELinuxMMAC.readInstallPolicy();
+
             mRestoredSettings = mSettings.readLPw(this, sUserManager.getUsers(false),
                     mSdkVersion, mOnlyCore);
+
             long startTime = SystemClock.uptimeMillis();
 
             EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SYSTEM_SCAN_START,
@@ -2236,6 +2242,34 @@
         }
     }
 
+    private static void checkGrantRevokePermissions(PackageParser.Package pkg, BasePermission bp) {
+        int index = pkg.requestedPermissions.indexOf(bp.name);
+        if (index == -1) {
+            throw new SecurityException("Package " + pkg.packageName
+                    + " has not requested permission " + bp.name);
+        }
+        boolean isNormal =
+                ((bp.protectionLevel&PermissionInfo.PROTECTION_MASK_BASE)
+                        == PermissionInfo.PROTECTION_NORMAL);
+        boolean isDangerous =
+                ((bp.protectionLevel&PermissionInfo.PROTECTION_MASK_BASE)
+                        == PermissionInfo.PROTECTION_DANGEROUS);
+        boolean isDevelopment =
+                ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0);
+
+        if (!isNormal && !isDangerous && !isDevelopment) {
+            throw new SecurityException("Permission " + bp.name
+                    + " is not a changeable permission type");
+        }
+
+        if (isNormal || isDangerous) {
+            if (pkg.requestedPermissionsRequired.get(index)) {
+                throw new SecurityException("Can't change " + bp.name
+                        + ". It is required by the application");
+            }
+        }
+    }
+
     public void grantPermission(String packageName, String permissionName) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.GRANT_REVOKE_PERMISSIONS, null);
@@ -2246,21 +2280,16 @@
             }
             final BasePermission bp = mSettings.mPermissions.get(permissionName);
             if (bp == null) {
-                throw new IllegalArgumentException("Unknown permission: " + packageName);
+                throw new IllegalArgumentException("Unknown permission: " + permissionName);
             }
-            if (!pkg.requestedPermissions.contains(permissionName)) {
-                throw new SecurityException("Package " + packageName
-                        + " has not requested permission " + permissionName);
-            }
-            if ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) == 0) {
-                throw new SecurityException("Permission " + permissionName
-                        + " is not a development permission");
-            }
+
+            checkGrantRevokePermissions(pkg, bp);
+
             final PackageSetting ps = (PackageSetting) pkg.mExtras;
             if (ps == null) {
                 return;
             }
-            final GrantedPermissions gp = ps.sharedUser != null ? ps.sharedUser : ps;
+            final GrantedPermissions gp = (ps.sharedUser != null) ? ps.sharedUser : ps;
             if (gp.grantedPermissions.add(permissionName)) {
                 if (ps.haveGids) {
                     gp.gids = appendInts(gp.gids, bp.gids);
@@ -2282,21 +2311,16 @@
             }
             final BasePermission bp = mSettings.mPermissions.get(permissionName);
             if (bp == null) {
-                throw new IllegalArgumentException("Unknown permission: " + packageName);
+                throw new IllegalArgumentException("Unknown permission: " + permissionName);
             }
-            if (!pkg.requestedPermissions.contains(permissionName)) {
-                throw new SecurityException("Package " + packageName
-                        + " has not requested permission " + permissionName);
-            }
-            if ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) == 0) {
-                throw new SecurityException("Permission " + permissionName
-                        + " is not a development permission");
-            }
+
+            checkGrantRevokePermissions(pkg, bp);
+
             final PackageSetting ps = (PackageSetting) pkg.mExtras;
             if (ps == null) {
                 return;
             }
-            final GrantedPermissions gp = ps.sharedUser != null ? ps.sharedUser : ps;
+            final GrantedPermissions gp = (ps.sharedUser != null) ? ps.sharedUser : ps;
             if (gp.grantedPermissions.remove(permissionName)) {
                 gp.grantedPermissions.remove(permissionName);
                 if (ps.haveGids) {
@@ -3676,9 +3700,9 @@
         }
     }
 
-    private int createDataDirsLI(String packageName, int uid) {
+    private int createDataDirsLI(String packageName, int uid, String seinfo) {
         int[] users = sUserManager.getUserIds();
-        int res = mInstaller.install(packageName, uid, uid);
+        int res = mInstaller.install(packageName, uid, uid, seinfo);
         if (res < 0) {
             return res;
         }
@@ -4020,6 +4044,10 @@
                 pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
             }
 
+            if (mFoundPolicyFile) {
+                SELinuxMMAC.assignSeinfoValue(pkg);
+            }
+
             pkg.applicationInfo.uid = pkgSetting.appId;
             pkg.mExtras = pkgSetting;
 
@@ -4158,7 +4186,8 @@
                             recovered = true;
 
                             // And now re-install the app.
-                            ret = createDataDirsLI(pkgName, pkg.applicationInfo.uid);
+                            ret = createDataDirsLI(pkgName, pkg.applicationInfo.uid,
+                                                   pkg.applicationInfo.seinfo);
                             if (ret == -1) {
                                 // Ack should not happen!
                                 msg = prefix + pkg.packageName
@@ -4204,7 +4233,8 @@
                         Log.v(TAG, "Want this data dir: " + dataPath);
                 }
                 //invoke installer to do the actual installation
-                int ret = createDataDirsLI(pkgName, pkg.applicationInfo.uid);
+                int ret = createDataDirsLI(pkgName, pkg.applicationInfo.uid,
+                                           pkg.applicationInfo.seinfo);
                 if (ret < 0) {
                     // Error from installer
                     mLastScanError = PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
@@ -5077,7 +5107,7 @@
         final int N = pkg.requestedPermissions.size();
         for (int i=0; i<N; i++) {
             final String name = pkg.requestedPermissions.get(i);
-            //final boolean required = pkg.requestedPermssionsRequired.get(i);
+            final boolean required = pkg.requestedPermissionsRequired.get(i);
             final BasePermission bp = mSettings.mPermissions.get(name);
             if (DEBUG_INSTALL) {
                 if (gp != ps) {
@@ -5091,7 +5121,9 @@
                 final int level = bp.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
                 if (level == PermissionInfo.PROTECTION_NORMAL
                         || level == PermissionInfo.PROTECTION_DANGEROUS) {
-                    allowed = true;
+                    // If the permission is required, or it's optional and was previously
+                    // granted to the application, then allow it. Otherwise deny.
+                    allowed = (required || origPermissions.contains(perm));
                 } else if (bp.packageSetting == null) {
                     // This permission is invalid; skip it.
                     allowed = false;
@@ -5141,11 +5173,7 @@
                             & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0) {
                         // For development permissions, a development permission
                         // is granted only if it was already granted.
-                        if (origPermissions.contains(perm)) {
-                            allowed = true;
-                        } else {
-                            allowed = false;
-                        }
+                        allowed = origPermissions.contains(perm);
                     }
                     if (allowed) {
                         allowedSig = true;
@@ -5917,7 +5945,7 @@
                 null);
 
         final int uid = Binder.getCallingUid();
-        if (!isUserAllowed(UserHandle.getUserId(uid), UserManager.ALLOW_INSTALL_APPS)) {
+        if (isUserRestricted(UserHandle.getUserId(uid), UserManager.DISALLOW_INSTALL_APPS)) {
             try {
                 observer.packageInstalled("", PackageManager.INSTALL_FAILED_USER_RESTRICTED);
             } catch (RemoteException re) {
@@ -5965,7 +5993,7 @@
                     android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
                     "installExistingPackage for user " + userId);
         }
-        if (!isUserAllowed(userId, UserManager.ALLOW_INSTALL_APPS)) {
+        if (isUserRestricted(userId, UserManager.DISALLOW_INSTALL_APPS)) {
             return PackageManager.INSTALL_FAILED_USER_RESTRICTED;
         }
 
@@ -5999,13 +6027,13 @@
         return PackageManager.INSTALL_SUCCEEDED;
     }
 
-    private boolean isUserAllowed(int userId, String restrictionKey) {
+    private boolean isUserRestricted(int userId, String restrictionKey) {
         Bundle restrictions = sUserManager.getUserRestrictions(userId);
-        if (!restrictions.getBoolean(UserManager.ALLOW_INSTALL_APPS)) {
-            Log.w(TAG, "User does not have permission to: " + restrictionKey);
-            return false;
+        if (restrictions.getBoolean(restrictionKey, false)) {
+            Log.w(TAG, "User is restricted: " + restrictionKey);
+            return true;
         }
-        return true;
+        return false;
     }
 
     @Override
@@ -8402,7 +8430,7 @@
                     android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
                     "deletePackage for user " + userId);
         }
-        if (!isUserAllowed(userId, UserManager.ALLOW_UNINSTALL_APPS)) {
+        if (isUserRestricted(userId, UserManager.DISALLOW_UNINSTALL_APPS)) {
             try {
                 observer.packageDeleted(packageName, PackageManager.DELETE_FAILED_USER_RESTRICTED);
             } catch (RemoteException re) {
@@ -8448,7 +8476,8 @@
         IDevicePolicyManager dpm = IDevicePolicyManager.Stub.asInterface(
                 ServiceManager.getService(Context.DEVICE_POLICY_SERVICE));
         try {
-            if (dpm != null && dpm.packageHasActiveAdmins(packageName, userId)) {
+            if (dpm != null && (dpm.packageHasActiveAdmins(packageName, userId)
+                    || dpm.isDeviceOwner(packageName))) {
                 Slog.w(TAG, "Not removing package " + packageName + ": has active device admin");
                 return PackageManager.DELETE_FAILED_DEVICE_POLICY_MANAGER;
             }
diff --git a/services/java/com/android/server/pm/SELinuxMMAC.java b/services/java/com/android/server/pm/SELinuxMMAC.java
new file mode 100644
index 0000000..15d2a5a
--- /dev/null
+++ b/services/java/com/android/server/pm/SELinuxMMAC.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2012 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.server.pm;
+
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageParser;
+import android.content.pm.Signature;
+import android.os.Environment;
+import android.util.Slog;
+import android.util.Xml;
+
+import com.android.internal.util.XmlUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import java.util.HashMap;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+/**
+ * Centralized access to SELinux MMAC (middleware MAC) implementation.
+ * {@hide}
+ */
+public final class SELinuxMMAC {
+
+    private static final String TAG = "SELinuxMMAC";
+
+    private static final boolean DEBUG_POLICY = false;
+    private static final boolean DEBUG_POLICY_INSTALL = DEBUG_POLICY || false;
+
+    // Signature seinfo values read from policy.
+    private static final HashMap<Signature, String> sSigSeinfo =
+        new HashMap<Signature, String>();
+
+    // Package name seinfo values read from policy.
+    private static final HashMap<String, String> sPackageSeinfo =
+        new HashMap<String, String>();
+
+    // Locations of potential install policy files.
+    private static final File[] INSTALL_POLICY_FILE = {
+        new File(Environment.getDataDirectory(), "system/mac_permissions.xml"),
+        new File(Environment.getRootDirectory(), "etc/security/mac_permissions.xml"),
+        null};
+
+    private static void flushInstallPolicy() {
+        sSigSeinfo.clear();
+        sPackageSeinfo.clear();
+    }
+
+    /**
+     * Parses an MMAC install policy from a predefined list of locations.
+     * @param none
+     * @return boolean indicating whether an install policy was correctly parsed.
+     */
+    public static boolean readInstallPolicy() {
+
+        return readInstallPolicy(INSTALL_POLICY_FILE);
+    }
+
+    /**
+     * Parses an MMAC install policy given as an argument.
+     * @param File object representing the path of the policy.
+     * @return boolean indicating whether the install policy was correctly parsed.
+     */
+    public static boolean readInstallPolicy(File policyFile) {
+
+        return readInstallPolicy(new File[]{policyFile,null});
+    }
+
+    private static boolean readInstallPolicy(File[] policyFiles) {
+
+        FileReader policyFile = null;
+        int i = 0;
+        while (policyFile == null && policyFiles != null && policyFiles[i] != null) {
+            try {
+                policyFile = new FileReader(policyFiles[i]);
+                break;
+            } catch (FileNotFoundException e) {
+                Slog.d(TAG,"Couldn't find install policy " + policyFiles[i].getPath());
+            }
+            i++;
+        }
+
+        if (policyFile == null) {
+            Slog.d(TAG, "No policy file found. All seinfo values will be null.");
+            return false;
+        }
+
+        Slog.d(TAG, "Using install policy file " + policyFiles[i].getPath());
+
+        flushInstallPolicy();
+
+        try {
+            XmlPullParser parser = Xml.newPullParser();
+            parser.setInput(policyFile);
+
+            XmlUtils.beginDocument(parser, "policy");
+            while (true) {
+                XmlUtils.nextElement(parser);
+                if (parser.getEventType() == XmlPullParser.END_DOCUMENT) {
+                    break;
+                }
+
+                String tagName = parser.getName();
+                if ("signer".equals(tagName)) {
+                    String cert = parser.getAttributeValue(null, "signature");
+                    if (cert == null) {
+                        Slog.w(TAG, "<signer> without signature at "
+                               + parser.getPositionDescription());
+                        XmlUtils.skipCurrentTag(parser);
+                        continue;
+                    }
+                    Signature signature;
+                    try {
+                        signature = new Signature(cert);
+                    } catch (IllegalArgumentException e) {
+                        Slog.w(TAG, "<signer> with bad signature at "
+                               + parser.getPositionDescription(), e);
+                        XmlUtils.skipCurrentTag(parser);
+                        continue;
+                    }
+                    String seinfo = readSeinfoTag(parser);
+                    if (seinfo != null) {
+                        if (DEBUG_POLICY_INSTALL)
+                            Slog.i(TAG, "<signer> tag: (" + cert + ") assigned seinfo="
+                                   + seinfo);
+
+                        sSigSeinfo.put(signature, seinfo);
+                    }
+                } else if ("default".equals(tagName)) {
+                    String seinfo = readSeinfoTag(parser);
+                    if (seinfo != null) {
+                        if (DEBUG_POLICY_INSTALL)
+                            Slog.i(TAG, "<default> tag assigned seinfo=" + seinfo);
+
+                        // The 'null' signature is the default seinfo value
+                        sSigSeinfo.put(null, seinfo);
+                    }
+                } else if ("package".equals(tagName)) {
+                    String pkgName = parser.getAttributeValue(null, "name");
+                    if (pkgName == null) {
+                        Slog.w(TAG, "<package> without name at "
+                               + parser.getPositionDescription());
+                        XmlUtils.skipCurrentTag(parser);
+                        continue;
+                    }
+                    String seinfo = readSeinfoTag(parser);
+                    if (seinfo != null) {
+                        if (DEBUG_POLICY_INSTALL)
+                            Slog.i(TAG, "<package> tag: (" + pkgName +
+                                   ") assigned seinfo=" + seinfo);
+
+                        sPackageSeinfo.put(pkgName, seinfo);
+                    }
+                } else {
+                    XmlUtils.skipCurrentTag(parser);
+                    continue;
+                }
+            }
+        } catch (XmlPullParserException e) {
+            Slog.w(TAG, "Got execption parsing ", e);
+        } catch (IOException e) {
+            Slog.w(TAG, "Got execption parsing ", e);
+        }
+        try {
+            policyFile.close();
+        } catch (IOException e) {
+            //omit
+        }
+        return true;
+    }
+
+    private static String readSeinfoTag(XmlPullParser parser) throws
+            IOException, XmlPullParserException {
+
+        int type;
+        int outerDepth = parser.getDepth();
+        String seinfo = null;
+        while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+               && (type != XmlPullParser.END_TAG
+                   || parser.getDepth() > outerDepth)) {
+            if (type == XmlPullParser.END_TAG
+                || type == XmlPullParser.TEXT) {
+                continue;
+            }
+
+            String tagName = parser.getName();
+            if ("seinfo".equals(tagName)) {
+                String seinfoValue = parser.getAttributeValue(null, "value");
+                if (seinfoValue != null) {
+                    seinfo = seinfoValue;
+                } else {
+                    Slog.w(TAG, "<seinfo> without value at "
+                           + parser.getPositionDescription());
+                }
+            }
+            XmlUtils.skipCurrentTag(parser);
+        }
+        return seinfo;
+    }
+
+    /**
+     * Labels a package based on an seinfo tag from install policy.
+     * The label is attached to the ApplicationInfo instance of the package.
+     * @param PackageParser.Package object representing the package
+     *         to labeled.
+     * @return String holding the value of the seinfo label that was assigned.
+     *         Value may be null which indicates no seinfo label was assigned.
+     */
+    public static void assignSeinfoValue(PackageParser.Package pkg) {
+
+        /*
+         * Non system installed apps should be treated the same. This
+         * means that any post-loaded apk will be assigned the default
+         * tag, if one exists in the policy, else null, without respect
+         * to the signing key.
+         */
+        if (((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) ||
+            ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0)) {
+
+            // We just want one of the signatures to match.
+            for (Signature s : pkg.mSignatures) {
+                if (s == null)
+                    continue;
+
+                if (sSigSeinfo.containsKey(s)) {
+                    String seinfo = pkg.applicationInfo.seinfo = sSigSeinfo.get(s);
+                    if (DEBUG_POLICY_INSTALL)
+                        Slog.i(TAG, "package (" + pkg.packageName +
+                               ") labeled with seinfo=" + seinfo);
+
+                    return;
+                }
+            }
+
+            // Check for seinfo labeled by package.
+            if (sPackageSeinfo.containsKey(pkg.packageName)) {
+                String seinfo = pkg.applicationInfo.seinfo = sPackageSeinfo.get(pkg.packageName);
+                if (DEBUG_POLICY_INSTALL)
+                    Slog.i(TAG, "package (" + pkg.packageName +
+                           ") labeled with seinfo=" + seinfo);
+                return;
+            }
+        }
+
+        // If we have a default seinfo value then great, otherwise
+        // we set a null object and that is what we started with.
+        String seinfo = pkg.applicationInfo.seinfo = sSigSeinfo.get(null);
+        if (DEBUG_POLICY_INSTALL)
+            Slog.i(TAG, "package (" + pkg.packageName +
+                   ") labeled with seinfo=" + (seinfo == null ? "null" : seinfo));
+    }
+}
diff --git a/services/java/com/android/server/pm/UserManagerService.java b/services/java/com/android/server/pm/UserManagerService.java
index 1414cbd..fecc2df 100644
--- a/services/java/com/android/server/pm/UserManagerService.java
+++ b/services/java/com/android/server/pm/UserManagerService.java
@@ -25,7 +25,10 @@
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.RestrictionEntry;
+import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.UserInfo;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
@@ -83,11 +86,17 @@
     private static final String TAG_USERS = "users";
     private static final String TAG_USER = "user";
     private static final String TAG_RESTRICTIONS = "restrictions";
+    private static final String TAG_ENTRY = "entry";
+    private static final String TAG_VALUE = "value";
+    private static final String ATTR_KEY = "key";
+    private static final String ATTR_MULTIPLE = "m";
 
     private static final String USER_INFO_DIR = "system" + File.separator + "users";
     private static final String USER_LIST_FILENAME = "userlist.xml";
     private static final String USER_PHOTO_FILENAME = "photo.png";
 
+    private static final String RESTRICTIONS_FILE_PREFIX = "res_";
+
     private static final int MIN_USER_ID = 10;
 
     private static final int USER_VERSION = 2;
@@ -217,6 +226,13 @@
         }
     }
 
+    @Override
+    public boolean isRestricted() {
+        synchronized (mPackagesLock) {
+            return getUserInfoLocked(UserHandle.getCallingUserId()).isRestricted();
+        }
+    }
+
     /*
      * Should be locked on mUsers before calling this.
      */
@@ -549,7 +565,6 @@
         mNextSerialNumber = MIN_USER_ID;
 
         Bundle restrictions = new Bundle();
-        initRestrictionsToDefaults(restrictions);
         mUserRestrictions.append(UserHandle.USER_OWNER, restrictions);
 
         updateUserIdsLocked();
@@ -599,11 +614,11 @@
             Bundle restrictions = mUserRestrictions.get(userInfo.id);
             if (restrictions != null) {
                 serializer.startTag(null, TAG_RESTRICTIONS);
-                writeBoolean(serializer, restrictions, UserManager.ALLOW_CONFIG_WIFI);
-                writeBoolean(serializer, restrictions, UserManager.ALLOW_MODIFY_ACCOUNTS);
-                writeBoolean(serializer, restrictions, UserManager.ALLOW_INSTALL_APPS);
-                writeBoolean(serializer, restrictions, UserManager.ALLOW_UNINSTALL_APPS);
-                writeBoolean(serializer, restrictions, UserManager.ALLOW_CONFIG_LOCATION_ACCESS);
+                writeBoolean(serializer, restrictions, UserManager.DISALLOW_CONFIG_WIFI);
+                writeBoolean(serializer, restrictions, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+                writeBoolean(serializer, restrictions, UserManager.DISALLOW_INSTALL_APPS);
+                writeBoolean(serializer, restrictions, UserManager.DISALLOW_UNINSTALL_APPS);
+                writeBoolean(serializer, restrictions, UserManager.DISALLOW_SHARE_LOCATION);
                 serializer.endTag(null, TAG_RESTRICTIONS);
             }
             serializer.endTag(null, TAG_USER);
@@ -667,7 +682,6 @@
         long lastLoggedInTime = 0L;
         boolean partial = false;
         Bundle restrictions = new Bundle();
-        initRestrictionsToDefaults(restrictions);
 
         FileInputStream fis = null;
         try {
@@ -716,11 +730,11 @@
                             name = parser.getText();
                         }
                     } else if (TAG_RESTRICTIONS.equals(tag)) {
-                        readBoolean(parser, restrictions, UserManager.ALLOW_CONFIG_WIFI);
-                        readBoolean(parser, restrictions, UserManager.ALLOW_MODIFY_ACCOUNTS);
-                        readBoolean(parser, restrictions, UserManager.ALLOW_INSTALL_APPS);
-                        readBoolean(parser, restrictions, UserManager.ALLOW_UNINSTALL_APPS);
-                        readBoolean(parser, restrictions, UserManager.ALLOW_CONFIG_LOCATION_ACCESS);
+                        readBoolean(parser, restrictions, UserManager.DISALLOW_CONFIG_WIFI);
+                        readBoolean(parser, restrictions, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+                        readBoolean(parser, restrictions, UserManager.DISALLOW_INSTALL_APPS);
+                        readBoolean(parser, restrictions, UserManager.DISALLOW_UNINSTALL_APPS);
+                        readBoolean(parser, restrictions, UserManager.DISALLOW_SHARE_LOCATION);
                     }
                 }
             }
@@ -749,7 +763,9 @@
     private void readBoolean(XmlPullParser parser, Bundle restrictions,
             String restrictionKey) {
         String value = parser.getAttributeValue(null, restrictionKey);
-        restrictions.putBoolean(restrictionKey, value == null ? true : Boolean.parseBoolean(value));
+        if (value != null) {
+            restrictions.putBoolean(restrictionKey, Boolean.parseBoolean(value));
+        }
     }
 
     private void writeBoolean(XmlSerializer xml, Bundle restrictions, String restrictionKey)
@@ -760,14 +776,6 @@
         }
     }
 
-    private void initRestrictionsToDefaults(Bundle restrictions) {
-        restrictions.putBoolean(UserManager.ALLOW_CONFIG_WIFI, true);
-        restrictions.putBoolean(UserManager.ALLOW_MODIFY_ACCOUNTS, true);
-        restrictions.putBoolean(UserManager.ALLOW_INSTALL_APPS, true);
-        restrictions.putBoolean(UserManager.ALLOW_UNINSTALL_APPS, true);
-        restrictions.putBoolean(UserManager.ALLOW_CONFIG_LOCATION_ACCESS, true);
-    }
-
     private int readIntAttribute(XmlPullParser parser, String attr, int defaultValue) {
         String valueString = parser.getAttributeValue(null, attr);
         if (valueString == null) return defaultValue;
@@ -814,7 +822,6 @@
                     writeUserLocked(userInfo);
                     updateUserIdsLocked();
                     Bundle restrictions = new Bundle();
-                    initRestrictionsToDefaults(restrictions);
                     mUserRestrictions.append(userId, restrictions);
                 }
             }
@@ -947,6 +954,151 @@
     }
 
     @Override
+    public List<RestrictionEntry> getApplicationRestrictions(String packageName, int userId) {
+        if (UserHandle.getCallingUserId() != userId
+                || Binder.getCallingUid() != getUidForPackage(packageName)) {
+            checkManageUsersPermission("Only system can get restrictions for other users/apps");
+        }
+        synchronized (mPackagesLock) {
+            // Read the restrictions from XML
+            return readApplicationRestrictionsLocked(packageName, userId);
+        }
+    }
+
+    @Override
+    public void setApplicationRestrictions(String packageName, List<RestrictionEntry> entries,
+            int userId) {
+        if (UserHandle.getCallingUserId() != userId
+                || Binder.getCallingUid() != getUidForPackage(packageName)) {
+            checkManageUsersPermission("Only system can set restrictions for other users/apps");
+        }
+        synchronized (mPackagesLock) {
+            // Write the restrictions to XML
+            writeApplicationRestrictionsLocked(packageName, entries, userId);
+        }
+    }
+
+    private int getUidForPackage(String packageName) {
+        try {
+            return mContext.getPackageManager().getApplicationInfo(packageName,
+                    PackageManager.GET_UNINSTALLED_PACKAGES).uid;
+        } catch (NameNotFoundException nnfe) {
+            return -1;
+        }
+    }
+
+    private List<RestrictionEntry> readApplicationRestrictionsLocked(String packageName,
+            int userId) {
+        final ArrayList<RestrictionEntry> entries = new ArrayList<RestrictionEntry>();
+        final ArrayList<String> values = new ArrayList<String>();
+
+        FileInputStream fis = null;
+        try {
+            AtomicFile restrictionsFile =
+                    new AtomicFile(new File(Environment.getUserSystemDirectory(userId),
+                            RESTRICTIONS_FILE_PREFIX + packageName + ".xml"));
+            fis = restrictionsFile.openRead();
+            XmlPullParser parser = Xml.newPullParser();
+            parser.setInput(fis, null);
+            int type;
+            while ((type = parser.next()) != XmlPullParser.START_TAG
+                    && type != XmlPullParser.END_DOCUMENT) {
+                ;
+            }
+
+            if (type != XmlPullParser.START_TAG) {
+                Slog.e(LOG_TAG, "Unable to read restrictions file "
+                        + restrictionsFile.getBaseFile());
+                return entries;
+            }
+
+            while ((type = parser.next()) != XmlPullParser.END_DOCUMENT) {
+                if (type == XmlPullParser.START_TAG && parser.getName().equals(TAG_ENTRY)) {
+                    String key = parser.getAttributeValue(null, ATTR_KEY);
+                    String multiple = parser.getAttributeValue(null, ATTR_MULTIPLE);
+                    if (multiple != null) {
+                        int count = Integer.parseInt(multiple);
+                        while (count > 0 && (type = parser.next()) != XmlPullParser.END_DOCUMENT) {
+                            if (type == XmlPullParser.START_TAG
+                                    && parser.getName().equals(TAG_VALUE)) {
+                                values.add(parser.nextText().trim());
+                                count--;
+                            }
+                        }
+                        String [] valueStrings = new String[values.size()];
+                        values.toArray(valueStrings);
+                        Slog.d(LOG_TAG, "Got RestrictionEntry " + key + "," + valueStrings);
+                        RestrictionEntry entry = new RestrictionEntry(key, valueStrings);
+                        entries.add(entry);
+                    } else {
+                        String value = parser.nextText().trim();
+                        Slog.d(LOG_TAG, "Got RestrictionEntry " + key + "," + value);
+                        RestrictionEntry entry = new RestrictionEntry(key, value);
+                        entries.add(entry);
+                    }
+                }
+            }
+
+        } catch (IOException ioe) {
+        } catch (XmlPullParserException pe) {
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                }
+            }
+        }
+        return entries;
+    }
+
+    private void writeApplicationRestrictionsLocked(String packageName,
+            List<RestrictionEntry> entries, int userId) {
+        FileOutputStream fos = null;
+        AtomicFile restrictionsFile = new AtomicFile(
+                new File(Environment.getUserSystemDirectory(userId),
+                        RESTRICTIONS_FILE_PREFIX + packageName + ".xml"));
+        try {
+            fos = restrictionsFile.startWrite();
+            final BufferedOutputStream bos = new BufferedOutputStream(fos);
+
+            // XmlSerializer serializer = XmlUtils.serializerInstance();
+            final XmlSerializer serializer = new FastXmlSerializer();
+            serializer.setOutput(bos, "utf-8");
+            serializer.startDocument(null, true);
+            serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
+
+            serializer.startTag(null, TAG_RESTRICTIONS);
+
+            for (RestrictionEntry entry : entries) {
+                serializer.startTag(null, TAG_ENTRY);
+                serializer.attribute(null, ATTR_KEY, entry.key);
+                if (entry.getStringValue() != null || entry.getMultipleValues() == null) {
+                    String value = entry.getStringValue();
+                    serializer.text(value != null ? value : "");
+                } else {
+                    String[] values = entry.getMultipleValues();
+                    serializer.attribute(null, ATTR_MULTIPLE, Integer.toString(values.length));
+                    for (String value : values) {
+                        serializer.startTag(null, TAG_VALUE);
+                        serializer.text(value != null ? value : "");
+                        serializer.endTag(null, TAG_VALUE);
+                    }
+                }
+                serializer.endTag(null, TAG_ENTRY);
+            }
+
+            serializer.endTag(null, TAG_RESTRICTIONS);
+
+            serializer.endDocument();
+            restrictionsFile.finishWrite(fos);
+        } catch (Exception e) {
+            restrictionsFile.failWrite(fos);
+            Slog.e(LOG_TAG, "Error writing application restrictions list");
+        }
+    }
+
+    @Override
     public int getUserSerialNumber(int userHandle) {
         synchronized (mPackagesLock) {
             if (!exists(userHandle)) return -1;
diff --git a/services/java/com/android/server/wifi/WifiController.java b/services/java/com/android/server/wifi/WifiController.java
index 4d7c434..6e6b8cc 100644
--- a/services/java/com/android/server/wifi/WifiController.java
+++ b/services/java/com/android/server/wifi/WifiController.java
@@ -166,7 +166,7 @@
         registerForStayAwakeModeChange(handler);
         readWifiIdleTime();
         registerForWifiIdleTimeChange(handler);
-        readStayAwakeConditions();
+        readWifiSleepPolicy();
         registerForWifiSleepPolicyChange(handler);
     }
 
diff --git a/services/java/com/android/server/wifi/WifiService.java b/services/java/com/android/server/wifi/WifiService.java
index bc6bdaf..9dde58f7 100644
--- a/services/java/com/android/server/wifi/WifiService.java
+++ b/services/java/com/android/server/wifi/WifiService.java
@@ -396,6 +396,18 @@
 
         long ident = Binder.clearCallingIdentity();
         try {
+
+            /* Turning off Wi-Fi when scans are still available */
+            if (!enable && isScanningAlwaysAvailable()) {
+                /* This can be changed by user in the app to not be notified again */
+                boolean notifyUser = (Settings.Global.getInt(mContext.getContentResolver(),
+                        Settings.Global.WIFI_NOTIFY_SCAN_ALWAYS_AVAILABLE, 1) == 1);
+                if (notifyUser) {
+                    Intent intent = new Intent(WifiManager.ACTION_NOTIFY_SCAN_ALWAYS_AVAILABLE);
+                    mContext.startActivityAsUser(intent, null, UserHandle.CURRENT);
+                }
+            }
+
             if (! mSettingsStore.handleWifiToggled(enable)) {
                 // Nothing to do if wifi cannot be toggled
                 return true;
@@ -482,21 +494,11 @@
      *         started or is already in the queue.
      */
     public boolean isScanningAlwaysAvailable() {
-        // TODO: implement
-        return true;
+        enforceAccessPermission();
+        return mSettingsStore.isScanAlwaysAvailable();
     }
 
     /**
-     * @param enable {@code true} to enable, {@code false} to disable.
-     * @return {@code true} if the enable/disable operation was
-     *         started or is already in the queue.
-     */
-    public void setScanningAlwaysAvailable(boolean enable) {
-        // TODO: implement
-    }
-
-
-    /**
      * see {@link android.net.wifi.WifiManager#disconnect()}
      */
     public void disconnect() {
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index cfefadd..34052f3 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -76,6 +76,7 @@
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.PixelFormat;
 import android.graphics.Point;
@@ -282,6 +283,8 @@
     private static final String SYSTEM_SECURE = "ro.secure";
     private static final String SYSTEM_DEBUGGABLE = "ro.debuggable";
 
+    private static final int MAX_SCREENSHOT_RETRIES = 3;
+
     final private KeyguardDisableHandler mKeyguardDisableHandler;
 
     private final boolean mHeadless;
@@ -1481,7 +1484,11 @@
                     pos++;
                 }
                 if (pos >= N) {
-                    // All is good!
+                    // Z order is good.
+                    // The IM target window may be changed, so update the mTargetAppToken.
+                    if (imWin != null) {
+                        imWin.mTargetAppToken = mInputMethodTarget.mAppToken;
+                    }
                     return false;
                 }
             }
@@ -5273,134 +5280,191 @@
             throw new SecurityException("Requires READ_FRAME_BUFFER permission");
         }
 
-        Bitmap rawss;
+        Bitmap rawss = null;
 
         int maxLayer = 0;
         final Rect frame = new Rect();
 
-        float scale;
+        float scale = 0;
         int dw, dh;
-        int rot;
+        int rot = Surface.ROTATION_0;
 
-        synchronized(mWindowMap) {
-            long ident = Binder.clearCallingIdentity();
+        boolean screenshotReady;
+        int minLayer;
+        if (appToken == null) {
+            screenshotReady = true;
+            minLayer = 0;
+        } else {
+            screenshotReady = false;
+            minLayer = Integer.MAX_VALUE;
+        }
 
-            final DisplayContent displayContent = getDisplayContentLocked(displayId);
-            if (displayContent == null) {
-                return null;
+        int retryCount = 0;
+        WindowState appWin = null;
+
+        do {
+            if (retryCount++ > 0) {
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                }
             }
-            final DisplayInfo displayInfo = displayContent.getDisplayInfo();
-            dw = displayInfo.logicalWidth;
-            dh = displayInfo.logicalHeight;
-
-            int aboveAppLayer = mPolicy.windowTypeToLayerLw(TYPE_APPLICATION)
-                    * TYPE_LAYER_MULTIPLIER + TYPE_LAYER_OFFSET;
-            aboveAppLayer += TYPE_LAYER_MULTIPLIER;
-
-            boolean isImeTarget = mInputMethodTarget != null
-                    && mInputMethodTarget.mAppToken != null
-                    && mInputMethodTarget.mAppToken.appToken != null
-                    && mInputMethodTarget.mAppToken.appToken.asBinder() == appToken;
-
-            // Figure out the part of the screen that is actually the app.
-            boolean including = false;
-            final WindowList windows = displayContent.getWindowList();
-            for (int i = windows.size() - 1; i >= 0; i--) {
-                WindowState ws = windows.get(i);
-                if (!ws.mHasSurface) {
-                    continue;
+            synchronized(mWindowMap) {
+                final DisplayContent displayContent = getDisplayContentLocked(displayId);
+                if (displayContent == null) {
+                    return null;
                 }
-                if (ws.mLayer >= aboveAppLayer) {
-                    continue;
-                }
-                // When we will skip windows: when we are not including
-                // ones behind a window we didn't skip, and we are actually
-                // taking a screenshot of a specific app.
-                if (!including && appToken != null) {
-                    // Also, we can possibly skip this window if it is not
-                    // an IME target or the application for the screenshot
-                    // is not the current IME target.
-                    if (!ws.mIsImWindow || !isImeTarget) {
-                        // And finally, this window is of no interest if it
-                        // is not associated with the screenshot app.
-                        if (ws.mAppToken == null || ws.mAppToken.token != appToken) {
-                            continue;
+                final DisplayInfo displayInfo = displayContent.getDisplayInfo();
+                dw = displayInfo.logicalWidth;
+                dh = displayInfo.logicalHeight;
+
+                int aboveAppLayer = mPolicy.windowTypeToLayerLw(TYPE_APPLICATION)
+                        * TYPE_LAYER_MULTIPLIER + TYPE_LAYER_OFFSET;
+                aboveAppLayer += TYPE_LAYER_MULTIPLIER;
+
+                boolean isImeTarget = mInputMethodTarget != null
+                        && mInputMethodTarget.mAppToken != null
+                        && mInputMethodTarget.mAppToken.appToken != null
+                        && mInputMethodTarget.mAppToken.appToken.asBinder() == appToken;
+
+                // Figure out the part of the screen that is actually the app.
+                boolean including = false;
+                appWin = null;
+                final WindowList windows = displayContent.getWindowList();
+                for (int i = windows.size() - 1; i >= 0; i--) {
+                    WindowState ws = windows.get(i);
+                    if (!ws.mHasSurface) {
+                        continue;
+                    }
+                    if (ws.mLayer >= aboveAppLayer) {
+                        continue;
+                    }
+                    // When we will skip windows: when we are not including
+                    // ones behind a window we didn't skip, and we are actually
+                    // taking a screenshot of a specific app.
+                    if (!including && appToken != null) {
+                        // Also, we can possibly skip this window if it is not
+                        // an IME target or the application for the screenshot
+                        // is not the current IME target.
+                        if (!ws.mIsImWindow || !isImeTarget) {
+                            // And finally, this window is of no interest if it
+                            // is not associated with the screenshot app.
+                            if (ws.mAppToken == null || ws.mAppToken.token != appToken) {
+                                continue;
+                            }
+                            appWin = ws;
+                        }
+                    }
+
+                    // We keep on including windows until we go past a full-screen
+                    // window.
+                    boolean fullscreen = ws.isFullscreen(dw, dh);
+                    including = !ws.mIsImWindow && !fullscreen;
+
+                    final WindowStateAnimator winAnim = ws.mWinAnimator;
+                    if (maxLayer < winAnim.mSurfaceLayer) {
+                        maxLayer = winAnim.mSurfaceLayer;
+                    }
+
+                    // Don't include wallpaper in bounds calculation
+                    if (!ws.mIsWallpaper) {
+                        final Rect wf = ws.mFrame;
+                        final Rect cr = ws.mContentInsets;
+                        int left = wf.left + cr.left;
+                        int top = wf.top + cr.top;
+                        int right = wf.right - cr.right;
+                        int bottom = wf.bottom - cr.bottom;
+                        frame.union(left, top, right, bottom);
+                    }
+
+                    if (ws.mAppToken != null && ws.mAppToken.token == appToken) {
+                        if (minLayer > ws.mWinAnimator.mSurfaceLayer) {
+                            minLayer = ws.mWinAnimator.mSurfaceLayer;
+                        }
+                        if (ws.isDisplayedLw()) {
+                            screenshotReady = true;
+                        }
+                        if (fullscreen) {
+                            // No point in continuing down through windows.
+                            break;
                         }
                     }
                 }
 
-                // We keep on including windows until we go past a full-screen
-                // window.
-                including = !ws.mIsImWindow && !ws.isFullscreen(dw, dh);
-
-                if (maxLayer < ws.mWinAnimator.mSurfaceLayer) {
-                    maxLayer = ws.mWinAnimator.mSurfaceLayer;
+                if (appToken != null && appWin == null) {
+                    // Can't find a window to snapshot.
+                    if (DEBUG_SCREENSHOT) Slog.i(TAG,
+                            "Screenshot: Couldn't find a surface matching " + appToken);
+                    return null;
+                }
+                if (!screenshotReady) {
+                    // Delay and hope that window gets drawn.
+                    if (DEBUG_SCREENSHOT) Slog.i(TAG, "Screenshot: No image ready for " + appToken
+                            + ", " + appWin + " drawState=" + appWin.mWinAnimator.mDrawState);
+                    continue;
                 }
 
-                // Don't include wallpaper in bounds calculation
-                if (!ws.mIsWallpaper) {
-                    final Rect wf = ws.mFrame;
-                    final Rect cr = ws.mContentInsets;
-                    int left = wf.left + cr.left;
-                    int top = wf.top + cr.top;
-                    int right = wf.right - cr.right;
-                    int bottom = wf.bottom - cr.bottom;
-                    frame.union(left, top, right, bottom);
+                // Constrain frame to the screen size.
+                frame.intersect(0, 0, dw, dh);
+
+                if (frame.isEmpty() || maxLayer == 0) {
+                    if (DEBUG_SCREENSHOT) Slog.i(TAG, "Screenshot of " + appToken
+                            + ": returning null frame=" + frame.toShortString() + " maxLayer="
+                            + maxLayer);
+                    return null;
                 }
-            }
-            Binder.restoreCallingIdentity(ident);
 
-            // Constrain frame to the screen size.
-            frame.intersect(0, 0, dw, dh);
+                // The screenshot API does not apply the current screen rotation.
+                rot = getDefaultDisplayContentLocked().getDisplay().getRotation();
+                int fw = frame.width();
+                int fh = frame.height();
 
-            if (frame.isEmpty() || maxLayer == 0) {
-                return null;
-            }
-
-            // The screenshot API does not apply the current screen rotation.
-            rot = getDefaultDisplayContentLocked().getDisplay().getRotation();
-            int fw = frame.width();
-            int fh = frame.height();
-
-            // Constrain thumbnail to smaller of screen width or height. Assumes aspect
-            // of thumbnail is the same as the screen (in landscape) or square.
-            float targetWidthScale = width / (float) fw;
-            float targetHeightScale = height / (float) fh;
-            if (dw <= dh) {
-                scale = targetWidthScale;
-                // If aspect of thumbnail is the same as the screen (in landscape),
-                // select the slightly larger value so we fill the entire bitmap
-                if (targetHeightScale > scale && (int) (targetHeightScale * fw) == width) {
-                    scale = targetHeightScale;
-                }
-            } else {
-                scale = targetHeightScale;
-                // If aspect of thumbnail is the same as the screen (in landscape),
-                // select the slightly larger value so we fill the entire bitmap
-                if (targetWidthScale > scale && (int) (targetWidthScale * fh) == height) {
+                // Constrain thumbnail to smaller of screen width or height. Assumes aspect
+                // of thumbnail is the same as the screen (in landscape) or square.
+                float targetWidthScale = width / (float) fw;
+                float targetHeightScale = height / (float) fh;
+                if (dw <= dh) {
                     scale = targetWidthScale;
+                    // If aspect of thumbnail is the same as the screen (in landscape),
+                    // select the slightly larger value so we fill the entire bitmap
+                    if (targetHeightScale > scale && (int) (targetHeightScale * fw) == width) {
+                        scale = targetHeightScale;
+                    }
+                } else {
+                    scale = targetHeightScale;
+                    // If aspect of thumbnail is the same as the screen (in landscape),
+                    // select the slightly larger value so we fill the entire bitmap
+                    if (targetWidthScale > scale && (int) (targetWidthScale * fh) == height) {
+                        scale = targetWidthScale;
+                    }
                 }
-            }
 
-            // The screen shot will contain the entire screen.
-            dw = (int)(dw*scale);
-            dh = (int)(dh*scale);
-            if (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270) {
-                int tmp = dw;
-                dw = dh;
-                dh = tmp;
-                rot = (rot == Surface.ROTATION_90) ? Surface.ROTATION_270 : Surface.ROTATION_90;
-            }
-            if (DEBUG_SCREENSHOT) {
-                Slog.i(TAG, "Screenshot: " + dw + "x" + dh + " from 0 to " + maxLayer);
-                for (int i = 0; i < windows.size(); i++) {
-                    WindowState win = windows.get(i);
-                    Slog.i(TAG, win + ": " + win.mLayer
-                            + " animLayer=" + win.mWinAnimator.mAnimLayer
-                            + " surfaceLayer=" + win.mWinAnimator.mSurfaceLayer);
+                // The screen shot will contain the entire screen.
+                dw = (int)(dw*scale);
+                dh = (int)(dh*scale);
+                if (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270) {
+                    int tmp = dw;
+                    dw = dh;
+                    dh = tmp;
+                    rot = (rot == Surface.ROTATION_90) ? Surface.ROTATION_270 : Surface.ROTATION_90;
                 }
+                if (DEBUG_SCREENSHOT) {
+                    Slog.i(TAG, "Screenshot: " + dw + "x" + dh + " from " + minLayer + " to "
+                            + maxLayer + " appToken=" + appToken);
+                    for (int i = 0; i < windows.size(); i++) {
+                        WindowState win = windows.get(i);
+                        Slog.i(TAG, win + ": " + win.mLayer
+                                + " animLayer=" + win.mWinAnimator.mAnimLayer
+                                + " surfaceLayer=" + win.mWinAnimator.mSurfaceLayer);
+                    }
+                }
+                rawss = SurfaceControl.screenshot(dw, dh, minLayer, maxLayer);
             }
-            rawss = SurfaceControl.screenshot(dw, dh, 0, maxLayer);
+        } while (!screenshotReady && retryCount <= MAX_SCREENSHOT_RETRIES);
+        if (DEBUG_SCREENSHOT && retryCount > MAX_SCREENSHOT_RETRIES) {
+            Slog.i(TAG, "Screenshot max retries " + retryCount + " of " + appToken + " appWin="
+                    + (appWin == null ? "null" : (appWin + " drawState="
+                            + appWin.mWinAnimator.mDrawState)));
         }
 
         if (rawss == null) {
@@ -5417,6 +5481,23 @@
         canvas.drawBitmap(rawss, matrix, null);
         canvas.setBitmap(null);
 
+        if (DEBUG_SCREENSHOT) {
+            // TEST IF IT's ALL BLACK
+            int[] buffer = new int[bm.getWidth() * bm.getHeight()];
+            bm.getPixels(buffer, 0, bm.getWidth(), 0, 0, bm.getWidth(), bm.getHeight());
+            boolean allBlack = true;
+            for (int i = 0; i < buffer.length; i++) {
+                if (buffer[i] != Color.BLACK) {
+                    allBlack = false;
+                    break;
+                }
+            }
+            if (allBlack) {
+                Slog.i(TAG, "Screenshot " + appWin + " was all black! mSurfaceLayer=" +
+                        (appWin != null ? appWin.mWinAnimator.mSurfaceLayer : "null"));
+            }
+        }
+
         rawss.recycle();
         return bm;
     }
@@ -7210,6 +7291,7 @@
         return false;
     }
 
+    @Override
     public void getInitialDisplaySize(int displayId, Point size) {
         synchronized (mWindowMap) {
             final DisplayContent displayContent = getDisplayContentLocked(displayId);
@@ -7223,6 +7305,19 @@
     }
 
     @Override
+    public void getBaseDisplaySize(int displayId, Point size) {
+        synchronized (mWindowMap) {
+            final DisplayContent displayContent = getDisplayContentLocked(displayId);
+            if (displayContent != null) {
+                synchronized(displayContent.mDisplaySizeLock) {
+                    size.x = displayContent.mBaseDisplayWidth;
+                    size.y = displayContent.mBaseDisplayHeight;
+                }
+            }
+        }
+    }
+
+    @Override
     public void setForcedDisplaySize(int displayId, int width, int height) {
         if (mContext.checkCallingOrSelfPermission(
                 android.Manifest.permission.WRITE_SECURE_SETTINGS) !=
@@ -7325,6 +7420,32 @@
     }
 
     @Override
+    public int getInitialDisplayDensity(int displayId) {
+        synchronized (mWindowMap) {
+            final DisplayContent displayContent = getDisplayContentLocked(displayId);
+            if (displayContent != null) {
+                synchronized(displayContent.mDisplaySizeLock) {
+                    return displayContent.mInitialDisplayDensity;
+                }
+            }
+        }
+        return -1;
+    }
+
+    @Override
+    public int getBaseDisplayDensity(int displayId) {
+        synchronized (mWindowMap) {
+            final DisplayContent displayContent = getDisplayContentLocked(displayId);
+            if (displayContent != null) {
+                synchronized(displayContent.mDisplaySizeLock) {
+                    return displayContent.mBaseDisplayDensity;
+                }
+            }
+        }
+        return -1;
+    }
+
+    @Override
     public void setForcedDisplayDensity(int displayId, int density) {
         if (mContext.checkCallingOrSelfPermission(
                 android.Manifest.permission.WRITE_SECURE_SETTINGS) !=
@@ -7404,6 +7525,7 @@
         performLayoutAndPlaceSurfacesLocked();
     }
 
+    @Override
     public void setOverscan(int displayId, int left, int top, int right, int bottom) {
         if (mContext.checkCallingOrSelfPermission(
                 android.Manifest.permission.WRITE_SECURE_SETTINGS) !=
diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
index 7ef1485..2e309be 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerTest.java
@@ -66,8 +66,8 @@
                     && !user.isPrimary()) {
                 found = true;
                 Bundle restrictions = mUserManager.getUserRestrictions(user.getUserHandle());
-                assertTrue("New user should have ALLOW_CONFIG_WIFI =true by default",
-                        restrictions.getBoolean(UserManager.ALLOW_CONFIG_WIFI));
+                assertFalse("New user should have DISALLOW_CONFIG_WIFI =false by default",
+                        restrictions.getBoolean(UserManager.DISALLOW_CONFIG_WIFI));
             }
         }
         assertTrue(found);
@@ -147,13 +147,13 @@
         List<UserInfo> users = mUserManager.getUsers();
         if (users.size() > 1) {
             Bundle restrictions = new Bundle();
-            restrictions.putBoolean(UserManager.ALLOW_INSTALL_APPS, false);
-            restrictions.putBoolean(UserManager.ALLOW_CONFIG_WIFI, true);
+            restrictions.putBoolean(UserManager.DISALLOW_INSTALL_APPS, true);
+            restrictions.putBoolean(UserManager.DISALLOW_CONFIG_WIFI, false);
             mUserManager.setUserRestrictions(restrictions, new UserHandle(users.get(1).id));
             Bundle stored = mUserManager.getUserRestrictions(new UserHandle(users.get(1).id));
-            assertEquals(stored.getBoolean(UserManager.ALLOW_CONFIG_WIFI), true);
-            assertEquals(stored.getBoolean(UserManager.ALLOW_UNINSTALL_APPS), true);
-            assertEquals(stored.getBoolean(UserManager.ALLOW_INSTALL_APPS), false);
+            assertEquals(stored.getBoolean(UserManager.DISALLOW_CONFIG_WIFI), false);
+            assertEquals(stored.getBoolean(UserManager.DISALLOW_UNINSTALL_APPS), false);
+            assertEquals(stored.getBoolean(UserManager.DISALLOW_INSTALL_APPS), true);
         }
     }
 
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index 80c985f..cacafd4 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -30,10 +30,11 @@
      * DISCONNECTING: Connection.disconnect() has been called, but PDP
      *                context is not yet deactivated
      * FAILED: data connection fail for all apns settings
+     * RETRYING: data connection failed but we're going to retry.
      *
      * getDataConnectionState() maps State to DataState
      *      FAILED or IDLE : DISCONNECTED
-     *      CONNECTING or SCANNING: CONNECTING
+     *      RETRYING or CONNECTING or SCANNING: CONNECTING
      *      CONNECTED : CONNECTED or DISCONNECTING
      */
     public enum State {
@@ -42,7 +43,8 @@
         SCANNING,
         CONNECTED,
         DISCONNECTING,
-        FAILED
+        FAILED,
+        RETRYING
     }
 
     public enum Activity {
@@ -89,6 +91,8 @@
     public static final int CMD_SET_DEPENDENCY_MET = BASE + 31;
     public static final int CMD_SET_POLICY_DATA_ENABLE = BASE + 32;
     public static final int EVENT_ICC_CHANGED = BASE + 33;
+    public static final int EVENT_DISCONNECT_DC_RETRYING = BASE + 34;
+    public static final int EVENT_DATA_SETUP_COMPLETE_ERROR = BASE + 35;
 
     /***** Constants *****/
 
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index dffb617..62f6aff 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -15,6 +15,8 @@
  */
 package com.android.tests.applaunch;
 
+import android.accounts.Account;
+import android.accounts.AccountManager;
 import android.app.ActivityManager;
 import android.app.ActivityManager.ProcessErrorStateInfo;
 import android.app.ActivityManagerNative;
@@ -33,9 +35,11 @@
 import android.util.Log;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * This test is intended to measure the time it takes for the apps to start.
@@ -52,6 +56,9 @@
     private static final String TAG = AppLaunch.class.getSimpleName();
     private static final String KEY_APPS = "apps";
     private static final String KEY_LAUNCH_ITERATIONS = "launch_iterations";
+    // optional parameter: comma separated list of required account types before proceeding
+    // with the app launch
+    private static final String KEY_REQUIRED_ACCOUNTS = "required_accounts";
     private static final int INITIAL_LAUNCH_IDLE_TIMEOUT = 7500; //7.5s to allow app to idle
     private static final int POST_LAUNCH_IDLE_TIMEOUT = 750; //750ms idle for non initial launches
     private static final int BETWEEN_LAUNCH_SLEEP_TIMEOUT = 2000; //2s between launching apps
@@ -63,6 +70,7 @@
     private IActivityManager mAm;
     private int mLaunchIterations = 10;
     private Bundle mResult = new Bundle();
+    private Set<String> mRequiredAccounts;
 
     public void testMeasureStartUpTime() throws RemoteException, NameNotFoundException {
         InstrumentationTestRunner instrumentation =
@@ -72,6 +80,7 @@
 
         createMappings();
         parseArgs(args);
+        checkAccountSignIn();
 
         // do initial app launch, without force stopping
         for (String app : mNameToResultKey.keySet()) {
@@ -140,6 +149,13 @@
             mNameToResultKey.put(parts[0], parts[1]);
             mNameToLaunchTime.put(parts[0], 0L);
         }
+        String requiredAccounts = args.getString(KEY_REQUIRED_ACCOUNTS);
+        if (requiredAccounts != null) {
+            mRequiredAccounts = new HashSet<String>();
+            for (String accountType : requiredAccounts.split(",")) {
+                mRequiredAccounts.add(accountType);
+            }
+        }
     }
 
     private void createMappings() {
@@ -204,6 +220,37 @@
         return result.thisTime;
     }
 
+    private void checkAccountSignIn() {
+        // ensure that the device has the required account types before starting test
+        // e.g. device must have a valid Google account sign in to measure a meaningful launch time
+        // for Gmail
+        if (mRequiredAccounts == null || mRequiredAccounts.isEmpty()) {
+            return;
+        }
+        final AccountManager am =
+                (AccountManager) getInstrumentation().getTargetContext().getSystemService(
+                        Context.ACCOUNT_SERVICE);
+        Account[] accounts = am.getAccounts();
+        // use set here in case device has multiple accounts of the same type
+        Set<String> foundAccounts = new HashSet<String>();
+        for (Account account : accounts) {
+            if (mRequiredAccounts.contains(account.type)) {
+                foundAccounts.add(account.type);
+            }
+        }
+        // check if account type matches, if not, fail test with message on what account types
+        // are missing
+        if (mRequiredAccounts.size() != foundAccounts.size()) {
+            mRequiredAccounts.removeAll(foundAccounts);
+            StringBuilder sb = new StringBuilder("Device missing these accounts:");
+            for (String account : mRequiredAccounts) {
+                sb.append(' ');
+                sb.append(account);
+            }
+            fail(sb.toString());
+        }
+    }
+
     private void closeApp(String appName, boolean forceStopApp) {
         Intent homeIntent = new Intent(Intent.ACTION_MAIN);
         homeIntent.addCategory(Intent.CATEGORY_HOME);
diff --git a/tests/BiDiTests/res/layout/canvas.xml b/tests/BiDiTests/res/layout/canvas.xml
deleted file mode 100644
index 0319a83..0000000
--- a/tests/BiDiTests/res/layout/canvas.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@+id/canvas"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-
-    <LinearLayout android:orientation="vertical"
-                  android:layout_width="match_parent"
-                  android:layout_height="match_parent">
-
-        <SeekBar android:id="@+id/seekbar"
-                 android:layout_height="wrap_content"
-                 android:layout_width="match_parent"
-                />
-
-        <view class="com.android.bidi.BiDiTestView"
-              android:id="@+id/testview"
-              android:layout_width="match_parent"
-              android:layout_height="wrap_content"
-              android:background="#FF0000"
-                />
-
-    </LinearLayout>
-
-</FrameLayout>
\ No newline at end of file
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
index 209597e..b88a885 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java
@@ -101,7 +101,6 @@
 
         addItem(result, "Basic", BiDiTestBasic.class, R.id.basic);
 
-        addItem(result, "Canvas", BiDiTestCanvas.class, R.id.canvas);
         addItem(result, "Canvas2", BiDiTestCanvas2.class, R.id.canvas2);
 
         addItem(result, "TextView LTR", BiDiTestTextViewLtr.class, R.id.textview_ltr);
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
deleted file mode 100644
index 33ed731..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestCanvas.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2011 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.bidi;
-
-import android.app.Fragment;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.SeekBar;
-
-import static com.android.bidi.BiDiTestConstants.FONT_MAX_SIZE;
-import static com.android.bidi.BiDiTestConstants.FONT_MIN_SIZE;
-
-public class BiDiTestCanvas extends Fragment {
-
-    static final int INIT_TEXT_SIZE = (FONT_MAX_SIZE - FONT_MIN_SIZE) / 2;
-
-    private BiDiTestView testView;
-    private SeekBar textSizeSeekBar;
-    private View currentView;
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        currentView = inflater.inflate(R.layout.canvas, container, false);
-        return currentView;
-    }
-
-    @Override
-    public void onViewCreated(View view, Bundle savedInstanceState) {
-        super.onViewCreated(view, savedInstanceState);
-
-        testView = (BiDiTestView) currentView.findViewById(R.id.testview);
-        testView.setCurrentTextSize(INIT_TEXT_SIZE);
-
-        textSizeSeekBar = (SeekBar) currentView.findViewById(R.id.seekbar);
-        textSizeSeekBar.setProgress(INIT_TEXT_SIZE);
-        textSizeSeekBar.setMax(FONT_MAX_SIZE - FONT_MIN_SIZE);
-
-        textSizeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-                testView.setCurrentTextSize(FONT_MIN_SIZE + progress);
-            }
-
-            public void onStartTrackingTouch(SeekBar seekBar) {
-            }
-
-            public void onStopTrackingTouch(SeekBar seekBar) {
-            }
-        });
-    }
-}
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
deleted file mode 100644
index 0b1974a..0000000
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2011 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.bidi;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.text.TextPaint;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.View;
-
-public class BiDiTestView extends View {
-
-    private static final String TAG = "BiDiTestView";
-
-    private static final int BORDER_PADDING = 4;
-    private static final int TEXT_PADDING = 16;
-    private static final int TEXT_SIZE = 16;
-    private static final int ORIGIN = 80;
-
-    private static final float DEFAULT_ITALIC_SKEW_X = -0.25f;
-
-    private Rect rect = new Rect();
-
-    private String NORMAL_TEXT;
-    private String NORMAL_LONG_TEXT;
-    private String NORMAL_LONG_TEXT_2;
-    private String NORMAL_LONG_TEXT_3;
-    private String ITALIC_TEXT;
-    private String BOLD_TEXT;
-    private String BOLD_ITALIC_TEXT;
-    private String ARABIC_TEXT;
-    private String CHINESE_TEXT;
-    private String MIXED_TEXT_1;
-    private String HEBREW_TEXT;
-    private String RTL_TEXT;
-    private String THAI_TEXT;
-
-    private int currentTextSize;
-
-    public BiDiTestView(Context context) {
-        super(context);
-        init(context);
-    }
-
-    public BiDiTestView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        init(context);
-    }
-
-    public BiDiTestView(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        init(context);
-    }
-
-    private void init(Context context) {
-        NORMAL_TEXT = context.getString(R.string.normal_text);
-        NORMAL_LONG_TEXT = context.getString(R.string.normal_long_text);
-        NORMAL_LONG_TEXT_2 = context.getString(R.string.normal_long_text_2);
-        NORMAL_LONG_TEXT_3 = context.getString(R.string.normal_long_text_3);
-        ITALIC_TEXT = context.getString(R.string.italic_text);
-        BOLD_TEXT = context.getString(R.string.bold_text);
-        BOLD_ITALIC_TEXT = context.getString(R.string.bold_italic_text);
-        ARABIC_TEXT = context.getString(R.string.arabic_text);
-        CHINESE_TEXT = context.getString(R.string.chinese_text);
-        MIXED_TEXT_1 = context.getString(R.string.mixed_text_1);
-        HEBREW_TEXT = context.getString(R.string.hebrew_text);
-        RTL_TEXT = context.getString(R.string.rtl);
-        THAI_TEXT = context.getString(R.string.pointer_location);
-    }
-
-    public void setCurrentTextSize(int size) {
-        currentTextSize = size;
-        invalidate();
-    }
-
-    @Override
-    public void onDraw(Canvas canvas) {
-        drawInsideRect(canvas, new Paint(), Color.BLACK);
-
-        int deltaX = 0;
-
-        deltaX  = testString(canvas, NORMAL_TEXT, ORIGIN, ORIGIN,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        deltaX += testString(canvas, ITALIC_TEXT, ORIGIN + deltaX, ORIGIN,
-                true, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        deltaX += testString(canvas, BOLD_TEXT, ORIGIN + deltaX, ORIGIN,
-                false, true,  Paint.DIRECTION_LTR, currentTextSize);
-
-        deltaX += testString(canvas, BOLD_ITALIC_TEXT, ORIGIN + deltaX, ORIGIN,
-                true, true,  Paint.DIRECTION_LTR, currentTextSize);
-
-        // Test with a long string
-        deltaX = testString(canvas, NORMAL_LONG_TEXT, ORIGIN, ORIGIN + 2 * currentTextSize,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        // Test with a long string
-        deltaX = testString(canvas, NORMAL_LONG_TEXT_2, ORIGIN, ORIGIN + 4 * currentTextSize,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        // Test with a long string
-        deltaX = testString(canvas, NORMAL_LONG_TEXT_3, ORIGIN, ORIGIN + 6 * currentTextSize,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        // Test Arabic ligature
-        deltaX = testString(canvas, ARABIC_TEXT, ORIGIN, ORIGIN + 8 * currentTextSize,
-                false, false,  Paint.DIRECTION_RTL, currentTextSize);
-
-        // Test Chinese
-        deltaX = testString(canvas, CHINESE_TEXT, ORIGIN, ORIGIN + 10 * currentTextSize,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        // Test Mixed (English and Arabic)
-        deltaX = testString(canvas, MIXED_TEXT_1, ORIGIN, ORIGIN + 12 * currentTextSize,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-
-        // Test Hebrew
-        deltaX = testString(canvas, RTL_TEXT, ORIGIN, ORIGIN + 14 * currentTextSize,
-                false, false,  Paint.DIRECTION_RTL, currentTextSize);
-
-        // Test Thai
-        deltaX = testString(canvas, THAI_TEXT, ORIGIN, ORIGIN + 16 * currentTextSize,
-                false, false,  Paint.DIRECTION_LTR, currentTextSize);
-    }
-
-    private int testString(Canvas canvas, String text, int x, int y,
-            boolean isItalic, boolean isBold, int dir, int textSize) {
-
-        TextPaint paint = new TextPaint();
-        paint.setAntiAlias(true);
-
-        // Set paint properties
-        boolean oldFakeBold = paint.isFakeBoldText();
-        paint.setFakeBoldText(isBold);
-
-        float oldTextSkewX = paint.getTextSkewX();
-        if (isItalic) {
-            paint.setTextSkewX(DEFAULT_ITALIC_SKEW_X);
-        }
-
-        paint.setTextSize(textSize);
-        paint.setColor(Color.WHITE);
-        canvas.drawText(text, x, y, paint);
-
-        int length = text.length();
-        float[] advances = new float[length];
-        float textWidthHB = paint.getTextRunAdvances(text, 0, length, 0, length, dir, advances, 0);
-        setPaintDir(paint, dir);
-        float textWidthICU = paint.getTextRunAdvances(text, 0, length, 0, length, dir, advances, 0,
-                1 /* use ICU */);
-
-        logAdvances(text, textWidthHB, textWidthICU, advances);
-        drawMetricsAroundText(canvas, x, y, textWidthHB, textWidthICU, textSize, Color.RED, Color.GREEN);
-
-        // Restore old paint properties
-        paint.setFakeBoldText(oldFakeBold);
-        paint.setTextSkewX(oldTextSkewX);
-
-        return (int) Math.ceil(textWidthHB) + TEXT_PADDING;
-    }
-
-    private void setPaintDir(Paint paint, int dir) {
-        Log.v(TAG, "Setting Paint dir=" + dir);
-        paint.setBidiFlags(dir);
-    }
-
-    private void drawInsideRect(Canvas canvas, Paint paint, int color) {
-        paint.setColor(color);
-        int width = getWidth();
-        int height = getHeight();
-        rect.set(BORDER_PADDING, BORDER_PADDING, width - BORDER_PADDING, height - BORDER_PADDING);
-        canvas.drawRect(rect, paint);
-    }
-
-    private void drawMetricsAroundText(Canvas canvas, int x, int y, float textWidthHB,
-            float textWidthICU, int textSize, int color, int colorICU) {
-        Paint paint = new Paint();
-        paint.setColor(color);
-        canvas.drawLine(x, y - textSize, x, y + 8, paint);
-        canvas.drawLine(x, y + 8, x + textWidthHB, y + 8, paint);
-        canvas.drawLine(x + textWidthHB, y - textSize, x + textWidthHB, y + 8, paint);
-        paint.setColor(colorICU);
-        canvas.drawLine(x + textWidthICU, y - textSize, x + textWidthICU, y + 8, paint);
-    }
-
-    private void logAdvances(String text, float textWidth, float textWidthICU, float[] advances) {
-        Log.v(TAG, "Advances for text: " + text + " total= " + textWidth + " - totalICU= " + textWidthICU);
-//        int length = advances.length;
-//        for(int n=0; n<length; n++){
-//            Log.v(TAG, "adv[" + n + "]=" + advances[n]);
-//        }
-    }
-}
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java
index 02cb4b6..1847f43 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java
@@ -57,6 +57,7 @@
         private Paint mLargePaint;
         private BitmapShader mScaled2Shader;
         private ColorFilter mColorFilter;
+        private final Matrix mMtx1;
 
         ShadersView(Context c) {
             super(c);
@@ -70,7 +71,7 @@
             mScaledShader = new BitmapShader(texture, Shader.TileMode.MIRROR,
                     Shader.TileMode.MIRROR);
             Matrix m2 = new Matrix();
-            m2.setScale(0.5f, 0.5f);
+            m2.setScale(0.1f, 0.1f);
             mScaledShader.setLocalMatrix(m2);
             
             mScaled2Shader = new BitmapShader(texture, Shader.TileMode.MIRROR,
@@ -81,12 +82,20 @@
 
             mHorGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth, 0.0f,
                     Color.RED, 0x7f00ff00, Shader.TileMode.CLAMP);
-            
+            Matrix m4 = new Matrix();
+            m4.setScale(0.5f, 0.5f);
+            mHorGradient.setLocalMatrix(m4);
+
             mVertGradient = new LinearGradient(0.0f, 0.0f, 0.0f, mDrawHeight / 2.0f,
                     Color.YELLOW, Color.MAGENTA, Shader.TileMode.MIRROR);
 
             mComposeShader = new ComposeShader(mScaledShader, mHorGradient,
                     PorterDuff.Mode.SRC_OVER);
+            mMtx1 = new Matrix();
+            mMtx1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f);
+            mMtx1.postRotate(45, 0, 0);
+            mComposeShader.setLocalMatrix(mMtx1);
+
             mCompose2Shader = new ComposeShader(mHorGradient, mScaledShader,
                     PorterDuff.Mode.SRC_OUT);
 
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ShapesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ShapesActivity.java
index 97e5526..61dca78 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/ShapesActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ShapesActivity.java
@@ -20,6 +20,7 @@
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Paint;
+import android.graphics.Path;
 import android.graphics.RectF;
 import android.os.Bundle;
 import android.view.View;
@@ -34,12 +35,13 @@
     }
 
     static class ShapesView extends View {
-        private Paint mNormalPaint;
-        private Paint mStrokePaint;
-        private Paint mFillPaint;
-        private RectF mRect;
-        private RectF mOval;
-        private RectF mArc;
+        private final Paint mNormalPaint;
+        private final Paint mStrokePaint;
+        private final Paint mFillPaint;
+        private final RectF mRect;
+        private final RectF mOval;
+        private final RectF mArc;
+        private final Path mTriangle;
 
         ShapesView(Context c) {
             super(c);
@@ -65,6 +67,12 @@
 
             mOval = new RectF(0.0f, 0.0f, 80.0f, 45.0f);
             mArc = new RectF(0.0f, 0.0f, 100.0f, 120.0f);
+
+            mTriangle = new Path();
+            mTriangle.moveTo(0.0f, 90.0f);
+            mTriangle.lineTo(45.0f, 0.0f);
+            mTriangle.lineTo(90.0f, 90.0f);
+            mTriangle.close();
         }
 
         @Override
@@ -136,6 +144,17 @@
             canvas.translate(0.0f, 110.0f);
             canvas.drawArc(mArc, 30.0f, 100.0f, false, mFillPaint);
             canvas.restore();
+
+            canvas.save();
+            canvas.translate(50.0f, 400.0f);
+            canvas.drawPath(mTriangle, mNormalPaint);
+
+            canvas.translate(110.0f, 0.0f);
+            canvas.drawPath(mTriangle, mStrokePaint);
+
+            canvas.translate(110.0f, 0.0f);
+            canvas.drawPath(mTriangle, mFillPaint);
+            canvas.restore();
         }
     }
 }
diff --git a/tests/RenderScriptTests/Balls/Android.mk b/tests/RenderScriptTests/Balls/Android.mk
deleted file mode 100644
index 77281ce..0000000
--- a/tests/RenderScriptTests/Balls/Android.mk
+++ /dev/null
@@ -1,26 +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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RsBalls
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/Balls/AndroidManifest.xml b/tests/RenderScriptTests/Balls/AndroidManifest.xml
deleted file mode 100644
index 80e6b39..0000000
--- a/tests/RenderScriptTests/Balls/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.example.android.rs.balls">
-    <uses-sdk android:minSdkVersion="14" />
-    <application 
-        android:label="RsBalls"
-        android:icon="@drawable/test_pattern">
-        <activity android:name="Balls"
-                  android:screenOrientation="landscape">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/Balls/_index.html b/tests/RenderScriptTests/Balls/_index.html
deleted file mode 100644
index 8760485..0000000
--- a/tests/RenderScriptTests/Balls/_index.html
+++ /dev/null
@@ -1 +0,0 @@
-<p>A brute force physics simulation that renders many balls onto the screen and moves them according to user touch and gravity.</p>
\ No newline at end of file
diff --git a/tests/RenderScriptTests/Balls/res/drawable/flares.png b/tests/RenderScriptTests/Balls/res/drawable/flares.png
deleted file mode 100644
index 3a5c970..0000000
--- a/tests/RenderScriptTests/Balls/res/drawable/flares.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/Balls/res/drawable/test_pattern.png b/tests/RenderScriptTests/Balls/res/drawable/test_pattern.png
deleted file mode 100644
index e7d1455..0000000
--- a/tests/RenderScriptTests/Balls/res/drawable/test_pattern.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/Balls.java b/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/Balls.java
deleted file mode 100644
index 2c6558e..0000000
--- a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/Balls.java
+++ /dev/null
@@ -1,118 +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.example.android.rs.balls;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.view.View;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-
-public class Balls extends Activity implements SensorEventListener {
-    //EventListener mListener = new EventListener();
-
-    private static final String LOG_TAG = "libRS_jni";
-    private static final boolean DEBUG  = false;
-    private static final boolean LOG_ENABLED = false;
-
-    private BallsView mView;
-    private SensorManager mSensorManager;
-
-    // get the current looper (from your Activity UI thread for instance
-
-
-    public void onSensorChanged(SensorEvent event) {
-        //android.util.Log.d("rs", "sensor: " + event.sensor + ", x: " + event.values[0] + ", y: " + event.values[1] + ", z: " + event.values[2]);
-        synchronized (this) {
-            if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
-                if(mView != null) {
-                    mView.setAccel(event.values[0], event.values[1], event.values[2]);
-                }
-            }
-        }
-    }
-
-    public void onAccuracyChanged(Sensor sensor, int accuracy) {
-    }
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
-
-        // Create our Preview view and set it as the content of our
-        // Activity
-        mView = new BallsView(this);
-        setContentView(mView);
-    }
-
-    @Override
-    protected void onResume() {
-        mSensorManager.registerListener(this,
-                                        mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
-                                        SensorManager.SENSOR_DELAY_FASTEST);
-
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity looses focus
-        super.onResume();
-        mView.resume();
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        mView.pause();
-        onStop();
-    }
-
-    @Override
-    protected void onStop() {
-        mSensorManager.unregisterListener(this);
-        super.onStop();
-    }
-
-    static void log(String message) {
-        if (LOG_ENABLED) {
-            Log.v(LOG_TAG, message);
-        }
-    }
-
-
-}
-
diff --git a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/BallsRS.java b/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/BallsRS.java
deleted file mode 100644
index d9d182c..0000000
--- a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/BallsRS.java
+++ /dev/null
@@ -1,151 +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.example.android.rs.balls;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-
-
-public class BallsRS {
-    public static final int PART_COUNT = 4000;
-
-    public BallsRS() {
-    }
-
-    private Resources mRes;
-    private RenderScriptGL mRS;
-    private ScriptC_balls mScript;
-    private ScriptC_ball_physics mPhysicsScript;
-    private ProgramFragment mPFPoints;
-    private ScriptField_Point mPoints;
-    private ScriptField_VpConsts mVpConsts;
-    private ScriptField_BallGrid mGrid;
-    private ScriptField_Ball mBalls;
-    private Allocation mGridCache;
-
-    void updateProjectionMatrices() {
-        mVpConsts = new ScriptField_VpConsts(mRS, 1,
-                                             Allocation.USAGE_SCRIPT |
-                                             Allocation.USAGE_GRAPHICS_CONSTANTS);
-        ScriptField_VpConsts.Item i = new ScriptField_VpConsts.Item();
-        Matrix4f mvp = new Matrix4f();
-        mvp.loadOrtho(0, mRS.getWidth(), mRS.getHeight(), 0, -1, 1);
-        i.MVP = mvp;
-        mVpConsts.set(i, 0, true);
-    }
-
-    private void createProgramVertex() {
-        updateProjectionMatrices();
-
-        ProgramVertex.Builder sb = new ProgramVertex.Builder(mRS);
-        String t =  "varying vec4 varColor;\n" +
-                    "void main() {\n" +
-                    "  vec4 pos = vec4(0.0, 0.0, 0.0, 1.0);\n" +
-                    "  pos.xy = ATTRIB_position;\n" +
-                    "  gl_Position = UNI_MVP * pos;\n" +
-                    "  varColor = ATTRIB_color;\n" +
-                    "  gl_PointSize = 12.0;\n" +
-                    "}\n";
-        sb.setShader(t);
-        sb.addConstant(mVpConsts.getType());
-        sb.addInput(mPoints.getElement());
-        ProgramVertex pvs = sb.create();
-        pvs.bindConstants(mVpConsts.getAllocation(), 0);
-        mRS.bindProgramVertex(pvs);
-    }
-
-    private Allocation loadTexture(int id) {
-        final Allocation allocation =
-            Allocation.createFromBitmapResource(mRS, mRes,
-                id, Allocation.MipmapControl.MIPMAP_NONE,
-                Allocation.USAGE_GRAPHICS_TEXTURE);
-        return allocation;
-    }
-
-    ProgramStore BLEND_ADD_DEPTH_NONE(RenderScript rs) {
-        ProgramStore.Builder builder = new ProgramStore.Builder(rs);
-        builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
-        builder.setBlendFunc(ProgramStore.BlendSrcFunc.ONE, ProgramStore.BlendDstFunc.ONE);
-        builder.setDitherEnabled(false);
-        builder.setDepthMaskEnabled(false);
-        return builder.create();
-    }
-
-    private void createPF(int width, int height) {
-        ProgramFragmentFixedFunction.Builder pfb = new ProgramFragmentFixedFunction.Builder(mRS);
-        pfb.setPointSpriteTexCoordinateReplacement(true);
-        pfb.setTexture(ProgramFragmentFixedFunction.Builder.EnvMode.MODULATE,
-                           ProgramFragmentFixedFunction.Builder.Format.RGBA, 0);
-        pfb.setVaryingColor(true);
-        mPFPoints = pfb.create();
-    }
-
-    public void init(RenderScriptGL rs, Resources res, int width, int height) {
-        mRS = rs;
-        mRes = res;
-
-        createPF(width, height);
-
-        mPFPoints.bindTexture(loadTexture(R.drawable.flares), 0);
-
-        mPoints = new ScriptField_Point(mRS, PART_COUNT, Allocation.USAGE_SCRIPT);
-
-        Mesh.AllocationBuilder smb = new Mesh.AllocationBuilder(mRS);
-        smb.addVertexAllocation(mPoints.getAllocation());
-        smb.addIndexSetType(Mesh.Primitive.POINT);
-        Mesh smP = smb.create();
-
-        mGrid = ScriptField_BallGrid.create2D(mRS, (width + 99) / 100, (height + 99) / 100);
-        mGridCache = Allocation.createSized(mRS, Element.F32_2(mRS), PART_COUNT);
-        mBalls = new ScriptField_Ball(mRS, PART_COUNT, Allocation.USAGE_SCRIPT);
-
-        mPhysicsScript = new ScriptC_ball_physics(mRS);
-        mPhysicsScript.set_gGridCache(mGridCache);
-        mPhysicsScript.set_gBalls(mBalls.getAllocation());
-
-        mScript = new ScriptC_balls(mRS);
-        mScript.set_partMesh(smP);
-        mScript.set_physics_script(mPhysicsScript);
-        mScript.bind_point(mPoints);
-        mScript.bind_balls(mBalls);
-        mScript.set_gGrid(mGrid.getAllocation());
-        mScript.bind_gGridCache(mGridCache);
-
-        mScript.set_gPFPoints(mPFPoints);
-        createProgramVertex();
-
-        mRS.bindProgramStore(BLEND_ADD_DEPTH_NONE(mRS));
-
-        mPhysicsScript.set_gMinPos(new Float2(5, 5));
-        mPhysicsScript.set_gMaxPos(new Float2(width - 5, height - 5));
-        mPhysicsScript.set_gGrid(mGrid.getAllocation());
-
-        mScript.invoke_initParts(width, height);
-
-        mRS.bindRootScript(mScript);
-    }
-
-    public void newTouchPosition(float x, float y, float pressure, int id) {
-        mPhysicsScript.invoke_touch(x, y, pressure * mRS.getWidth() / 1280, id);
-    }
-
-    public void setAccel(float x, float y) {
-        mPhysicsScript.set_gGravityVector(new Float2(x, y));
-    }
-
-}
diff --git a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/BallsView.java b/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/BallsView.java
deleted file mode 100644
index 041782d..0000000
--- a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/BallsView.java
+++ /dev/null
@@ -1,116 +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.example.android.rs.balls;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class BallsView extends RSSurfaceView {
-
-    public BallsView(Context context) {
-        super(context);
-        //setFocusable(true);
-    }
-
-    private RenderScriptGL mRS;
-    private BallsRS mRender;
-
-    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
-        super.surfaceChanged(holder, format, w, h);
-        if (mRS == null) {
-            RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
-            mRS = createRenderScriptGL(sc);
-            mRS.setSurface(holder, w, h);
-            mRender = new BallsRS();
-            mRender.init(mRS, getResources(), w, h);
-        }
-        mRender.updateProjectionMatrices();
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        if(mRS != null) {
-            mRS = null;
-            destroyRenderScriptGL();
-        }
-    }
-
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev)
-    {
-        int act = ev.getActionMasked();
-        if (act == ev.ACTION_UP) {
-            mRender.newTouchPosition(0, 0, 0, ev.getPointerId(0));
-            return false;
-        } else if (act == MotionEvent.ACTION_POINTER_UP) {
-            // only one pointer going up, we can get the index like this
-            int pointerIndex = ev.getActionIndex();
-            int pointerId = ev.getPointerId(pointerIndex);
-            mRender.newTouchPosition(0, 0, 0, pointerId);
-            return false;
-        }
-        int count = ev.getHistorySize();
-        int pcount = ev.getPointerCount();
-
-        for (int p=0; p < pcount; p++) {
-            int id = ev.getPointerId(p);
-            mRender.newTouchPosition(ev.getX(p),
-                                     ev.getY(p),
-                                     ev.getPressure(p),
-                                     id);
-
-            for (int i=0; i < count; i++) {
-                mRender.newTouchPosition(ev.getHistoricalX(p, i),
-                                         ev.getHistoricalY(p, i),
-                                         ev.getHistoricalPressure(p, i),
-                                         id);
-            }
-        }
-        return true;
-    }
-
-    void setAccel(float x, float y, float z) {
-        if ((mRender == null) || (mRS == null)) {
-            return;
-        }
-        mRender.setAccel(x, -y);
-    }
-
-}
-
-
diff --git a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/ball_physics.rs b/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/ball_physics.rs
deleted file mode 100644
index 5b5d2e0..0000000
--- a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/ball_physics.rs
+++ /dev/null
@@ -1,155 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.balls)
-
-#include "balls.rsh"
-
-float2 gGravityVector = {0.f, 9.8f};
-
-float2 gMinPos = {0.f, 0.f};
-float2 gMaxPos = {1280.f, 700.f};
-
-static float2 touchPos[10];
-static float touchPressure[10];
-static const float gDT = 1.f / 30.f;
-
-rs_allocation gGrid;
-rs_allocation gGridCache;
-rs_allocation gBalls;
-
-float gScale = 1.f;
-
-void touch(float x, float y, float pressure, int id) {
-    if (id >= 10) {
-        return;
-    }
-
-    touchPos[id].x = x;
-    touchPos[id].y = y;
-    touchPressure[id] = pressure;
-}
-
-void root(Ball_t *ball, uint32_t x) {
-    float2 fv = 0;
-    float pressure = 0;
-    float2 pos = ball->position;
-    int2 gridPos[9];
-
-    gridPos[0] = convert_int2((ball->position / 100.f) /*- 0.4999f*/);
-    gridPos[1] = (int2){gridPos[0].x - 1, gridPos[0].y - 1};
-    gridPos[2] = (int2){gridPos[0].x + 0, gridPos[0].y - 1};
-    gridPos[3] = (int2){gridPos[0].x + 1, gridPos[0].y - 1};
-    gridPos[4] = (int2){gridPos[0].x - 1, gridPos[0].y};
-    gridPos[5] = (int2){gridPos[0].x + 1, gridPos[0].y};
-    gridPos[6] = (int2){gridPos[0].x - 1, gridPos[0].y + 1};
-    gridPos[7] = (int2){gridPos[0].x + 0, gridPos[0].y + 1};
-    gridPos[8] = (int2){gridPos[0].x + 1, gridPos[0].y + 1};
-
-    for (int gct=0; gct < 9; gct++) {
-        if ((gridPos[gct].x >= rsAllocationGetDimX(gGrid)) ||
-            (gridPos[gct].x < 0) ||
-            (gridPos[gct].y >= rsAllocationGetDimY(gGrid)) ||
-            (gridPos[gct].y < 0)) {
-            continue;
-        }
-        //rsDebug("grid ", gridPos[gct]);
-        const BallGrid_t *bg = (const BallGrid_t *)rsGetElementAt(gGrid, gridPos[gct].x, gridPos[gct].y);
-
-        for (int cidx = 0; cidx < bg->count; cidx++) {
-            float2 bcptr = rsGetElementAt_float2(gGridCache, bg->cacheIdx + cidx);
-            float2 vec = bcptr - pos;
-            float2 vec2 = vec * vec;
-            float len2 = vec2.x + vec2.y;
-
-            if ((len2 < 10000.f) && (len2 > 0.f)) {
-                float t = native_powr(len2, 1.5f) + 16.0f;
-                float2 pfv = (vec / t) * 16000.f;
-                pressure += length(pfv);
-                fv -= pfv;
-            }
-        }
-    }
-
-    //fv /= ball->size * ball->size * ball->size;
-    fv -= gGravityVector * 4.f * gScale;
-    fv *= gDT;
-
-    for (int i=0; i < 10; i++) {
-        if (touchPressure[i] > 0.1f) {
-            float2 vec = touchPos[i] - ball->position;
-            float2 vec2 = vec * vec;
-            float len2 = max(2.f, vec2.x + vec2.y);
-            float2 pfv = (vec / len2) * touchPressure[i] * 500.f * gScale;
-            pressure += length(pfv);
-            fv -= pfv;
-        }
-    }
-
-    ball->delta = (ball->delta * (1.f - 0.008f)) + fv;
-    ball->position = ball->position + (ball->delta * gDT);
-
-    const float wallForce = 400.f * gScale;
-    if (ball->position.x > (gMaxPos.x - 20.f)) {
-        float d = gMaxPos.x - ball->position.x;
-        if (d < 0.f) {
-            if (ball->delta.x > 0) {
-                ball->delta.x *= -0.7f;
-            }
-            ball->position.x = gMaxPos.x - 1.f;
-        } else {
-            ball->delta.x -= min(wallForce / (d * d), 10.f);
-        }
-    }
-
-    if (ball->position.x < (gMinPos.x + 20.f)) {
-        float d = ball->position.x - gMinPos.x;
-        if (d < 0.f) {
-            if (ball->delta.x < 0) {
-                ball->delta.x *= -0.7f;
-            }
-            ball->position.x = gMinPos.x + 1.f;
-        } else {
-            ball->delta.x += min(wallForce / (d * d), 10.f);
-        }
-    }
-
-    if (ball->position.y > (gMaxPos.y - 20.f)) {
-        float d = gMaxPos.y - ball->position.y;
-        if (d < 0.f) {
-            if (ball->delta.y > 0) {
-                ball->delta.y *= -0.7f;
-            }
-            ball->position.y = gMaxPos.y - 1.f;
-        } else {
-            ball->delta.y -= min(wallForce / (d * d), 10.f);
-        }
-    }
-
-    if (ball->position.y < (gMinPos.y + 20.f)) {
-        float d = ball->position.y - gMinPos.y;
-        if (d < 0.f) {
-            if (ball->delta.y < 0) {
-                ball->delta.y *= -0.7f;
-            }
-            ball->position.y = gMinPos.y + 1.f;
-        } else {
-            ball->delta.y += min(wallForce / (d * d * d), 10.f);
-        }
-    }
-
-    // low pressure ~500, high ~2500
-    pressure = max(pressure - 400.f, 0.f);
-    ball->pressure = pressure;
-
-    //rsDebug("p ", pressure);
-
-    float4 color = 1.f;
-    color.r = pow(pressure, 0.25f) / 12.f;
-    color.b = 1.f - color.r;
-    color.g = sin(pressure / 1500.f * 3.14f);
-    color.rgb = max(color.rgb, (float3)0);
-    color.rgb = normalize(color.rgb);
-    ball->color = rsPackColorTo8888(color);
-
-    //rsDebug("physics pos out", ball->position);
-}
-
diff --git a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/balls.rs b/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/balls.rs
deleted file mode 100644
index 9be9f38..0000000
--- a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/balls.rs
+++ /dev/null
@@ -1,106 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.balls)
-#include "rs_graphics.rsh"
-
-#include "balls.rsh"
-
-#pragma stateVertex(parent)
-#pragma stateStore(parent)
-
-rs_program_fragment gPFPoints;
-rs_mesh partMesh;
-
-rs_allocation gGrid;
-BallGrid_t *unused1;
-float2 *gGridCache;
-
-typedef struct __attribute__((packed, aligned(4))) Point {
-    float2 position;
-    uchar4 color;
-} Point_t;
-Point_t *point;
-
-typedef struct VpConsts {
-    rs_matrix4x4 MVP;
-} VpConsts_t;
-VpConsts_t *vpConstants;
-
-rs_script physics_script;
-
-
-void initParts(int w, int h)
-{
-    uint32_t dimX = rsAllocationGetDimX(rsGetAllocation(balls));
-
-    for (uint32_t ct=0; ct < dimX; ct++) {
-        balls[ct].position.x = rsRand(0.f, (float)w);
-        balls[ct].position.y = rsRand(0.f, (float)h);
-        balls[ct].delta.x = 0.f;
-        balls[ct].delta.y = 0.f;
-    }
-}
-
-int root() {
-    rsgClearColor(0.f, 0.f, 0.f, 1.f);
-
-    int2 gridDims = (int2){ rsAllocationGetDimX(gGrid),
-                            rsAllocationGetDimY(gGrid) };
-
-    rs_allocation ain = rsGetAllocation(balls);
-    int32_t dimX = rsAllocationGetDimX(ain);
-
-    // Binning
-    // Clear the particle list
-    for (uint32_t ct=0; ct < dimX; ct++) {
-        balls[ct].next = -1;
-    }
-
-    // Clear the grid
-    for (uint32_t y=0; y < gridDims.y; y++) {
-        for (uint32_t x=0; x < gridDims.x; x++) {
-            BallGrid_t *bg = (BallGrid_t *)rsGetElementAt(gGrid, x, y);
-            bg->count = 0;
-            bg->idx = -1;
-        }
-    }
-
-    // Create the particle list per grid
-    for (uint32_t ct=0; ct < dimX; ct++) {
-        int2 p = convert_int2(balls[ct].position / 100.f);
-        p.x = rsClamp(p.x, 0, (int)(gridDims.x-1));
-        p.y = rsClamp(p.y, 0, (int)(gridDims.y-1));
-        BallGrid_t *bg = (BallGrid_t *)rsGetElementAt(gGrid, p.x, p.y);
-        bg->count ++;
-        balls[ct].next = bg->idx;
-        bg->idx = ct;
-    }
-
-    // Create the sorted grid cache
-    uint32_t gridIdx = 0;
-    for (uint32_t y=0; y < gridDims.y; y++) {
-        for (uint32_t x=0; x < gridDims.x; x++) {
-            BallGrid_t *bg = (BallGrid_t *)rsGetElementAt(gGrid, x, y);
-            bg->cacheIdx = gridIdx;
-
-            int idx = bg->idx;
-            while (idx >= 0) {
-                const Ball_t * bPtr = &balls[idx];
-                gGridCache[gridIdx++] = bPtr->position;
-                idx = bPtr->next;
-            }
-        }
-    }
-
-
-    rsForEach(physics_script, ain, ain);
-
-    for (uint32_t ct=0; ct < dimX; ct++) {
-        point[ct].position = balls[ct].position;
-        point[ct].color = balls[ct].color;
-    }
-
-    rsgBindProgramFragment(gPFPoints);
-    rsgDrawMesh(partMesh);
-    return 1;
-}
-
diff --git a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/balls.rsh b/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/balls.rsh
deleted file mode 100644
index ebe23f8..0000000
--- a/tests/RenderScriptTests/Balls/src/com/example/android/rs/balls/balls.rsh
+++ /dev/null
@@ -1,19 +0,0 @@
-
-typedef struct __attribute__((packed, aligned(4))) Ball {
-    float2 delta;
-    float2 position;
-    uchar4 color;
-    float pressure;
-    //float size;
-    int32_t next;
-    //int arcID;
-    //float arcStr;
-} Ball_t;
-Ball_t *balls;
-
-
-typedef struct BallGrid {
-    int32_t idx;
-    int32_t count;
-    int32_t cacheIdx;
-} BallGrid_t;
diff --git a/tests/RenderScriptTests/ComputeBenchmark/Android.mk b/tests/RenderScriptTests/ComputeBenchmark/Android.mk
deleted file mode 100644
index 8d47e89..0000000
--- a/tests/RenderScriptTests/ComputeBenchmark/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RsComputeBenchmark
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/ComputeBenchmark/AndroidManifest.xml b/tests/RenderScriptTests/ComputeBenchmark/AndroidManifest.xml
deleted file mode 100644
index c8fcc17..0000000
--- a/tests/RenderScriptTests/ComputeBenchmark/AndroidManifest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.example.android.rs.computebench">
-
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-sdk android:minSdkVersion="17" />
-    <application android:label="_RS_Compute_Bench">
-        <activity android:name="ComputeBench">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/ComputeBenchmark/res/layout/main.xml b/tests/RenderScriptTests/ComputeBenchmark/res/layout/main.xml
deleted file mode 100644
index 9e9dab8..0000000
--- a/tests/RenderScriptTests/ComputeBenchmark/res/layout/main.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-    <ImageView
-        android:id="@+id/displayin"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-    <ImageView
-        android:id="@+id/displayout"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-</LinearLayout>
diff --git a/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/Benchmark.java b/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/Benchmark.java
deleted file mode 100644
index ec80719..0000000
--- a/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/Benchmark.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2012 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.example.android.rs.computebench;
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class Benchmark implements Runnable {
-    private final RenderScript mRS;
-    private ScriptC_compute_benchmark mScript;
-
-    public Benchmark(RenderScript rs, Resources res) {
-        mRS = rs;
-        mScript = new ScriptC_compute_benchmark(mRS, res, R.raw.compute_benchmark);
-    }
-
-    public void run() {
-        long t = java.lang.System.currentTimeMillis();
-        mScript.invoke_bench();
-        mRS.finish();
-        t = java.lang.System.currentTimeMillis() - t;
-        android.util.Log.v("ComputeBench", "Total benchmark took " + t + " ms");
-    }
-
-}
diff --git a/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/ComputeBench.java b/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/ComputeBench.java
deleted file mode 100644
index 2d3e843..0000000
--- a/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/ComputeBench.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 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.example.android.rs.computebench;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.renderscript.RenderScript;
-
-public class ComputeBench extends Activity {
-    private RenderScript mRS;
-    private Benchmark mBenchmark;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        mRS = RenderScript.create(this);
-
-        mBenchmark = new Benchmark(mRS, getResources());
-        mBenchmark.run();
-    }
-}
diff --git a/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs b/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
deleted file mode 100644
index 2ee56ec..0000000
--- a/tests/RenderScriptTests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
+++ /dev/null
@@ -1,407 +0,0 @@
-// Copyright (C) 2012 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.
-
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.computebench)
-
-// Test configuration (accessible from Java)
-uint priming_runs   = 1000000;
-uint timing_runs    = 5000000;
-
-// Reused variables
-
-static volatile int64_t bench_time;
-static float inv_timing_runs;
-
-#define DECL_VAR_SET(prefix)                \
-static volatile float prefix##_f_1 = 1;     \
-static volatile float2 prefix##_f_2 = 1;    \
-static volatile float3 prefix##_f_3 = 1;    \
-static volatile float4 prefix##_f_4 = 1;    \
-static volatile char prefix##_c_1 = 1;      \
-static volatile char2 prefix##_c_2 = 1;     \
-static volatile char3 prefix##_c_3 = 1;     \
-static volatile char4 prefix##_c_4 = 1;     \
-static volatile uchar prefix##_uc_1 = 1;    \
-static volatile uchar2 prefix##_uc_2 = 1;   \
-static volatile uchar3 prefix##_uc_3 = 1;   \
-static volatile uchar4 prefix##_uc_4 = 1;   \
-static volatile short prefix##_s_1 = 1;     \
-static volatile short2 prefix##_s_2 = 1;    \
-static volatile short3 prefix##_s_3 = 1;    \
-static volatile short4 prefix##_s_4 = 1;    \
-static volatile ushort prefix##_us_1 = 1;   \
-static volatile ushort2 prefix##_us_2 = 1;  \
-static volatile ushort3 prefix##_us_3 = 1;  \
-static volatile ushort4 prefix##_us_4 = 1;  \
-static volatile int prefix##_i_1 = 1;       \
-static volatile int2 prefix##_i_2 = 1;      \
-static volatile int3 prefix##_i_3 = 1;      \
-static volatile int4 prefix##_i_4 = 1;      \
-static volatile uint prefix##_ui_1 = 1;     \
-static volatile uint2 prefix##_ui_2 = 1;    \
-static volatile uint3 prefix##_ui_3 = 1;    \
-static volatile uint4 prefix##_ui_4 = 1;    \
-static volatile long prefix##_l_1 = 1;      \
-static volatile long2 prefix##_l_2 = 1;     \
-static volatile long3 prefix##_l_3 = 1;     \
-static volatile long4 prefix##_l_4 = 1;     \
-static volatile ulong prefix##_ul_1 = 1;    \
-static volatile ulong2 prefix##_ul_2 = 1;   \
-static volatile ulong3 prefix##_ul_3 = 1;   \
-static volatile ulong4 prefix##_ul_4 = 1;   \
-
-DECL_VAR_SET(res)
-DECL_VAR_SET(src1)
-DECL_VAR_SET(src2)
-DECL_VAR_SET(src3)
-
-
-// Testing macros
-
-#define RUN_BENCH(line, op)                         \
-    for (int i = priming_runs - 1; i >= 0; --i) {   \
-        line;                                       \
-    }                                               \
-    bench_time = rsUptimeMillis();                  \
-    for (int i = timing_runs - 1; i >= 0; --i) {    \
-        line;                                       \
-    }                                               \
-    bench_time = rsUptimeMillis() - bench_time;     \
-    rsDebug("    " op " took ns", (float)bench_time * inv_timing_runs);
-
-#define BENCH_BASIC_OP_TYPE(op, type)                                                               \
-    RUN_BENCH(res_##type##_1 = src1_##type##_1 op src2_##type##_1, #type "1 " #op " " #type "1")    \
-    RUN_BENCH(res_##type##_2 = src1_##type##_2 op src2_##type##_2, #type "2 " #op " " #type "2")    \
-    RUN_BENCH(res_##type##_3 = src1_##type##_3 op src2_##type##_3, #type "3 " #op " " #type "3")    \
-    RUN_BENCH(res_##type##_4 = src1_##type##_4 op src2_##type##_4, #type "4 " #op " " #type "4")    \
-
-#define BENCH_BASIC_INT_OP(op)                                  \
-    rsDebug("Testing basic operation " #op, 0);                 \
-    BENCH_BASIC_OP_TYPE(op, c)                                  \
-    BENCH_BASIC_OP_TYPE(op, uc)                                 \
-    BENCH_BASIC_OP_TYPE(op, s)                                  \
-    BENCH_BASIC_OP_TYPE(op, us)                                 \
-    BENCH_BASIC_OP_TYPE(op, i)                                  \
-    BENCH_BASIC_OP_TYPE(op, ui)                                 \
-    RUN_BENCH(res_l_1 = src1_l_1 op src2_l_1, "l1 " #op " l1")  \
-    RUN_BENCH(res_ul_1 = src1_ul_1 op src2_ul_1, "ul1 " #op " ul1")
-
-#define BENCH_BASIC_OP(op)      \
-    BENCH_BASIC_INT_OP(op)      \
-    BENCH_BASIC_OP_TYPE(op, f)
-
-#define BENCH_CVT(to, from, type)                                                                           \
-    rsDebug("Testing convert from " #from " to " #to, 0);                                                   \
-    RUN_BENCH(res_##to##_1 = (type)src1_##from##_1, "(" #to ")" #from)                                      \
-    RUN_BENCH(res_##to##_2 = convert_##type##2(src1_##from##_2), #to "2 convert_" #type "2(" #from "2)")    \
-    RUN_BENCH(res_##to##_3 = convert_##type##3(src1_##from##_3), #to "3 convert_" #type "3(" #from "3)")    \
-    RUN_BENCH(res_##to##_4 = convert_##type##4(src1_##from##_4), #to "4 convert_" #type "4(" #from "4)")
-
-#define BENCH_CVT_MATRIX(to, type)  \
-    BENCH_CVT(to, c, type);         \
-    BENCH_CVT(to, uc, type);        \
-    BENCH_CVT(to, s, type);         \
-    BENCH_CVT(to, us, type);        \
-    BENCH_CVT(to, i, type);         \
-    BENCH_CVT(to, ui, type);        \
-    BENCH_CVT(to, f, type);         \
-
-#define BENCH_XN_FUNC_YN(typeout, fnc, typein)                                                  \
-    RUN_BENCH(res_##typeout##_1 = fnc(src1_##typein##_1);, #typeout "1 " #fnc "(" #typein "1)") \
-    RUN_BENCH(res_##typeout##_2 = fnc(src1_##typein##_2);, #typeout "2 " #fnc "(" #typein "2)") \
-    RUN_BENCH(res_##typeout##_3 = fnc(src1_##typein##_3);, #typeout "3 " #fnc "(" #typein "3)") \
-    RUN_BENCH(res_##typeout##_4 = fnc(src1_##typein##_4);, #typeout "4 " #fnc "(" #typein "4)")
-
-#define BENCH_XN_FUNC_XN_XN(type, fnc)                                                                              \
-    RUN_BENCH(res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1), #type "1 " #fnc "(" #type "1, " #type "1)")   \
-    RUN_BENCH(res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2), #type "2 " #fnc "(" #type "2, " #type "2)")   \
-    RUN_BENCH(res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3), #type "3 " #fnc "(" #type "3, " #type "3)")   \
-    RUN_BENCH(res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4), #type "4 " #fnc "(" #type "4, " #type "4)")   \
-
-#define BENCH_X_FUNC_X_X_X(type, fnc)   \
-    RUN_BENCH(res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src3_##type##_1), #type "1 " #fnc "(" #type "1, " #type "1, " #type "1)")
-
-#define BENCH_IN_FUNC_IN(fnc)       \
-    rsDebug("Testing " #fnc, 0);    \
-    BENCH_XN_FUNC_YN(uc, fnc, uc)   \
-    BENCH_XN_FUNC_YN(c, fnc, c)     \
-    BENCH_XN_FUNC_YN(us, fnc, us)   \
-    BENCH_XN_FUNC_YN(s, fnc, s)     \
-    BENCH_XN_FUNC_YN(ui, fnc, ui)   \
-    BENCH_XN_FUNC_YN(i, fnc, i)
-
-#define BENCH_UIN_FUNC_IN(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    BENCH_XN_FUNC_YN(uc, fnc, c)    \
-    BENCH_XN_FUNC_YN(us, fnc, s)    \
-    BENCH_XN_FUNC_YN(ui, fnc, i)    \
-
-#define BENCH_IN_FUNC_IN_IN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    BENCH_XN_FUNC_XN_XN(uc, fnc)    \
-    BENCH_XN_FUNC_XN_XN(c, fnc)     \
-    BENCH_XN_FUNC_XN_XN(us, fnc)    \
-    BENCH_XN_FUNC_XN_XN(s, fnc)     \
-    BENCH_XN_FUNC_XN_XN(ui, fnc)    \
-    BENCH_XN_FUNC_XN_XN(i, fnc)
-
-#define BENCH_I_FUNC_I_I_I(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    BENCH_X_FUNC_X_X_X(uc, fnc)     \
-    BENCH_X_FUNC_X_X_X(c, fnc)      \
-    BENCH_X_FUNC_X_X_X(us, fnc)     \
-    BENCH_X_FUNC_X_X_X(s, fnc)      \
-    BENCH_X_FUNC_X_X_X(ui, fnc)     \
-    BENCH_X_FUNC_X_X_X(i, fnc)
-
-#define BENCH_FN_FUNC_FN(fnc)                               \
-    rsDebug("Testing " #fnc, 0);                            \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1), "f1 " #fnc "(f1)")   \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2), "f2 " #fnc "(f2)")   \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3), "f3 " #fnc "(f3)")   \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4), "f4 " #fnc "(f4)")
-
-#define BENCH_FN_FUNC_FN_PFN(fnc)                                                   \
-    rsDebug("Testing " #fnc, 0);                                                    \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, (float*) &src2_f_1), "f1 " #fnc "(f1, f1*)")  \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, (float2*) &src2_f_2), "f2 " #fnc "(f2, f2*)") \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, (float3*) &src2_f_3), "f3 " #fnc "(f3, f3*)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, (float4*) &src2_f_4), "f4 " #fnc "(f4, f4*)")
-
-#define BENCH_FN_FUNC_FN_FN(fnc)                                        \
-    rsDebug("Testing " #fnc, 0);                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src2_f_1), "f1 " #fnc "(f1, f1)") \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src2_f_2), "f2 " #fnc "(f2, f2)") \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src2_f_3), "f3 " #fnc "(f3, f3)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src2_f_4), "f4 " #fnc "(f4, f4)")
-
-#define BENCH_F34_FUNC_F34_F34(fnc)                                     \
-    rsDebug("Testing " #fnc, 0);                                        \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src2_f_3), "f3 " #fnc "(f3, f3)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src2_f_4), "f4 " #fnc "(f4, f4)")
-
-#define BENCH_FN_FUNC_FN_F(fnc)                                         \
-    rsDebug("Testing " #fnc, 0);                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src2_f_1), "f1 " #fnc "(f1, f1)") \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src2_f_1), "f2 " #fnc "(f2, f1)") \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src2_f_1), "f3 " #fnc "(f3, f1)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src2_f_1), "f4 " #fnc "(f4, f1)")
-
-#define BENCH_F_FUNC_FN(fnc)                                \
-    rsDebug("Testing " #fnc, 0);                            \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1), "f1 " #fnc "(f1)")   \
-    RUN_BENCH(res_f_1 = fnc(src1_f_2), "f1 " #fnc "(f2)")   \
-    RUN_BENCH(res_f_1 = fnc(src1_f_3), "f1 " #fnc "(f3)")   \
-    RUN_BENCH(res_f_1 = fnc(src1_f_4), "f1 " #fnc "(f4)")
-
-#define BENCH_F_FUNC_FN_FN(fnc)                                         \
-    rsDebug("Testing " #fnc, 0);                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src2_f_1), "f1 " #fnc "(f1, f1)") \
-    RUN_BENCH(res_f_1 = fnc(src1_f_2, src2_f_2), "f1 " #fnc "(f2, f2)") \
-    RUN_BENCH(res_f_1 = fnc(src1_f_3, src2_f_3), "f1 " #fnc "(f3, f3)") \
-    RUN_BENCH(res_f_1 = fnc(src1_f_4, src2_f_4), "f1 " #fnc "(f4, f4)")
-
-#define BENCH_FN_FUNC_FN_IN(fnc)                                        \
-    rsDebug("Testing " #fnc, 0);                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src1_i_1), "f1 " #fnc "(f1, i1)") \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src1_i_2), "f2 " #fnc "(f2, i2)") \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src1_i_3), "f3 " #fnc "(f3, i3)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src1_i_4), "f4 " #fnc "(f4, i4)")
-
-#define BENCH_FN_FUNC_FN_I(fnc)                                         \
-    rsDebug("Testing " #fnc, 0);                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src1_i_1), "f1 " #fnc "(f1, i1)") \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src1_i_1), "f2 " #fnc "(f2, i1)") \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src1_i_1), "f3 " #fnc "(f3, i1)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src1_i_1), "f4 " #fnc "(f4, i1)")
-
-#define BENCH_FN_FUNC_FN_FN_FN(fnc)                                                     \
-    rsDebug("Testing " #fnc, 0);                                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src2_f_1, src3_f_1), "f1 " #fnc "(f1, f1, f1)")   \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src2_f_2, src3_f_2), "f2 " #fnc "(f2, f2, f2)")   \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src2_f_3, src3_f_3), "f3 " #fnc "(f3, f3, f3)")   \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src2_f_4, src3_f_4), "f4 " #fnc "(f4, f4, f4)")
-
-#define BENCH_FN_FUNC_FN_FN_F(fnc)                                                      \
-    rsDebug("Testing " #fnc, 0);                                                        \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src2_f_1, src3_f_1), "f1 " #fnc "(f1, f1, f1)")   \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src2_f_2, src3_f_1), "f2 " #fnc "(f2, f2, f1)")   \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src2_f_3, src3_f_1), "f3 " #fnc "(f3, f3, f1)")   \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src2_f_4, src3_f_1), "f4 " #fnc "(f4, f4, f1)")
-
-#define BENCH_FN_FUNC_FN_PIN(fnc)                                                   \
-    rsDebug("Testing " #fnc, 0);                                                    \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, (int*) &src1_i_1), "f1 " #fnc "(f1, i1*)")    \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, (int2*) &src1_i_2), "f2 " #fnc "(f2, i2*)")   \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, (int3*) &src1_i_3), "f3 " #fnc "(f3, i3*)")   \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, (int4*) &src1_i_4), "f4 " #fnc "(f4, i4*)")
-
-#define BENCH_FN_FUNC_FN_FN_PIN(fnc)                                                            \
-    rsDebug("Testing " #fnc, 0);                                                                \
-    RUN_BENCH(res_f_1 = fnc(src1_f_1, src2_f_1, (int*) &src1_i_1), "f1 " #fnc "(f1, f1, i1*)")  \
-    RUN_BENCH(res_f_2 = fnc(src1_f_2, src2_f_2, (int2*) &src1_i_2), "f2 " #fnc "(f2, f2, i2*)") \
-    RUN_BENCH(res_f_3 = fnc(src1_f_3, src2_f_3, (int3*) &src1_i_3), "f3 " #fnc "(f3, f3, i3*)") \
-    RUN_BENCH(res_f_4 = fnc(src1_f_4, src2_f_4, (int4*) &src1_i_4), "f4 " #fnc "(f4, f4, i4*)")
-
-#define BENCH_IN_FUNC_FN(fnc)                               \
-    rsDebug("Testing " #fnc, 0);                            \
-    RUN_BENCH(res_i_1 = fnc(src1_f_1), "i1 " #fnc "(f1)")   \
-    RUN_BENCH(res_i_2 = fnc(src1_f_2), "i2 " #fnc "(f2)")   \
-    RUN_BENCH(res_i_3 = fnc(src1_f_3), "i3 " #fnc "(f3)")   \
-    RUN_BENCH(res_i_4 = fnc(src1_f_4), "i4 " #fnc "(f4)")
-
-
-// Testing functions
-
-static void bench_basic_operators() {
-    int i = 0;
-    BENCH_BASIC_OP(+);
-    BENCH_BASIC_OP(-);
-    BENCH_BASIC_OP(*);
-    BENCH_BASIC_OP(/);
-    BENCH_BASIC_INT_OP(%);
-    BENCH_BASIC_INT_OP(<<);
-    BENCH_BASIC_INT_OP(>>);
-}
-
-static void bench_convert() {
-    BENCH_CVT_MATRIX(c, char);
-    BENCH_CVT_MATRIX(uc, uchar);
-    BENCH_CVT_MATRIX(s, short);
-    BENCH_CVT_MATRIX(us, ushort);
-    BENCH_CVT_MATRIX(i, int);
-    BENCH_CVT_MATRIX(ui, uint);
-    BENCH_CVT_MATRIX(f, float);
-}
-
-static void bench_int_math() {
-    BENCH_UIN_FUNC_IN(abs);
-    BENCH_IN_FUNC_IN(clz);
-    BENCH_IN_FUNC_IN_IN(min);
-    BENCH_IN_FUNC_IN_IN(max);
-    BENCH_I_FUNC_I_I_I(rsClamp);
-}
-
-static void bench_fp_math() {
-    BENCH_FN_FUNC_FN(acos);
-    BENCH_FN_FUNC_FN(acosh);
-    BENCH_FN_FUNC_FN(acospi);
-    BENCH_FN_FUNC_FN(asin);
-    BENCH_FN_FUNC_FN(asinh);
-    BENCH_FN_FUNC_FN(asinpi);
-    BENCH_FN_FUNC_FN(atan);
-    BENCH_FN_FUNC_FN_FN(atan2);
-    BENCH_FN_FUNC_FN(atanh);
-    BENCH_FN_FUNC_FN(atanpi);
-    BENCH_FN_FUNC_FN_FN(atan2pi);
-    BENCH_FN_FUNC_FN(cbrt);
-    BENCH_FN_FUNC_FN(ceil);
-    BENCH_FN_FUNC_FN_FN_FN(clamp);
-    BENCH_FN_FUNC_FN_FN_F(clamp);
-    BENCH_FN_FUNC_FN_FN(copysign);
-    BENCH_FN_FUNC_FN(cos);
-    BENCH_FN_FUNC_FN(cosh);
-    BENCH_FN_FUNC_FN(cospi);
-    BENCH_F34_FUNC_F34_F34(cross);
-    BENCH_FN_FUNC_FN(degrees);
-    BENCH_F_FUNC_FN_FN(distance);
-    BENCH_F_FUNC_FN_FN(dot);
-    BENCH_FN_FUNC_FN(erfc);
-    BENCH_FN_FUNC_FN(erf);
-    BENCH_FN_FUNC_FN(exp);
-    BENCH_FN_FUNC_FN(exp2);
-    BENCH_FN_FUNC_FN(exp10);
-    BENCH_FN_FUNC_FN(expm1);
-    BENCH_FN_FUNC_FN(fabs);
-    BENCH_FN_FUNC_FN_FN(fdim);
-    BENCH_FN_FUNC_FN(floor);
-    BENCH_FN_FUNC_FN_FN_FN(fma);
-    BENCH_FN_FUNC_FN_FN(fmax);
-    BENCH_FN_FUNC_FN_F(fmax);
-    BENCH_FN_FUNC_FN_FN(fmin);
-    BENCH_FN_FUNC_FN_F(fmin);
-    BENCH_FN_FUNC_FN_FN(fmod);
-    BENCH_FN_FUNC_FN_PFN(fract);
-    BENCH_FN_FUNC_FN_PIN(frexp);
-    BENCH_FN_FUNC_FN_FN(hypot);
-    BENCH_IN_FUNC_FN(ilogb);
-    BENCH_FN_FUNC_FN_IN(ldexp);
-    BENCH_FN_FUNC_FN_I(ldexp);
-    BENCH_F_FUNC_FN(length);
-    BENCH_FN_FUNC_FN(lgamma);
-    BENCH_FN_FUNC_FN_PIN(lgamma);
-    BENCH_FN_FUNC_FN(log);
-    BENCH_FN_FUNC_FN(log2);
-    BENCH_FN_FUNC_FN(log10);
-    BENCH_FN_FUNC_FN(log1p);
-    BENCH_FN_FUNC_FN(logb);
-    BENCH_FN_FUNC_FN_FN_FN(mad);
-    BENCH_FN_FUNC_FN_FN(max);
-    BENCH_FN_FUNC_FN_F(max);
-    BENCH_FN_FUNC_FN_FN(min);
-    BENCH_FN_FUNC_FN_F(min);
-    BENCH_FN_FUNC_FN_FN_FN(mix);
-    BENCH_FN_FUNC_FN_FN_F(mix);
-    BENCH_FN_FUNC_FN_PFN(modf);
-    BENCH_FN_FUNC_FN_FN(nextafter);
-    BENCH_FN_FUNC_FN(normalize);
-    BENCH_FN_FUNC_FN_FN(pow);
-    BENCH_FN_FUNC_FN_IN(pown);
-    BENCH_FN_FUNC_FN_FN(powr);
-    BENCH_FN_FUNC_FN(radians);
-    BENCH_FN_FUNC_FN_FN(remainder);
-    BENCH_FN_FUNC_FN_FN_PIN(remquo);
-    BENCH_FN_FUNC_FN(rint);
-    BENCH_FN_FUNC_FN_IN(rootn);
-    BENCH_FN_FUNC_FN(round);
-    BENCH_FN_FUNC_FN(rsqrt);
-    BENCH_FN_FUNC_FN(sign);
-    BENCH_FN_FUNC_FN(sin);
-    BENCH_FN_FUNC_FN_PFN(sincos);
-    BENCH_FN_FUNC_FN(sinh);
-    BENCH_FN_FUNC_FN(sinpi);
-    BENCH_FN_FUNC_FN(sqrt);
-    BENCH_FN_FUNC_FN_FN(step);
-    BENCH_FN_FUNC_FN_F(step);
-    BENCH_FN_FUNC_FN(tan);
-    BENCH_FN_FUNC_FN(tanh);
-    BENCH_FN_FUNC_FN(tanpi);
-    BENCH_FN_FUNC_FN(tgamma);
-    BENCH_FN_FUNC_FN(trunc);
-}
-
-static void bench_approx_math() {
-    BENCH_FN_FUNC_FN(half_recip);
-    BENCH_FN_FUNC_FN(half_sqrt);
-    BENCH_FN_FUNC_FN(half_rsqrt);
-    BENCH_FN_FUNC_FN(fast_length);
-    BENCH_FN_FUNC_FN_FN(fast_distance);
-    BENCH_FN_FUNC_FN(fast_normalize);
-}
-
-void bench() {
-    rsDebug("RS Compute Benchmark", 0);
-    rsDebug("Current configuration:", 0);
-    rsDebug("Priming runs", priming_runs);
-    rsDebug("Timing runs", timing_runs);
-    rsDebug("Beginning test", 0);
-    inv_timing_runs = 1000000.f / (float)timing_runs;
-    bench_basic_operators();
-    bench_convert();
-    bench_int_math();
-    bench_fp_math();
-    bench_approx_math();
-}
-
diff --git a/tests/RenderScriptTests/ComputePerf/Android.mk b/tests/RenderScriptTests/ComputePerf/Android.mk
deleted file mode 100644
index 6ed5884..0000000
--- a/tests/RenderScriptTests/ComputePerf/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RsComputePerf
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/ComputePerf/AndroidManifest.xml b/tests/RenderScriptTests/ComputePerf/AndroidManifest.xml
deleted file mode 100644
index a9193b5..0000000
--- a/tests/RenderScriptTests/ComputePerf/AndroidManifest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.example.android.rs.computeperf">
-
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />    
-    <uses-sdk android:minSdkVersion="14" />
-    <application android:label="Compute Perf">
-        <activity android:name="ComputePerf">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/ComputePerf/res/layout/main.xml b/tests/RenderScriptTests/ComputePerf/res/layout/main.xml
deleted file mode 100644
index 61cd24d..0000000
--- a/tests/RenderScriptTests/ComputePerf/res/layout/main.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-    <ImageView
-        android:id="@+id/displayin"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-    <ImageView
-        android:id="@+id/displayout"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-</LinearLayout>
diff --git a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/ComputePerf.java b/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/ComputePerf.java
deleted file mode 100644
index 5446f66..0000000
--- a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/ComputePerf.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011-2012 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.example.android.rs.computeperf;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.renderscript.RenderScript;
-import android.renderscript.Allocation;
-import android.util.Log;
-import android.widget.ImageView;
-
-public class ComputePerf extends Activity {
-    private LaunchTest mLT;
-    private Mandelbrot mMandel;
-    private RenderScript mRS;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        final int numTries = 100;
-
-        long timesXLW = 0;
-        long timesXYW = 0;
-
-        mRS = RenderScript.create(this);
-        mLT = new LaunchTest(mRS, getResources());
-        mLT.XLW();
-        mLT.XYW();
-        for (int i = 0; i < numTries; i++) {
-            timesXLW += mLT.XLW();
-            timesXYW += mLT.XYW();
-        }
-
-        timesXLW /= numTries;
-        timesXYW /= numTries;
-
-        // XLW and XYW running times should match pretty closely
-        Log.v("ComputePerf", "xlw launch test " + timesXLW + "ms");
-        Log.v("ComputePerf", "xyw launch test " + timesXYW + "ms");
-
-        mMandel = new Mandelbrot(mRS, getResources());
-        mMandel.run();
-    }
-}
diff --git a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/LaunchTest.java b/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/LaunchTest.java
deleted file mode 100644
index e2312ba..0000000
--- a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/LaunchTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2011-2012 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.example.android.rs.computeperf;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class LaunchTest {
-    private RenderScript mRS;
-    private Allocation mAllocationX;
-    private Allocation mAllocationXY;
-    private ScriptC_launchtestxlw mScript_xlw;
-    private ScriptC_launchtestxyw mScript_xyw;
-
-    LaunchTest(RenderScript rs, Resources res) {
-        mRS = rs;
-        mScript_xlw = new ScriptC_launchtestxlw(mRS, res, R.raw.launchtestxlw);
-        mScript_xyw = new ScriptC_launchtestxyw(mRS, res, R.raw.launchtestxyw);
-        final int dim = mScript_xlw.get_dim();
-
-        mAllocationX = Allocation.createSized(rs, Element.U8(rs), dim);
-        Type.Builder tb = new Type.Builder(rs, Element.U8(rs));
-        tb.setX(dim);
-        tb.setY(dim);
-        mAllocationXY = Allocation.createTyped(rs, tb.create());
-        mScript_xlw.bind_buf(mAllocationXY);
-    }
-
-    public long XLW() {
-        long t = java.lang.System.currentTimeMillis();
-        mScript_xlw.forEach_root(mAllocationX);
-        mRS.finish();
-        t = java.lang.System.currentTimeMillis() - t;
-        return t;
-    }
-
-    public long XYW() {
-        long t = java.lang.System.currentTimeMillis();
-        mScript_xyw.forEach_root(mAllocationXY);
-        mRS.finish();
-        t = java.lang.System.currentTimeMillis() - t;
-        return t;
-    }
-}
diff --git a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/Mandelbrot.java b/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/Mandelbrot.java
deleted file mode 100644
index ea1cd623..0000000
--- a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/Mandelbrot.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 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.example.android.rs.computeperf;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class Mandelbrot implements Runnable {
-    private RenderScript mRS;
-    private Allocation mAllocationXY;
-    private ScriptC_mandelbrot mScript;
-
-    Mandelbrot(RenderScript rs, Resources res) {
-        mRS = rs;
-        mScript = new ScriptC_mandelbrot(mRS, res, R.raw.mandelbrot);
-
-        Type.Builder tb = new Type.Builder(rs, Element.U8_4(rs));
-        tb.setX(mScript.get_gDimX());
-        tb.setY(mScript.get_gDimY());
-        mAllocationXY = Allocation.createTyped(rs, tb.create());
-    }
-
-    public void run() {
-        long t = java.lang.System.currentTimeMillis();
-        mScript.forEach_root(mAllocationXY);
-        mRS.finish();
-        t = java.lang.System.currentTimeMillis() - t;
-        android.util.Log.v("ComputePerf", "mandelbrot  ms " + t);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/launchtestxlw.rs b/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/launchtestxlw.rs
deleted file mode 100644
index 7b81dfe..0000000
--- a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/launchtestxlw.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.computeperf)
-
-const int dim = 2048;
-uint8_t *buf;
-
-void root(uchar *v_out, uint32_t x) {
-    uint8_t *p = buf;
-    p += x * dim;
-    for (int i=0; i<dim; i++) {
-        p[i] = 1;
-    }
-}
-
diff --git a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/launchtestxyw.rs b/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/launchtestxyw.rs
deleted file mode 100644
index 7f7aa95..0000000
--- a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/launchtestxyw.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.computeperf)
-
-void root(uchar *v_out, uint32_t x, uint32_t y) {
-    *v_out = 0;
-}
-
diff --git a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/mandelbrot.rs b/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/mandelbrot.rs
deleted file mode 100644
index 0ffb0e5..0000000
--- a/tests/RenderScriptTests/ComputePerf/src/com/example/android/rs/computeperf/mandelbrot.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2011 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.
-
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.computeperf)
-
-const int gMaxIteration = 500;
-const int gDimX = 1024;
-const int gDimY = 1024;
-
-void root(uchar4 *v_out, uint32_t x, uint32_t y) {
-    float2 p;
-    p.x = -2.5f + ((float)x / gDimX) * 3.5f;
-    p.y = -1.f + ((float)y / gDimY) * 2.f;
-
-    float2 t = 0;
-    float2 t2 = t * t;
-    int iteration = 0;
-    while((t2.x + t2.y < 4.f) && (iteration < gMaxIteration)) {
-        float xtemp = t2.x - t2.y + p.x;
-        t.y = 2 * t.x * t.y + p.y;
-        t.x = xtemp;
-        iteration++;
-        t2 = t * t;
-    }
-
-    if(iteration >= gMaxIteration) {
-        *v_out = 0;
-    } else {
-        *v_out = (uchar4){iteration & 0xff, (iteration >> 6) & 0xff, 0x8f, 0xff};
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/Android.mk b/tests/RenderScriptTests/ImageProcessing/Android.mk
deleted file mode 100644
index d7486e8..0000000
--- a/tests/RenderScriptTests/ImageProcessing/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2009 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
-
-LOCAL_PACKAGE_NAME := ImageProcessing
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/ImageProcessing/AndroidManifest.xml b/tests/RenderScriptTests/ImageProcessing/AndroidManifest.xml
deleted file mode 100644
index d51fa39..0000000
--- a/tests/RenderScriptTests/ImageProcessing/AndroidManifest.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.image">
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-sdk android:minSdkVersion="17" />
-    <application android:label="Image Processing"
-                 android:hardwareAccelerated="true">
-        <uses-library android:name="android.test.runner" />
-        <activity android:name="ImageProcessingActivity">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-    <instrumentation android:name=".ImageProcessingTestRunner"
-      android:targetPackage="com.android.rs.image"
-      android:label="Test runner for Image Processing Benchmark Test"
-    />
-</manifest>
diff --git a/tests/RenderScriptTests/ImageProcessing/res/drawable-nodpi/img1600x1067.jpg b/tests/RenderScriptTests/ImageProcessing/res/drawable-nodpi/img1600x1067.jpg
deleted file mode 100644
index 05d3ee2..0000000
--- a/tests/RenderScriptTests/ImageProcessing/res/drawable-nodpi/img1600x1067.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing/res/drawable-nodpi/img1600x1067b.jpg b/tests/RenderScriptTests/ImageProcessing/res/drawable-nodpi/img1600x1067b.jpg
deleted file mode 100644
index aed0781..0000000
--- a/tests/RenderScriptTests/ImageProcessing/res/drawable-nodpi/img1600x1067b.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml b/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml
deleted file mode 100644
index f0a2b92..0000000
--- a/tests/RenderScriptTests/ImageProcessing/res/layout/main.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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="fill_parent"
-            android:layout_height="fill_parent"
-            android:id="@+id/toplevel">
-    <SurfaceView
-        android:id="@+id/surface"
-        android:layout_width="1dip"
-        android:layout_height="1dip" />
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-            <ImageView
-                android:id="@+id/display"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content">
-                    <Button
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/benchmark"
-                        android:onClick="benchmark"/>
-                    <TextView
-                        android:id="@+id/benchmarkText"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/saturation"/>
-            </LinearLayout>
-            <Spinner
-                android:id="@+id/filterselection"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <Spinner
-                android:id="@+id/spinner1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider1Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/saturation"/>
-             <SeekBar
-                android:id="@+id/slider1"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider2Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/gamma"/>
-            <SeekBar
-                android:id="@+id/slider2"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider3Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:textSize="8pt"
-                android:text="@string/out_white"/>
-            <SeekBar
-                android:id="@+id/slider3"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider4Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/slider4"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider5Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/slider5"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <Button
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/benchmark_all"
-                    android:onClick="benchmark_all"/>
-            </LinearLayout>
-    </ScrollView>
-</LinearLayout>
-
diff --git a/tests/RenderScriptTests/ImageProcessing/res/layout/spinner_layout.xml b/tests/RenderScriptTests/ImageProcessing/res/layout/spinner_layout.xml
deleted file mode 100644
index 8196bbf..0000000
--- a/tests/RenderScriptTests/ImageProcessing/res/layout/spinner_layout.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2012 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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="10dp"
-    android:textSize="16sp"
-/>
diff --git a/tests/RenderScriptTests/ImageProcessing/res/values/strings.xml b/tests/RenderScriptTests/ImageProcessing/res/values/strings.xml
deleted file mode 100644
index a7dd165..0000000
--- a/tests/RenderScriptTests/ImageProcessing/res/values/strings.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* 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.
-*/
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- General -->
-    <skip />
-    <!--slider label -->
-    <string name="blur_description">Blur Radius</string>
-    <string name="in_white">In White</string>
-    <string name="out_white">Out White</string>
-    <string name="in_black">In Black</string>
-    <string name="out_black">Out Black</string>
-    <string name="gamma">Gamma</string>
-    <string name="saturation">Saturation</string>
-    <string name="benchmark">Benchmark</string>
-    <string name="benchmark_all">Benchmark All</string>
-
-</resources>
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/BWFilter.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/BWFilter.java
deleted file mode 100644
index 64be4aa..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/BWFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-
-public class BWFilter extends TestBase {
-    private ScriptC_bwfilter mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_bwfilter(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_prepareBwFilter(50, 50, 50);
-        mScript.forEach_bwFilterKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
deleted file mode 100644
index 2303fc3..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blend.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-import java.lang.Short;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicBlend;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.view.View;
-import android.widget.Spinner;
-
-public class Blend extends TestBase {
-    private ScriptIntrinsicBlend mBlend;
-    private ScriptC_blend mBlendHelper;
-    private short image1Alpha = 128;
-    private short image2Alpha = 128;
-
-    String mIntrinsicNames[];
-
-    private Allocation image1;
-    private Allocation image2;
-    private int currentIntrinsic = 0;
-
-    private AdapterView.OnItemSelectedListener mIntrinsicSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-                    currentIntrinsic = pos;
-                    if (mRS != null) {
-                        runTest();
-                        act.updateDisplay();
-                    }
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-            };
-
-    public void createTest(android.content.res.Resources res) {
-        mBlend = ScriptIntrinsicBlend.create(mRS, Element.U8_4(mRS));
-        mBlendHelper = new ScriptC_blend(mRS);
-        mBlendHelper.set_alpha((short)128);
-
-        image1 = Allocation.createTyped(mRS, mInPixelsAllocation.getType());
-        image2 = Allocation.createTyped(mRS, mInPixelsAllocation2.getType());
-
-        mIntrinsicNames = new String[14];
-        mIntrinsicNames[0] = "Source";
-        mIntrinsicNames[1] = "Destination";
-        mIntrinsicNames[2] = "Source Over";
-        mIntrinsicNames[3] = "Destination Over";
-        mIntrinsicNames[4] = "Source In";
-        mIntrinsicNames[5] = "Destination In";
-        mIntrinsicNames[6] = "Source Out";
-        mIntrinsicNames[7] = "Destination Out";
-        mIntrinsicNames[8] = "Source Atop";
-        mIntrinsicNames[9] = "Destination Atop";
-        mIntrinsicNames[10] = "XOR";
-        mIntrinsicNames[11] = "Add";
-        mIntrinsicNames[12] = "Subtract";
-        mIntrinsicNames[13] = "Multiply";
-    }
-
-    public boolean onSpinner1Setup(Spinner s) {
-        s.setAdapter(new ArrayAdapter<String>(
-            act, R.layout.spinner_layout, mIntrinsicNames));
-        s.setOnItemSelectedListener(mIntrinsicSpinnerListener);
-        return true;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Image 1 Alpha");
-        b.setMax(255);
-        b.setProgress(image1Alpha);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        image1Alpha = (short)progress;
-    }
-
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Image 2 Alpha");
-        b.setMax(255);
-        b.setProgress(image2Alpha);
-        return true;
-    }
-
-    public void onBar2Changed(int progress) {
-        image2Alpha = (short)progress;
-    }
-
-    public void runTest() {
-        image1.copy2DRangeFrom(0, 0, mInPixelsAllocation.getType().getX(), mInPixelsAllocation.getType().getY(), mInPixelsAllocation, 0, 0);
-        image2.copy2DRangeFrom(0, 0, mInPixelsAllocation2.getType().getX(), mInPixelsAllocation2.getType().getY(), mInPixelsAllocation2, 0, 0);
-
-        mBlendHelper.set_alpha(image1Alpha);
-        mBlendHelper.forEach_setImageAlpha(image1);
-
-        mBlendHelper.set_alpha(image2Alpha);
-        mBlendHelper.forEach_setImageAlpha(image2);
-
-        switch (currentIntrinsic) {
-        case 0:
-            mBlend.forEachSrc(image1, image2);
-            break;
-        case 1:
-            mBlend.forEachDst(image1, image2);
-            break;
-        case 2:
-            mBlend.forEachSrcOver(image1, image2);
-            break;
-        case 3:
-            mBlend.forEachDstOver(image1, image2);
-            break;
-        case 4:
-            mBlend.forEachSrcIn(image1, image2);
-            break;
-        case 5:
-            mBlend.forEachDstIn(image1, image2);
-            break;
-        case 6:
-            mBlend.forEachSrcOut(image1, image2);
-            break;
-        case 7:
-            mBlend.forEachDstOut(image1, image2);
-            break;
-        case 8:
-            mBlend.forEachSrcAtop(image1, image2);
-            break;
-        case 9:
-            mBlend.forEachDstAtop(image1, image2);
-            break;
-        case 10:
-            mBlend.forEachXor(image1, image2);
-            break;
-        case 11:
-            mBlend.forEachAdd(image1, image2);
-            break;
-        case 12:
-            mBlend.forEachSubtract(image1, image2);
-            break;
-        case 13:
-            mBlend.forEachMultiply(image1, image2);
-            break;
-        }
-
-        mOutPixelsAllocation.copy2DRangeFrom(0, 0, image2.getType().getX(), image2.getType().getY(), image2, 0, 0);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java
deleted file mode 100644
index 0c6d41d..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicBlur;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Blur25 extends TestBase {
-    private boolean mUseIntrinsic = false;
-    private ScriptIntrinsicBlur mIntrinsic;
-
-    private int MAX_RADIUS = 25;
-    private ScriptC_threshold mScript;
-    private float mRadius = MAX_RADIUS;
-    private float mSaturation = 1.0f;
-    private Allocation mScratchPixelsAllocation1;
-    private Allocation mScratchPixelsAllocation2;
-
-
-    public Blur25(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Radius");
-        b.setProgress(100);
-        return true;
-    }
-
-
-    public void onBar1Changed(int progress) {
-        mRadius = ((float)progress) / 100.0f * MAX_RADIUS;
-        if (mRadius <= 0.10f) {
-            mRadius = 0.10f;
-        }
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(mRadius);
-        } else {
-            mScript.invoke_setRadius((int)mRadius);
-        }
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setRadius(MAX_RADIUS);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-
-            Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS));
-            tb.setX(width);
-            tb.setY(height);
-            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
-            mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());
-
-            mScript = new ScriptC_threshold(mRS, res, R.raw.threshold);
-            mScript.set_width(width);
-            mScript.set_height(height);
-            mScript.invoke_setRadius(MAX_RADIUS);
-
-            mScript.set_InPixel(mInPixelsAllocation);
-            mScript.set_ScratchPixel1(mScratchPixelsAllocation1);
-            mScript.set_ScratchPixel2(mScratchPixelsAllocation2);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_copyIn(mInPixelsAllocation, mScratchPixelsAllocation1);
-            mScript.forEach_horz(mScratchPixelsAllocation2);
-            mScript.forEach_vert(mOutPixelsAllocation);
-        }
-    }
-
-    public void setupBenchmark() {
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(MAX_RADIUS);
-        } else {
-            mScript.invoke_setRadius(MAX_RADIUS);
-        }
-    }
-
-    public void exitBenchmark() {
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(mRadius);
-        } else {
-            mScript.invoke_setRadius((int)mRadius);
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25G.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25G.java
deleted file mode 100644
index ac0dad1..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Blur25G.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.graphics.Bitmap;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicBlur;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Blur25G extends TestBase {
-    private final int MAX_RADIUS = 25;
-    private float mRadius = MAX_RADIUS;
-
-    private ScriptIntrinsicBlur mIntrinsic;
-
-    private ScriptC_greyscale mScript;
-    private Allocation mScratchPixelsAllocation1;
-    private Allocation mScratchPixelsAllocation2;
-
-
-    public Blur25G() {
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Radius");
-        b.setProgress(100);
-        return true;
-    }
-
-
-    public void onBar1Changed(int progress) {
-        mRadius = ((float)progress) / 100.0f * MAX_RADIUS;
-        if (mRadius <= 0.10f) {
-            mRadius = 0.10f;
-        }
-        mIntrinsic.setRadius(mRadius);
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS));
-        tb.setX(width);
-        tb.setY(height);
-        mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
-        mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());
-
-        mScript = new ScriptC_greyscale(mRS);
-        mScript.forEach_toU8(mInPixelsAllocation, mScratchPixelsAllocation1);
-
-        mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8(mRS));
-        mIntrinsic.setRadius(MAX_RADIUS);
-        mIntrinsic.setInput(mScratchPixelsAllocation1);
-    }
-
-    public void runTest() {
-        mIntrinsic.forEach(mScratchPixelsAllocation2);
-    }
-
-    public void setupBenchmark() {
-        mIntrinsic.setRadius(MAX_RADIUS);
-    }
-
-    public void exitBenchmark() {
-        mIntrinsic.setRadius(mRadius);
-    }
-
-    public void updateBitmap(Bitmap b) {
-        mScript.forEach_toU8_4(mScratchPixelsAllocation2, mOutPixelsAllocation);
-        mOutPixelsAllocation.copyTo(b);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ColorCube.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ColorCube.java
deleted file mode 100644
index f313c46..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ColorCube.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsic3DLUT;
-import android.renderscript.ScriptIntrinsicColorMatrix;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class ColorCube extends TestBase {
-    private Allocation mCube;
-    private ScriptC_colorcube mScript;
-    private ScriptIntrinsic3DLUT mIntrinsic;
-    private boolean mUseIntrinsic;
-
-    public ColorCube(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    private void initCube() {
-        final int sx = 32;
-        final int sy = 32;
-        final int sz = 16;
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8_4(mRS));
-        tb.setX(sx);
-        tb.setY(sy);
-        tb.setZ(sz);
-        Type t = tb.create();
-        mCube = Allocation.createTyped(mRS, t);
-
-        int dat[] = new int[sx * sy * sz];
-        for (int z = 0; z < sz; z++) {
-            for (int y = 0; y < sy; y++) {
-                for (int x = 0; x < sx; x++ ) {
-                    int v = 0xff000000;
-                    v |= (0xff * x / (sx - 1));
-                    v |= (0xff * y / (sy - 1)) << 8;
-                    v |= (0xff * z / (sz - 1)) << 16;
-                    dat[z*sy*sx + y*sx + x] = v;
-                }
-            }
-        }
-
-        mCube.copyFromUnchecked(dat);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_colorcube(mRS, res, R.raw.colorcube);
-        mIntrinsic = ScriptIntrinsic3DLUT.create(mRS, Element.U8_4(mRS));
-
-        initCube();
-        mScript.invoke_setCube(mCube);
-        mIntrinsic.setLUT(mCube);
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ColorMatrix.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ColorMatrix.java
deleted file mode 100644
index 2ac40a1..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ColorMatrix.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicColorMatrix;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class ColorMatrix extends TestBase {
-    private ScriptC_colormatrix mScript;
-    private ScriptIntrinsicColorMatrix mIntrinsic;
-    private boolean mUseIntrinsic;
-    private boolean mUseGrey;
-
-    public ColorMatrix(boolean useIntrinsic, boolean useGrey) {
-        mUseIntrinsic = useIntrinsic;
-        mUseGrey = useGrey;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-            if (mUseGrey) {
-                mIntrinsic.setGreyscale();
-            } else {
-                mIntrinsic.setColorMatrix(m);
-            }
-        } else {
-            mScript = new ScriptC_colormatrix(mRS, res, R.raw.colormatrix);
-            mScript.invoke_setMatrix(m);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Contrast.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Contrast.java
deleted file mode 100644
index f3cf1b7..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Contrast.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Contrast extends TestBase {
-    private ScriptC_contrast mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_contrast(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_setBright(50.f);
-        mScript.forEach_contrast(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Convolve3x3.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Convolve3x3.java
deleted file mode 100644
index 18e9b43..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Convolve3x3.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicConvolve3x3;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Convolve3x3 extends TestBase {
-    private ScriptC_convolve3x3 mScript;
-    private ScriptIntrinsicConvolve3x3 mIntrinsic;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseIntrinsic;
-
-    public Convolve3x3(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        float f[] = new float[9];
-        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
-        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
-        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setCoefficients(f);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-            mScript = new ScriptC_convolve3x3(mRS, res, R.raw.convolve3x3);
-            mScript.set_gCoeffs(f);
-            mScript.set_gIn(mInPixelsAllocation);
-            mScript.set_gWidth(mWidth);
-            mScript.set_gHeight(mHeight);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Convolve5x5.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Convolve5x5.java
deleted file mode 100644
index 03b3bb8..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Convolve5x5.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicConvolve5x5;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Convolve5x5 extends TestBase {
-    private ScriptC_convolve5x5 mScript;
-    private ScriptIntrinsicConvolve5x5 mIntrinsic;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseIntrinsic;
-
-    public Convolve5x5(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        float f[] = new float[25];
-        //f[0] = 0.012f; f[1] = 0.025f; f[2] = 0.031f; f[3] = 0.025f; f[4] = 0.012f;
-        //f[5] = 0.025f; f[6] = 0.057f; f[7] = 0.075f; f[8] = 0.057f; f[9] = 0.025f;
-        //f[10]= 0.031f; f[11]= 0.075f; f[12]= 0.095f; f[13]= 0.075f; f[14]= 0.031f;
-        //f[15]= 0.025f; f[16]= 0.057f; f[17]= 0.075f; f[18]= 0.057f; f[19]= 0.025f;
-        //f[20]= 0.012f; f[21]= 0.025f; f[22]= 0.031f; f[23]= 0.025f; f[24]= 0.012f;
-
-        //f[0] = 1.f; f[1] = 2.f; f[2] = 0.f; f[3] = -2.f; f[4] = -1.f;
-        //f[5] = 4.f; f[6] = 8.f; f[7] = 0.f; f[8] = -8.f; f[9] = -4.f;
-        //f[10]= 6.f; f[11]=12.f; f[12]= 0.f; f[13]=-12.f; f[14]= -6.f;
-        //f[15]= 4.f; f[16]= 8.f; f[17]= 0.f; f[18]= -8.f; f[19]= -4.f;
-        //f[20]= 1.f; f[21]= 2.f; f[22]= 0.f; f[23]= -2.f; f[24]= -1.f;
-
-        f[0] = -1.f; f[1] = -3.f; f[2] = -4.f; f[3] = -3.f; f[4] = -1.f;
-        f[5] = -3.f; f[6] =  0.f; f[7] =  6.f; f[8] =  0.f; f[9] = -3.f;
-        f[10]= -4.f; f[11]=  6.f; f[12]= 20.f; f[13]=  6.f; f[14]= -4.f;
-        f[15]= -3.f; f[16]=  0.f; f[17]=  6.f; f[18]=  0.f; f[19]= -3.f;
-        f[20]= -1.f; f[21]= -3.f; f[22]= -4.f; f[23]= -3.f; f[24]= -1.f;
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicConvolve5x5.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setCoefficients(f);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-            mScript = new ScriptC_convolve5x5(mRS, res, R.raw.convolve5x5);
-            mScript.set_gCoeffs(f);
-            mScript.set_gIn(mInPixelsAllocation);
-            mScript.set_gWidth(mWidth);
-            mScript.set_gHeight(mHeight);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Copy.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Copy.java
deleted file mode 100644
index efca0b5..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Copy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Copy extends TestBase {
-    private ScriptC_copy mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_copy(mRS, res, R.raw.copy);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/CrossProcess.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/CrossProcess.java
deleted file mode 100644
index b9e3524..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/CrossProcess.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicLUT;
-import android.util.Log;
-
-public class CrossProcess extends TestBase {
-    private ScriptIntrinsicLUT mIntrinsic;
-
-    public void createTest(android.content.res.Resources res) {
-        mIntrinsic = ScriptIntrinsicLUT.create(mRS, Element.U8_4(mRS));
-        for (int ct=0; ct < 256; ct++) {
-            float f = ((float)ct) / 255.f;
-
-            float r = f;
-            if (r < 0.5f) {
-                r = 4.0f * r * r * r;
-            } else {
-                r = 1.0f - r;
-                r = 1.0f - (4.0f * r * r * r);
-            }
-            mIntrinsic.setRed(ct, (int)(r * 255.f + 0.5f));
-
-            float g = f;
-            if (g < 0.5f) {
-                g = 2.0f * g * g;
-            } else {
-                g = 1.0f - g;
-                g = 1.0f - (2.0f * g * g);
-            }
-            mIntrinsic.setGreen(ct, (int)(g * 255.f + 0.5f));
-
-            float b = f * 0.5f + 0.25f;
-            mIntrinsic.setBlue(ct, (int)(b * 255.f + 0.5f));
-        }
-
-    }
-
-    public void runTest() {
-        mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Exposure.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Exposure.java
deleted file mode 100644
index bec53ab..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Exposure.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Exposure extends TestBase {
-    private ScriptC_exposure mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_exposure(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_setBright(50.f);
-        mScript.forEach_exposure(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java
deleted file mode 100644
index 81868b10..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Fisheye.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Sampler;
-import android.renderscript.Type;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Fisheye extends TestBase {
-    private ScriptC_fisheye_full mScript_full = null;
-    private ScriptC_fisheye_relaxed mScript_relaxed = null;
-    private ScriptC_fisheye_approx_full mScript_approx_full = null;
-    private ScriptC_fisheye_approx_relaxed mScript_approx_relaxed = null;
-    private final boolean approx;
-    private final boolean relaxed;
-    private float center_x = 0.5f;
-    private float center_y = 0.5f;
-    private float scale = 0.5f;
-
-    public Fisheye(boolean approx, boolean relaxed) {
-        this.approx = approx;
-        this.relaxed = relaxed;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Scale");
-        b.setMax(100);
-        b.setProgress(25);
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Shift center X");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Shift center Y");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        scale = progress / 50.0f;
-        do_init();
-    }
-    public void onBar2Changed(int progress) {
-        center_x = progress / 100.0f;
-        do_init();
-    }
-    public void onBar3Changed(int progress) {
-        center_y = progress / 100.0f;
-        do_init();
-    }
-
-    private void do_init() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.invoke_init_filter(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale);
-            else
-                mScript_approx_full.invoke_init_filter(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale);
-        } else if (relaxed)
-            mScript_relaxed.invoke_init_filter(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale);
-        else
-            mScript_full.invoke_init_filter(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        if (approx) {
-            if (relaxed) {
-                mScript_approx_relaxed = new ScriptC_fisheye_approx_relaxed(mRS,
-                        res, R.raw.fisheye_approx_relaxed);
-                mScript_approx_relaxed.set_in_alloc(mInPixelsAllocation);
-                mScript_approx_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-            } else {
-                mScript_approx_full = new ScriptC_fisheye_approx_full(mRS, res,
-                        R.raw.fisheye_approx_full);
-                mScript_approx_full.set_in_alloc(mInPixelsAllocation);
-                mScript_approx_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-            }
-        } else if (relaxed) {
-            mScript_relaxed = new ScriptC_fisheye_relaxed(mRS, res,
-                    R.raw.fisheye_relaxed);
-            mScript_relaxed.set_in_alloc(mInPixelsAllocation);
-            mScript_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-        } else {
-            mScript_full = new ScriptC_fisheye_full(mRS, res,
-                    R.raw.fisheye_full);
-            mScript_full.set_in_alloc(mInPixelsAllocation);
-            mScript_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-        }
-        do_init();
-    }
-
-    public void runTest() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.forEach_root(mOutPixelsAllocation);
-            else
-                mScript_approx_full.forEach_root(mOutPixelsAllocation);
-        } else if (relaxed)
-            mScript_relaxed.forEach_root(mOutPixelsAllocation);
-        else
-            mScript_full.forEach_root(mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java
deleted file mode 100644
index 8618cc8..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Grain.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Grain extends TestBase {
-    private ScriptC_grain mScript;
-    private Allocation mNoise;
-    private Allocation mNoise2;
-
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Strength");
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        float s = progress / 100.0f;
-        mScript.set_gNoiseStrength(s);
-    }
-
-    private int findHighBit(int v) {
-        int bit = 0;
-        while (v > 1) {
-            bit++;
-            v >>= 1;
-        }
-        return bit;
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        int noiseW = findHighBit(width);
-        int noiseH = findHighBit(height);
-        if (noiseW > 9) {
-            noiseW = 9;
-        }
-        if (noiseH > 9) {
-            noiseH = 9;
-        }
-        noiseW = 1 << noiseW;
-        noiseH = 1 << noiseH;
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS));
-        tb.setX(noiseW);
-        tb.setY(noiseH);
-        mNoise = Allocation.createTyped(mRS, tb.create());
-        mNoise2 = Allocation.createTyped(mRS, tb.create());
-
-        mScript = new ScriptC_grain(mRS, res, R.raw.grain);
-        mScript.set_gWMask(noiseW - 1);
-        mScript.set_gHMask(noiseH - 1);
-        mScript.set_gNoiseStrength(0.5f);
-        mScript.set_gBlendSource(mNoise);
-        mScript.set_gNoise(mNoise2);
-    }
-
-    public void runTest() {
-        mScript.forEach_genRand(mNoise);
-        mScript.forEach_blend9(mNoise2);
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Greyscale.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Greyscale.java
deleted file mode 100644
index 3db210a..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Greyscale.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Greyscale extends TestBase {
-    private ScriptC_greyscale mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_greyscale(mRS, res, R.raw.greyscale);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/GroupTest.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/GroupTest.java
deleted file mode 100644
index 29c204c..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/GroupTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicConvolve3x3;
-import android.renderscript.ScriptIntrinsicColorMatrix;
-import android.renderscript.Type;
-import android.renderscript.Matrix4f;
-import android.renderscript.ScriptGroup;
-import android.util.Log;
-
-public class GroupTest extends TestBase {
-    private ScriptIntrinsicConvolve3x3 mConvolve;
-    private ScriptIntrinsicColorMatrix mMatrix;
-
-    private Allocation mScratchPixelsAllocation1;
-    private ScriptGroup mGroup;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseNative;
-
-
-    public GroupTest(boolean useNative) {
-        mUseNative = useNative;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        mConvolve = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
-        mMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-
-        float f[] = new float[9];
-        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
-        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
-        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;
-        mConvolve.setCoefficients(f);
-
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-        mMatrix.setColorMatrix(m);
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8_4(mRS));
-        tb.setX(mWidth);
-        tb.setY(mHeight);
-        Type connect = tb.create();
-
-        if (mUseNative) {
-            ScriptGroup.Builder b = new ScriptGroup.Builder(mRS);
-            b.addKernel(mConvolve.getKernelID());
-            b.addKernel(mMatrix.getKernelID());
-            b.addConnection(connect, mConvolve.getKernelID(), mMatrix.getKernelID());
-            mGroup = b.create();
-        } else {
-            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, connect);
-        }
-    }
-
-    public void runTest() {
-        mConvolve.setInput(mInPixelsAllocation);
-        if (mUseNative) {
-            mGroup.setOutput(mMatrix.getKernelID(), mOutPixelsAllocation);
-            mGroup.execute();
-        } else {
-            mConvolve.forEach(mScratchPixelsAllocation1);
-            mMatrix.forEach(mScratchPixelsAllocation1, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
deleted file mode 100644
index 8cf46c2..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.view.SurfaceView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.view.View;
-import android.util.Log;
-import android.renderscript.ScriptC;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Script;
-
-import android.os.Environment;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-public class ImageProcessingActivity extends Activity
-                                       implements SeekBar.OnSeekBarChangeListener {
-    private final String TAG = "Img";
-    public final String RESULT_FILE = "image_processing_result.csv";
-
-    RenderScript mRS;
-    Allocation mInPixelsAllocation;
-    Allocation mInPixelsAllocation2;
-    Allocation mOutPixelsAllocation;
-
-    /**
-     * Define enum type for test names
-     */
-    public enum TestName {
-        // totally there are 38 test cases
-        LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed"),
-        LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed"),
-        LEVELS_VEC3_FULL ("Levels Vec3 Full"),
-        LEVELS_VEC4_FULL ("Levels Vec4 Full"),
-        BLUR_RADIUS_25 ("Blur radius 25"),
-        INTRINSIC_BLUE_RADIUS_25 ("Intrinsic Blur radius 25"),
-        GREYSCALE ("Greyscale"),
-        GRAIN ("Grain"),
-        FISHEYE_FULL ("Fisheye Full"),
-        FISHEYE_RELAXED ("Fisheye Relaxed"),
-        FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full"),
-        FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed"),
-        VIGNETTE_FULL ("Vignette Full"),
-        VIGNETTE_RELAXED ("Vignette Relaxed"),
-        VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full"),
-        VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed"),
-        GROUP_TEST_EMULATED ("Group Test (emulated)"),
-        GROUP_TEST_NATIVE ("Group Test (native)"),
-        CONVOLVE_3X3 ("Convolve 3x3"),
-        INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3"),
-        COLOR_MATRIX ("ColorMatrix"),
-        INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix"),
-        INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey"),
-        COPY ("Copy"),
-        CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)"),
-        CONVOLVE_5X5 ("Convolve 5x5"),
-        INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5"),
-        MANDELBROT ("Mandelbrot"),
-        INTRINSICS_BLEND ("Intrinsics Blend"),
-        INTRINSICS_BLUR_25G ("Intrinsics Blur 25 uchar"),
-        VIBRANCE ("Vibrance"),
-        BW_FILTER ("BW Filter"),
-        SHADOWS ("Shadows"),
-        CONTRAST ("Contrast"),
-        EXPOSURE ("Exposure"),
-        WHITE_BALANCE ("White Balance"),
-        COLOR_CUBE ("Color Cube"),
-        COLOR_CUBE_3D_INTRINSIC ("Color Cube (3D LUT intrinsic)"),
-        USAGE_IO ("Usage io)");
-
-
-        private final String name;
-
-        private TestName(String s) {
-            name = s;
-        }
-
-        // return quoted string as displayed test name
-        public String toString() {
-            return name;
-        }
-    }
-
-    Bitmap mBitmapIn;
-    Bitmap mBitmapIn2;
-    Bitmap mBitmapOut;
-
-    private Spinner mSpinner;
-    private SeekBar mBar1;
-    private SeekBar mBar2;
-    private SeekBar mBar3;
-    private SeekBar mBar4;
-    private SeekBar mBar5;
-    private TextView mText1;
-    private TextView mText2;
-    private TextView mText3;
-    private TextView mText4;
-    private TextView mText5;
-
-    private float mSaturation = 1.0f;
-
-    private TextView mBenchmarkResult;
-    private Spinner mTestSpinner;
-
-    private SurfaceView mSurfaceView;
-    private ImageView mDisplayView;
-
-    private boolean mDoingBenchmark;
-
-    private TestBase mTest;
-    private int mRunCount;
-
-    public void updateDisplay() {
-        mHandler.sendMessage(Message.obtain());
-    }
-
-    private Handler mHandler = new Handler() {
-        // Allow the filter to complete without blocking the UI
-        // thread.  When the message arrives that the op is complete
-        // we will either mark completion or start a new filter if
-        // more work is ready.  Either way, display the result.
-        @Override
-        public void handleMessage(Message msg) {
-            boolean doTest = false;
-            synchronized(this) {
-                if (mRS == null) {
-                    return;
-                }
-                mTest.updateBitmap(mBitmapOut);
-                mDisplayView.invalidate();
-                if (mRunCount > 0) {
-                    mRunCount--;
-                    if (mRunCount > 0) {
-                        doTest = true;
-                    }
-                }
-
-                if (doTest) {
-                    mTest.runTestSendMessage();
-                }
-            }
-        }
-
-    };
-
-    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        if (fromUser) {
-
-            if (seekBar == mBar1) {
-                mTest.onBar1Changed(progress);
-            } else if (seekBar == mBar2) {
-                mTest.onBar2Changed(progress);
-            } else if (seekBar == mBar3) {
-                mTest.onBar3Changed(progress);
-            } else if (seekBar == mBar4) {
-                mTest.onBar4Changed(progress);
-            } else if (seekBar == mBar5) {
-                mTest.onBar5Changed(progress);
-            }
-
-            boolean doTest = false;
-            synchronized(this) {
-                if (mRunCount == 0) {
-                    doTest = true;
-                    mRunCount = 1;
-                } else {
-                    mRunCount = 2;
-                }
-            }
-            if (doTest) {
-                mTest.runTestSendMessage();
-            }
-        }
-    }
-
-    public void onStartTrackingTouch(SeekBar seekBar) {
-    }
-
-    public void onStopTrackingTouch(SeekBar seekBar) {
-    }
-
-    void setupBars() {
-        mSpinner.setVisibility(View.VISIBLE);
-        mTest.onSpinner1Setup(mSpinner);
-
-        mBar1.setVisibility(View.VISIBLE);
-        mText1.setVisibility(View.VISIBLE);
-        mTest.onBar1Setup(mBar1, mText1);
-
-        mBar2.setVisibility(View.VISIBLE);
-        mText2.setVisibility(View.VISIBLE);
-        mTest.onBar2Setup(mBar2, mText2);
-
-        mBar3.setVisibility(View.VISIBLE);
-        mText3.setVisibility(View.VISIBLE);
-        mTest.onBar3Setup(mBar3, mText3);
-
-        mBar4.setVisibility(View.VISIBLE);
-        mText4.setVisibility(View.VISIBLE);
-        mTest.onBar4Setup(mBar4, mText4);
-
-        mBar5.setVisibility(View.VISIBLE);
-        mText5.setVisibility(View.VISIBLE);
-        mTest.onBar5Setup(mBar5, mText5);
-    }
-
-
-    void changeTest(TestName testName) {
-        if (mTest != null) {
-            mTest.destroy();
-        }
-        switch(testName) {
-        case LEVELS_VEC3_RELAXED:
-            mTest = new LevelsV4(false, false);
-            break;
-        case LEVELS_VEC4_RELAXED:
-            mTest = new LevelsV4(false, true);
-            break;
-        case LEVELS_VEC3_FULL:
-            mTest = new LevelsV4(true, false);
-            break;
-        case LEVELS_VEC4_FULL:
-            mTest = new LevelsV4(true, true);
-            break;
-        case BLUR_RADIUS_25:
-            mTest = new Blur25(false);
-            break;
-        case INTRINSIC_BLUE_RADIUS_25:
-            mTest = new Blur25(true);
-            break;
-        case GREYSCALE:
-            mTest = new Greyscale();
-            break;
-        case GRAIN:
-            mTest = new Grain();
-            break;
-        case FISHEYE_FULL:
-            mTest = new Fisheye(false, false);
-            break;
-        case FISHEYE_RELAXED:
-            mTest = new Fisheye(false, true);
-            break;
-        case FISHEYE_APPROXIMATE_FULL:
-            mTest = new Fisheye(true, false);
-            break;
-        case FISHEYE_APPROXIMATE_RELAXED:
-            mTest = new Fisheye(true, true);
-            break;
-        case VIGNETTE_FULL:
-            mTest = new Vignette(false, false);
-            break;
-        case VIGNETTE_RELAXED:
-            mTest = new Vignette(false, true);
-            break;
-        case VIGNETTE_APPROXIMATE_FULL:
-            mTest = new Vignette(true, false);
-            break;
-        case VIGNETTE_APPROXIMATE_RELAXED:
-            mTest = new Vignette(true, true);
-            break;
-        case GROUP_TEST_EMULATED:
-            mTest = new GroupTest(false);
-            break;
-        case GROUP_TEST_NATIVE:
-            mTest = new GroupTest(true);
-            break;
-        case CONVOLVE_3X3:
-            mTest = new Convolve3x3(false);
-            break;
-        case INTRINSICS_CONVOLVE_3X3:
-            mTest = new Convolve3x3(true);
-            break;
-        case COLOR_MATRIX:
-            mTest = new ColorMatrix(false, false);
-            break;
-        case INTRINSICS_COLOR_MATRIX:
-            mTest = new ColorMatrix(true, false);
-            break;
-        case INTRINSICS_COLOR_MATRIX_GREY:
-            mTest = new ColorMatrix(true, true);
-            break;
-        case COPY:
-            mTest = new Copy();
-            break;
-        case CROSS_PROCESS_USING_LUT:
-            mTest = new CrossProcess();
-            break;
-        case CONVOLVE_5X5:
-            mTest = new Convolve5x5(false);
-            break;
-        case INTRINSICS_CONVOLVE_5X5:
-            mTest = new Convolve5x5(true);
-            break;
-        case MANDELBROT:
-            mTest = new Mandelbrot();
-            break;
-        case INTRINSICS_BLEND:
-            mTest = new Blend();
-            break;
-        case INTRINSICS_BLUR_25G:
-            mTest = new Blur25G();
-            break;
-        case VIBRANCE:
-            mTest = new Vibrance();
-            break;
-        case BW_FILTER:
-            mTest = new BWFilter();
-            break;
-        case SHADOWS:
-            mTest = new Shadows();
-            break;
-        case CONTRAST:
-            mTest = new Contrast();
-            break;
-        case EXPOSURE:
-            mTest = new Exposure();
-            break;
-        case WHITE_BALANCE:
-            mTest = new WhiteBalance();
-            break;
-        case COLOR_CUBE:
-            mTest = new ColorCube(false);
-            break;
-        case COLOR_CUBE_3D_INTRINSIC:
-            mTest = new ColorCube(true);
-            break;
-        case USAGE_IO:
-            mTest = new UsageIO();
-            break;
-        }
-
-        mTest.createBaseTest(this, mBitmapIn, mBitmapIn2, mBitmapOut);
-        setupBars();
-
-        mTest.runTest();
-        updateDisplay();
-        mBenchmarkResult.setText("Result: not run");
-    }
-
-    void setupTests() {
-        mTestSpinner.setAdapter(new ArrayAdapter<TestName>(
-            this, R.layout.spinner_layout, TestName.values()));
-    }
-
-    private AdapterView.OnItemSelectedListener mTestSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-                    changeTest(TestName.values()[pos]);
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-            };
-
-    void init() {
-        mBitmapIn = loadBitmap(R.drawable.img1600x1067);
-        mBitmapIn2 = loadBitmap(R.drawable.img1600x1067b);
-        mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), mBitmapIn.getHeight(),
-                                         mBitmapIn.getConfig());
-
-        mSurfaceView = (SurfaceView) findViewById(R.id.surface);
-
-        mDisplayView = (ImageView) findViewById(R.id.display);
-        mDisplayView.setImageBitmap(mBitmapOut);
-
-        mSpinner = (Spinner) findViewById(R.id.spinner1);
-
-        mBar1 = (SeekBar) findViewById(R.id.slider1);
-        mBar2 = (SeekBar) findViewById(R.id.slider2);
-        mBar3 = (SeekBar) findViewById(R.id.slider3);
-        mBar4 = (SeekBar) findViewById(R.id.slider4);
-        mBar5 = (SeekBar) findViewById(R.id.slider5);
-
-        mBar1.setOnSeekBarChangeListener(this);
-        mBar2.setOnSeekBarChangeListener(this);
-        mBar3.setOnSeekBarChangeListener(this);
-        mBar4.setOnSeekBarChangeListener(this);
-        mBar5.setOnSeekBarChangeListener(this);
-
-        mText1 = (TextView) findViewById(R.id.slider1Text);
-        mText2 = (TextView) findViewById(R.id.slider2Text);
-        mText3 = (TextView) findViewById(R.id.slider3Text);
-        mText4 = (TextView) findViewById(R.id.slider4Text);
-        mText5 = (TextView) findViewById(R.id.slider5Text);
-
-        mTestSpinner = (Spinner) findViewById(R.id.filterselection);
-        mTestSpinner.setOnItemSelectedListener(mTestSpinnerListener);
-
-        mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText);
-        mBenchmarkResult.setText("Result: not run");
-
-
-        mRS = RenderScript.create(this);
-        mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn);
-        mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2);
-        mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut);
-
-
-        setupTests();
-        changeTest(TestName.LEVELS_VEC3_RELAXED);
-    }
-
-    void cleanup() {
-        synchronized(this) {
-            RenderScript rs = mRS;
-            mRS = null;
-            while(mDoingBenchmark) {
-                try {
-                    Thread.sleep(1, 0);
-                } catch(InterruptedException e) {
-                }
-
-            }
-            rs.destroy();
-        }
-
-        mInPixelsAllocation = null;
-        mInPixelsAllocation2 = null;
-        mOutPixelsAllocation = null;
-        mBitmapIn = null;
-        mBitmapIn2 = null;
-        mBitmapOut = null;
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        init();
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-
-        cleanup();
-    }
-
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-
-        init();
-    }
-
-    private Bitmap loadBitmap(int resource) {
-        final BitmapFactory.Options options = new BitmapFactory.Options();
-        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
-        return BitmapFactory.decodeResource(getResources(), resource, options);
-    }
-
-    // button hook
-    public void benchmark(View v) {
-        float t = getBenchmark();
-        //long javaTime = javaFilter();
-        //mBenchmarkResult.setText("RS: " + t + " ms  Java: " + javaTime + " ms");
-        mBenchmarkResult.setText("Result: " + t + " ms");
-        Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + t);
-    }
-
-    public void benchmark_all(View v) {
-        // write result into a file
-        File externalStorage = Environment.getExternalStorageDirectory();
-        if (!externalStorage.canWrite()) {
-            Log.v(TAG, "sdcard is not writable");
-            return;
-        }
-        File resultFile = new File(externalStorage, RESULT_FILE);
-        resultFile.setWritable(true, false);
-        try {
-            BufferedWriter rsWriter = new BufferedWriter(new FileWriter(resultFile));
-            Log.v(TAG, "Saved results in: " + resultFile.getAbsolutePath());
-            for (TestName tn: TestName.values()) {
-                changeTest(tn);
-                float t = getBenchmark();
-                String s = new String("" + tn.toString() + ", " + t);
-                rsWriter.write(s + "\n");
-                Log.v(TAG, "Test " + s + "ms\n");
-            }
-            rsWriter.close();
-        } catch (IOException e) {
-            Log.v(TAG, "Unable to write result file " + e.getMessage());
-        }
-        changeTest(TestName.LEVELS_VEC3_RELAXED);
-    }
-
-
-
-    // For benchmark test
-    public float getBenchmark() {
-        if (mRS == null) {
-            return 0;
-        }
-        mDoingBenchmark = true;
-
-        mTest.setupBenchmark();
-        long result = 0;
-
-        //Log.v(TAG, "Warming");
-        long t = java.lang.System.currentTimeMillis() + 250;
-        do {
-            mTest.runTest();
-            mTest.finish();
-        } while (t > java.lang.System.currentTimeMillis());
-
-        //Log.v(TAG, "Benchmarking");
-        int ct = 0;
-        t = java.lang.System.currentTimeMillis();
-        do {
-            mTest.runTest();
-            mTest.finish();
-            ct++;
-        } while ((t+1000) > java.lang.System.currentTimeMillis());
-        t = java.lang.System.currentTimeMillis() - t;
-        float ft = (float)t;
-        ft /= ct;
-
-        mTest.exitBenchmark();
-        mDoingBenchmark = false;
-        return ft;
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTest.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTest.java
deleted file mode 100644
index 5263c615..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTest.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.image;
-
-import com.android.rs.image.ImageProcessingTestRunner;
-
-import android.os.Bundle;
-import com.android.rs.image.ImageProcessingActivity.TestName;
-
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.util.Log;
-
-/**
- * ImageProcessing benchmark test.
- * To run the test, please use command
- *
- * adb shell am instrument -e iteration <n> -w com.android.rs.image/.ImageProcessingTestRunner
- *
- */
-public class ImageProcessingTest extends ActivityInstrumentationTestCase2<ImageProcessingActivity> {
-    private final String TAG = "ImageProcessingTest";
-    private final String TEST_NAME = "Testname";
-    private final String ITERATIONS = "Iterations";
-    private final String BENCHMARK = "Benchmark";
-    private static int INSTRUMENTATION_IN_PROGRESS = 2;
-    private int mIteration;
-    private ImageProcessingActivity mActivity;
-
-    public ImageProcessingTest() {
-        super(ImageProcessingActivity.class);
-    }
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        setActivityInitialTouchMode(false);
-        mActivity = getActivity();
-        ImageProcessingTestRunner mRunner = (ImageProcessingTestRunner) getInstrumentation();
-        mIteration = mRunner.mIteration;
-        assertTrue("please enter a valid iteration value", mIteration > 0);
-   }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    class TestAction implements Runnable {
-        TestName mTestName;
-        float mResult;
-        public TestAction(TestName testName) {
-            mTestName = testName;
-        }
-        public void run() {
-            mActivity.changeTest(mTestName);
-            mResult = mActivity.getBenchmark();
-            Log.v(TAG, "Benchmark for test \"" + mTestName.toString() + "\" is: " + mResult);
-            synchronized(this) {
-                this.notify();
-            }
-        }
-        public float getBenchmark() {
-            return mResult;
-        }
-    }
-
-    // Set the benchmark thread to run on ui thread
-    // Synchronized the thread such that the test will wait for the benchmark thread to finish
-    public void runOnUiThread(Runnable action) {
-        synchronized(action) {
-            mActivity.runOnUiThread(action);
-            try {
-                action.wait();
-            } catch (InterruptedException e) {
-                Log.v(TAG, "waiting for action running on UI thread is interrupted: " +
-                        e.toString());
-            }
-        }
-    }
-
-    public void runTest(TestAction ta, String testName) {
-        float sum = 0;
-        for (int i = 0; i < mIteration; i++) {
-            runOnUiThread(ta);
-            float bmValue = ta.getBenchmark();
-            Log.v(TAG, "results for iteration " + i + " is " + bmValue);
-            sum += bmValue;
-        }
-        float avgResult = sum/mIteration;
-
-        // post result to INSTRUMENTATION_STATUS
-        Bundle results = new Bundle();
-        results.putString(TEST_NAME, testName);
-        results.putInt(ITERATIONS, mIteration);
-        results.putFloat(BENCHMARK, avgResult);
-        getInstrumentation().sendStatus(INSTRUMENTATION_IN_PROGRESS, results);
-    }
-
-    // Test case 0: Levels Vec3 Relaxed
-    @LargeTest
-    public void testLevelsVec3Relaxed() {
-        TestAction ta = new TestAction(TestName.LEVELS_VEC3_RELAXED);
-        runTest(ta, TestName.LEVELS_VEC3_RELAXED.name());
-    }
-
-    // Test case 1: Levels Vec4 Relaxed
-    @LargeTest
-    public void testLevelsVec4Relaxed() {
-        TestAction ta = new TestAction(TestName.LEVELS_VEC4_RELAXED);
-        runTest(ta, TestName.LEVELS_VEC4_RELAXED.name());
-    }
-
-    // Test case 2: Levels Vec3 Full
-    @LargeTest
-    public void testLevelsVec3Full() {
-        TestAction ta = new TestAction(TestName.LEVELS_VEC3_FULL);
-        runTest(ta, TestName.LEVELS_VEC3_FULL.name());
-    }
-
-    // Test case 3: Levels Vec4 Full
-    @LargeTest
-    public void testLevelsVec4Full() {
-        TestAction ta = new TestAction(TestName.LEVELS_VEC4_FULL);
-        runTest(ta, TestName.LEVELS_VEC4_FULL.name());
-    }
-
-    // Test case 4: Blur Radius 25
-    @LargeTest
-    public void testBlurRadius25() {
-        TestAction ta = new TestAction(TestName.BLUR_RADIUS_25);
-        runTest(ta, TestName.BLUR_RADIUS_25.name());
-    }
-
-    // Test case 5: Intrinsic Blur Radius 25
-    @LargeTest
-    public void testIntrinsicBlurRadius25() {
-        TestAction ta = new TestAction(TestName.INTRINSIC_BLUE_RADIUS_25);
-        runTest(ta, TestName.INTRINSIC_BLUE_RADIUS_25.name());
-    }
-
-    // Test case 6: Greyscale
-    @LargeTest
-    public void testGreyscale() {
-        TestAction ta = new TestAction(TestName.GREYSCALE);
-        runTest(ta, TestName.GREYSCALE.name());
-    }
-
-    // Test case 7: Grain
-    @LargeTest
-    public void testGrain() {
-        TestAction ta = new TestAction(TestName.GRAIN);
-        runTest(ta, TestName.GRAIN.name());
-    }
-
-    // Test case 8: Fisheye Full
-    @LargeTest
-    public void testFisheyeFull() {
-        TestAction ta = new TestAction(TestName.FISHEYE_FULL);
-        runTest(ta, TestName.FISHEYE_FULL.name());
-    }
-
-    // Test case 9: Fisheye Relaxed
-    @LargeTest
-    public void testFishEyeRelaxed() {
-        TestAction ta = new TestAction(TestName.FISHEYE_RELAXED);
-        runTest(ta, TestName.FISHEYE_RELAXED.name());
-    }
-
-    // Test case 10: Fisheye Approximate Full
-    @LargeTest
-    public void testFisheyeApproximateFull() {
-        TestAction ta = new TestAction(TestName.FISHEYE_APPROXIMATE_FULL);
-        runTest(ta, TestName.FISHEYE_APPROXIMATE_FULL.name());
-    }
-
-    // Test case 11: Fisheye Approximate Relaxed
-    @LargeTest
-    public void testFisheyeApproximateRelaxed() {
-        TestAction ta = new TestAction(TestName.FISHEYE_APPROXIMATE_RELAXED);
-        runTest(ta, TestName.FISHEYE_APPROXIMATE_RELAXED.name());
-    }
-
-    // Test case 12: Vignette Full
-    @LargeTest
-    public void testVignetteFull() {
-        TestAction ta = new TestAction(TestName.VIGNETTE_FULL);
-        runTest(ta, TestName.VIGNETTE_FULL.name());
-    }
-
-    // Test case 13: Vignette Relaxed
-    @LargeTest
-    public void testVignetteRelaxed() {
-        TestAction ta = new TestAction(TestName.VIGNETTE_RELAXED);
-        runTest(ta, TestName.VIGNETTE_RELAXED.name());
-    }
-
-    // Test case 14: Vignette Approximate Full
-    @LargeTest
-    public void testVignetteApproximateFull() {
-        TestAction ta = new TestAction(TestName.VIGNETTE_APPROXIMATE_FULL);
-        runTest(ta, TestName.VIGNETTE_APPROXIMATE_FULL.name());
-    }
-
-    // Test case 15: Vignette Approximate Relaxed
-    @LargeTest
-    public void testVignetteApproximateRelaxed() {
-        TestAction ta = new TestAction(TestName.VIGNETTE_APPROXIMATE_RELAXED);
-        runTest(ta, TestName.VIGNETTE_APPROXIMATE_RELAXED.name());
-    }
-
-    // Test case 16: Group Test (emulated)
-    @LargeTest
-    public void testGroupTestEmulated() {
-        TestAction ta = new TestAction(TestName.GROUP_TEST_EMULATED);
-        runTest(ta, TestName.GROUP_TEST_EMULATED.name());
-    }
-
-    // Test case 17: Group Test (native)
-    @LargeTest
-    public void testGroupTestNative() {
-        TestAction ta = new TestAction(TestName.GROUP_TEST_NATIVE);
-        runTest(ta, TestName.GROUP_TEST_NATIVE.name());
-    }
-
-    // Test case 18: Convolve 3x3
-    @LargeTest
-    public void testConvolve3x3() {
-        TestAction ta = new TestAction(TestName.CONVOLVE_3X3);
-        runTest(ta, TestName.CONVOLVE_3X3.name());
-    }
-
-    // Test case 19: Intrinsics Convolve 3x3
-    @LargeTest
-    public void testIntrinsicsConvolve3x3() {
-        TestAction ta = new TestAction(TestName.INTRINSICS_CONVOLVE_3X3);
-        runTest(ta, TestName.INTRINSICS_CONVOLVE_3X3.name());
-    }
-
-    // Test case 20: ColorMatrix
-    @LargeTest
-    public void testColorMatrix() {
-        TestAction ta = new TestAction(TestName.COLOR_MATRIX);
-        runTest(ta, TestName.COLOR_MATRIX.name());
-    }
-
-    // Test case 21: Intrinsics ColorMatrix
-    @LargeTest
-    public void testIntrinsicsColorMatrix() {
-        TestAction ta = new TestAction(TestName.INTRINSICS_COLOR_MATRIX);
-        runTest(ta, TestName.INTRINSICS_COLOR_MATRIX.name());
-    }
-
-    // Test case 22: Intrinsics ColorMatrix Grey
-    @LargeTest
-    public void testIntrinsicsColorMatrixGrey() {
-        TestAction ta = new TestAction(TestName.INTRINSICS_COLOR_MATRIX_GREY);
-        runTest(ta, TestName.INTRINSICS_COLOR_MATRIX_GREY.name());
-    }
-
-    // Test case 23: Copy
-    @LargeTest
-    public void testCopy() {
-        TestAction ta = new TestAction(TestName.COPY);
-        runTest(ta, TestName.COPY.name());
-    }
-
-    // Test case 24: CrossProcess (using LUT)
-    @LargeTest
-    public void testCrossProcessUsingLUT() {
-        TestAction ta = new TestAction(TestName.CROSS_PROCESS_USING_LUT);
-        runTest(ta, TestName.CROSS_PROCESS_USING_LUT.name());
-    }
-
-    // Test case 25: Convolve 5x5
-    @LargeTest
-    public void testConvolve5x5() {
-        TestAction ta = new TestAction(TestName.CONVOLVE_5X5);
-        runTest(ta, TestName.CONVOLVE_5X5.name());
-    }
-
-    // Test case 26: Intrinsics Convolve 5x5
-    @LargeTest
-    public void testIntrinsicsConvolve5x5() {
-        TestAction ta = new TestAction(TestName.INTRINSICS_CONVOLVE_5X5);
-        runTest(ta, TestName.INTRINSICS_CONVOLVE_5X5.name());
-    }
-
-    // Test case 27: Mandelbrot
-    @LargeTest
-    public void testMandelbrot() {
-        TestAction ta = new TestAction(TestName.MANDELBROT);
-        runTest(ta, TestName.MANDELBROT.name());
-    }
-
-    // Test case 28: Intrinsics Blend
-    @LargeTest
-    public void testIntrinsicsBlend() {
-        TestAction ta = new TestAction(TestName.INTRINSICS_BLEND);
-        runTest(ta, TestName.INTRINSICS_BLEND.name());
-    }
-
-    // Test case 29: Intrinsics Blur 25 uchar
-    @LargeTest
-    public void testIntrinsicsBlur25G() {
-        TestAction ta = new TestAction(TestName.INTRINSICS_BLUR_25G);
-        runTest(ta, TestName.INTRINSICS_BLUR_25G.name());
-    }
-
-    // Test case 30: Vibrance
-    @LargeTest
-    public void testVibrance() {
-        TestAction ta = new TestAction(TestName.VIBRANCE);
-        runTest(ta, TestName.VIBRANCE.name());
-    }
-
-    // Test case 31: BWFilter
-    @LargeTest
-    public void testBWFilter() {
-        TestAction ta = new TestAction(TestName.BW_FILTER);
-        runTest(ta, TestName.BW_FILTER.name());
-    }
-
-    // Test case 32: Shadows
-    @LargeTest
-    public void testShadows() {
-        TestAction ta = new TestAction(TestName.SHADOWS);
-        runTest(ta, TestName.SHADOWS.name());
-    }
-
-    // Test case 33: Contrast
-    @LargeTest
-    public void testContrast() {
-        TestAction ta = new TestAction(TestName.CONTRAST);
-        runTest(ta, TestName.CONTRAST.name());
-    }
-
-    // Test case 34: Exposure
-    @LargeTest
-    public void testExposure(){
-        TestAction ta = new TestAction(TestName.EXPOSURE);
-        runTest(ta, TestName.EXPOSURE.name());
-    }
-
-    // Test case 35: White Balance
-    @LargeTest
-    public void testWhiteBalance() {
-        TestAction ta = new TestAction(TestName.WHITE_BALANCE);
-        runTest(ta, TestName.WHITE_BALANCE.name());
-    }
-
-    // Test case 36: Color Cube
-    @LargeTest
-    public void testColorCube() {
-        TestAction ta = new TestAction(TestName.COLOR_CUBE);
-        runTest(ta, TestName.COLOR_CUBE.name());
-    }
-
-    // Test case 37: Color Cube (3D Intrinsic)
-    @LargeTest
-    public void testColorCube3DIntrinsic() {
-        TestAction ta = new TestAction(TestName.COLOR_CUBE_3D_INTRINSIC);
-        runTest(ta, TestName.COLOR_CUBE_3D_INTRINSIC.name());
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTestRunner.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTestRunner.java
deleted file mode 100644
index 36fbb3e..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ImageProcessingTestRunner.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.image;
-
-import com.android.rs.image.ImageProcessingTest;
-import android.os.Bundle;
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-import junit.framework.TestSuite;
-
-/**
- * Run the ImageProcessing benchmark test
- * adb shell am instrument -e iteration <n> -w com.android.rs.image/.ImageProcessingTestRunner
- *
- */
-public class ImageProcessingTestRunner extends InstrumentationTestRunner {
-    public int mIteration = 5;
-
-    @Override
-    public TestSuite getAllTests() {
-        TestSuite suite = new InstrumentationTestSuite(this);
-        suite.addTestSuite(ImageProcessingTest.class);
-        return suite;
-    }
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        String strIteration = (String) icicle.get("iteration");
-        if (strIteration != null) {
-            mIteration = Integer.parseInt(strIteration);
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/LevelsV4.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/LevelsV4.java
deleted file mode 100644
index 9eb5647..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/LevelsV4.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Matrix3f;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-
-public class LevelsV4 extends TestBase {
-    private ScriptC_levels_relaxed mScriptR;
-    private ScriptC_levels_full mScriptF;
-    private float mInBlack = 0.0f;
-    private float mOutBlack = 0.0f;
-    private float mInWhite = 255.0f;
-    private float mOutWhite = 255.0f;
-    private float mSaturation = 1.0f;
-
-    Matrix3f satMatrix = new Matrix3f();
-    float mInWMinInB;
-    float mOutWMinOutB;
-    float mOverInWMinInB;
-
-    boolean mUseFull;
-    boolean mUseV4;
-
-    LevelsV4(boolean useFull, boolean useV4) {
-        mUseFull = useFull;
-        mUseV4 = useV4;
-    }
-
-
-    private void setLevels() {
-        mInWMinInB = mInWhite - mInBlack;
-        mOutWMinOutB = mOutWhite - mOutBlack;
-        mOverInWMinInB = 1.f / mInWMinInB;
-
-        mScriptR.set_inBlack(mInBlack);
-        mScriptR.set_outBlack(mOutBlack);
-        mScriptR.set_inWMinInB(mInWMinInB);
-        mScriptR.set_outWMinOutB(mOutWMinOutB);
-        mScriptR.set_overInWMinInB(mOverInWMinInB);
-        mScriptF.set_inBlack(mInBlack);
-        mScriptF.set_outBlack(mOutBlack);
-        mScriptF.set_inWMinInB(mInWMinInB);
-        mScriptF.set_outWMinOutB(mOutWMinOutB);
-        mScriptF.set_overInWMinInB(mOverInWMinInB);
-    }
-
-    private void setSaturation() {
-        float rWeight = 0.299f;
-        float gWeight = 0.587f;
-        float bWeight = 0.114f;
-        float oneMinusS = 1.0f - mSaturation;
-
-        satMatrix.set(0, 0, oneMinusS * rWeight + mSaturation);
-        satMatrix.set(0, 1, oneMinusS * rWeight);
-        satMatrix.set(0, 2, oneMinusS * rWeight);
-        satMatrix.set(1, 0, oneMinusS * gWeight);
-        satMatrix.set(1, 1, oneMinusS * gWeight + mSaturation);
-        satMatrix.set(1, 2, oneMinusS * gWeight);
-        satMatrix.set(2, 0, oneMinusS * bWeight);
-        satMatrix.set(2, 1, oneMinusS * bWeight);
-        satMatrix.set(2, 2, oneMinusS * bWeight + mSaturation);
-        mScriptR.set_colorMat(satMatrix);
-        mScriptF.set_colorMat(satMatrix);
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        b.setProgress(50);
-        t.setText("Saturation");
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(0);
-        t.setText("In Black");
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(0);
-        t.setText("Out Black");
-        return true;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(128);
-        t.setText("Out White");
-        return true;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(128);
-        t.setText("Out White");
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        mSaturation = (float)progress / 50.0f;
-        setSaturation();
-    }
-    public void onBar2Changed(int progress) {
-        mInBlack = (float)progress;
-        setLevels();
-    }
-    public void onBar3Changed(int progress) {
-        mOutBlack = (float)progress;
-        setLevels();
-    }
-    public void onBar4Changed(int progress) {
-        mInWhite = (float)progress + 127.0f;
-        setLevels();
-    }
-    public void onBar5Changed(int progress) {
-        mOutWhite = (float)progress + 127.0f;
-        setLevels();
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mScriptR = new ScriptC_levels_relaxed(mRS, res, R.raw.levels_relaxed);
-        mScriptF = new ScriptC_levels_full(mRS, res, R.raw.levels_full);
-        setSaturation();
-        setLevels();
-    }
-
-    public void runTest() {
-        if (mUseFull) {
-            if (mUseV4) {
-                mScriptF.forEach_root4(mInPixelsAllocation, mOutPixelsAllocation);
-            } else {
-                mScriptF.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-            }
-        } else {
-            if (mUseV4) {
-                mScriptR.forEach_root4(mInPixelsAllocation, mOutPixelsAllocation);
-            } else {
-                mScriptR.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-            }
-        }
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Mandelbrot.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Mandelbrot.java
deleted file mode 100644
index 20036e6..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Mandelbrot.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Mandelbrot extends TestBase {
-    private ScriptC_mandelbrot mScript;
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Iterations");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        int iters = progress * 3 + 50;
-        mScript.set_gMaxIteration(iters);
-    }
-
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Lower Bound: X");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar2Changed(int progress) {
-        float scaleFactor = mScript.get_scaleFactor();
-        // allow viewport to be moved by 2x scale factor
-        float lowerBoundX = -2.f + ((progress / scaleFactor) / 50.f);
-        mScript.set_lowerBoundX(lowerBoundX);
-    }
-
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Lower Bound: Y");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar3Changed(int progress) {
-        float scaleFactor = mScript.get_scaleFactor();
-        // allow viewport to be moved by 2x scale factor
-        float lowerBoundY = -2.f + ((progress / scaleFactor) / 50.f);
-        mScript.set_lowerBoundY(lowerBoundY);
-    }
-
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        t.setText("Scale Factor");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar4Changed(int progress) {
-        float scaleFactor = 4.f - (3.96f * (progress / 100.f));
-        mScript.set_scaleFactor(scaleFactor);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mOutPixelsAllocation.getType().getX();
-        int height = mOutPixelsAllocation.getType().getY();
-
-        mScript = new ScriptC_mandelbrot(mRS, res, R.raw.mandelbrot);
-        mScript.set_gDimX(width);
-        mScript.set_gDimY(height);
-        mScript.set_gMaxIteration(50);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mOutPixelsAllocation);
-        mRS.finish();
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Shadows.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Shadows.java
deleted file mode 100644
index 98ab15f..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Shadows.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Shadows extends TestBase {
-    private ScriptC_shadows mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_shadows(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_prepareShadows(50.f);
-        mScript.forEach_shadowsKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
deleted file mode 100644
index a353d9c..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/TestBase.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.renderscript.ScriptC;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Script;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.view.View;
-import android.util.Log;
-import java.lang.Math;
-import android.widget.Spinner;
-
-public class TestBase  {
-    protected final String TAG = "Img";
-
-    protected RenderScript mRS;
-    protected Allocation mInPixelsAllocation;
-    protected Allocation mInPixelsAllocation2;
-    protected Allocation mOutPixelsAllocation;
-    protected ImageProcessingActivity act;
-
-    private class MessageProcessor extends RenderScript.RSMessageHandler {
-        ImageProcessingActivity mAct;
-
-        MessageProcessor(ImageProcessingActivity act) {
-            mAct = act;
-        }
-
-        public void run() {
-            mAct.updateDisplay();
-        }
-    }
-
-    // Override to use UI elements
-    public void onBar1Changed(int progress) {
-    }
-    public void onBar2Changed(int progress) {
-    }
-    public void onBar3Changed(int progress) {
-    }
-    public void onBar4Changed(int progress) {
-    }
-    public void onBar5Changed(int progress) {
-    }
-
-    // Override to use UI elements
-    // Unused bars will be hidden.
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-
-    public boolean onSpinner1Setup(Spinner s) {
-        s.setVisibility(View.INVISIBLE);
-        return false;
-    }
-
-    public final void createBaseTest(ImageProcessingActivity ipact, Bitmap b, Bitmap b2, Bitmap outb) {
-        act = ipact;
-        mRS = ipact.mRS;
-        mRS.setMessageHandler(new MessageProcessor(act));
-
-        mInPixelsAllocation = ipact.mInPixelsAllocation;
-        mInPixelsAllocation2 = ipact.mInPixelsAllocation2;
-        mOutPixelsAllocation = ipact.mOutPixelsAllocation;
-
-        createTest(act.getResources());
-    }
-
-    // Must override
-    public void createTest(android.content.res.Resources res) {
-    }
-
-    // Must override
-    public void runTest() {
-    }
-
-    final public void runTestSendMessage() {
-        runTest();
-        mRS.sendMessage(0, null);
-    }
-
-    public void finish() {
-        mRS.finish();
-    }
-
-    public void destroy() {
-        mRS.setMessageHandler(null);
-    }
-
-    public void updateBitmap(Bitmap b) {
-        mOutPixelsAllocation.copyTo(b);
-    }
-
-    // Override to configure specific benchmark config.
-    public void setupBenchmark() {
-    }
-
-    // Override to reset after benchmark.
-    public void exitBenchmark() {
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/UsageIO.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/UsageIO.java
deleted file mode 100644
index 3f86311..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/UsageIO.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.image;
-
-import java.lang.Math;
-
-import android.view.Surface;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicConvolve3x3;
-import android.renderscript.ScriptIntrinsicColorMatrix;
-import android.renderscript.Type;
-import android.renderscript.Matrix4f;
-import android.renderscript.ScriptGroup;
-import android.util.Log;
-
-public class UsageIO extends TestBase {
-    private ScriptIntrinsicColorMatrix mMatrix;
-
-    private Allocation mScratchPixelsAllocation1;
-    private Allocation mScratchPixelsAllocation2;
-
-    public UsageIO() {
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-        mMatrix.setColorMatrix(m);
-
-        Type connect = mInPixelsAllocation.getType();
-
-        mScratchPixelsAllocation1 = Allocation.createTyped(mRS, connect, Allocation.USAGE_IO_OUTPUT | Allocation.USAGE_SCRIPT);
-        mScratchPixelsAllocation2 = Allocation.createTyped(mRS, connect, Allocation.USAGE_IO_INPUT | Allocation.USAGE_SCRIPT);
-
-        Surface s = mScratchPixelsAllocation2.getSurface();
-        mScratchPixelsAllocation1.setSurface(s);
-    }
-
-    public void runTest() {
-        mScratchPixelsAllocation1.copyFrom(mInPixelsAllocation);
-        mScratchPixelsAllocation1.ioSend();
-        mScratchPixelsAllocation2.ioReceive();
-        mMatrix.forEach(mScratchPixelsAllocation2, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vibrance.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vibrance.java
deleted file mode 100644
index 0bc1ff7..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vibrance.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Vibrance extends TestBase {
-    private ScriptC_vibrance mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_vibrance(mRS);
-    }
-
-    public void runTest() {
-        mScript.set_vibrance(50.f);
-        mScript.invoke_prepareVibrance();
-        mScript.forEach_vibranceKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java
deleted file mode 100644
index 18d1103..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/Vignette.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Sampler;
-import android.renderscript.Type;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Vignette extends TestBase {
-    private ScriptC_vignette_full mScript_full = null;
-    private ScriptC_vignette_relaxed mScript_relaxed = null;
-    private ScriptC_vignette_approx_full mScript_approx_full = null;
-    private ScriptC_vignette_approx_relaxed mScript_approx_relaxed = null;
-    private final boolean approx;
-    private final boolean relaxed;
-    private float center_x = 0.5f;
-    private float center_y = 0.5f;
-    private float scale = 0.5f;
-    private float shade = 0.5f;
-    private float slope = 20.0f;
-
-    public Vignette(boolean approx, boolean relaxed) {
-        this.approx = approx;
-        this.relaxed = relaxed;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Scale");
-        b.setMax(100);
-        b.setProgress(25);
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Shade");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Slope");
-        b.setMax(100);
-        b.setProgress(20);
-        return true;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        t.setText("Shift center X");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        t.setText("Shift center Y");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        scale = progress / 50.0f;
-        do_init();
-    }
-    public void onBar2Changed(int progress) {
-        shade = progress / 100.0f;
-        do_init();
-    }
-    public void onBar3Changed(int progress) {
-        slope = (float)progress;
-        do_init();
-    }
-    public void onBar4Changed(int progress) {
-        center_x = progress / 100.0f;
-        do_init();
-    }
-    public void onBar5Changed(int progress) {
-        center_y = progress / 100.0f;
-        do_init();
-    }
-
-    private void do_init() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.invoke_init_vignette(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale, shade, slope);
-            else
-                mScript_approx_full.invoke_init_vignette(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale, shade, slope);
-        } else if (relaxed)
-            mScript_relaxed.invoke_init_vignette(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale, shade, slope);
-        else
-            mScript_full.invoke_init_vignette(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale, shade, slope);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed = new ScriptC_vignette_approx_relaxed(
-                        mRS, res, R.raw.vignette_approx_relaxed);
-            else
-                mScript_approx_full = new ScriptC_vignette_approx_full(
-                        mRS, res, R.raw.vignette_approx_full);
-        } else if (relaxed)
-            mScript_relaxed = new ScriptC_vignette_relaxed(mRS, res,
-                    R.raw.vignette_relaxed);
-        else
-            mScript_full = new ScriptC_vignette_full(mRS, res,
-                    R.raw.vignette_full);
-        do_init();
-    }
-
-    public void runTest() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.forEach_root(mInPixelsAllocation,
-                        mOutPixelsAllocation);
-            else
-                mScript_approx_full.forEach_root(mInPixelsAllocation,
-                        mOutPixelsAllocation);
-        } else if (relaxed)
-            mScript_relaxed.forEach_root(mInPixelsAllocation,
-                    mOutPixelsAllocation);
-        else
-            mScript_full.forEach_root(mInPixelsAllocation,
-                    mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/WhiteBalance.java b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/WhiteBalance.java
deleted file mode 100644
index a836067..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/WhiteBalance.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class WhiteBalance extends TestBase {
-    private ScriptC_wbalance mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_wbalance(mRS);
-    }
-
-    public void runTest() {
-        mScript.set_histogramSource(mInPixelsAllocation);
-        mScript.set_histogramWidth(mInPixelsAllocation.getType().getX());
-        mScript.set_histogramHeight(mInPixelsAllocation.getType().getY());
-        mScript.invoke_prepareWhiteBalance();
-        mScript.forEach_whiteBalanceKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/blend.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/blend.rs
deleted file mode 100644
index 9ec1246..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/blend.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2011 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.
-
-#include "ip.rsh"
-
-uchar alpha = 0x0;
-
-void setImageAlpha(uchar4 *v_out, uint32_t x, uint32_t y) {
-  v_out->rgba = convert_uchar4((convert_uint4(v_out->rgba) * alpha) >> (uint4)8);
-  v_out->a = alpha;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/bwfilter.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/bwfilter.rs
deleted file mode 100644
index e706d44..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/bwfilter.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static float sr = 0.f;
-static float sg = 0.f;
-static float sb = 0.f;
-
-void prepareBwFilter(uint32_t rw, uint32_t gw, uint32_t bw) {
-
-    sr = rw;
-    sg = gw;
-    sb = bw;
-
-    float imageMin = min(sg,sb);
-    imageMin = fmin(sr,imageMin);
-    float imageMax = max(sg,sb);
-    imageMax = fmax(sr,imageMax);
-    float avg = (imageMin + imageMax)/2;
-    sb /= avg;
-    sg /= avg;
-    sr /= avg;
-
-}
-
-void bwFilterKernel(const uchar4 *in, uchar4 *out) {
-    float r = in->r * sr;
-    float g = in->g * sg;
-    float b = in->b * sb;
-    float localMin, localMax, avg;
-    localMin = fmin(g,b);
-    localMin = fmin(r,localMin);
-    localMax = fmax(g,b);
-    localMax = fmax(r,localMax);
-    avg = (localMin+localMax) * 0.5f;
-    out->r = out->g = out->b = rsClamp(avg, 0, 255);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colorcube.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colorcube.rs
deleted file mode 100644
index 4f1e73e..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colorcube.rs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-#pragma rs_fp_relaxed
-
-
-static rs_allocation gCube;
-static int4 gDims;
-static int4 gCoordMul;
-
-
-void setCube(rs_allocation c) {
-    gCube = c;
-    gDims.x = rsAllocationGetDimX(gCube);
-    gDims.y = rsAllocationGetDimY(gCube);
-    gDims.z = rsAllocationGetDimZ(gCube);
-    gDims.w = 0;
-
-    float4 m = (float4)(1.f / 255.f) * convert_float4(gDims - 1);
-    gCoordMul = convert_int4(m * (float4)0x10000);
-
-    rsDebug("dims", gDims);
-    rsDebug("gCoordMul", gCoordMul);
-}
-
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
-    //rsDebug("root", in);
-
-    int4 baseCoord = convert_int4(*in) * gCoordMul;
-    int4 coord1 = baseCoord >> (int4)16;
-    int4 coord2 = min(coord1 + 1, gDims - 1);
-
-    int4 weight2 = baseCoord & 0xffff;
-    int4 weight1 = (int4)0x10000 - weight2;
-
-    uint4 v000 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord1.y, coord1.z));
-    uint4 v100 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord1.y, coord1.z));
-    uint4 v010 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord2.y, coord1.z));
-    uint4 v110 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord2.y, coord1.z));
-    uint4 v001 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord1.y, coord2.z));
-    uint4 v101 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord1.y, coord2.z));
-    uint4 v011 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord2.y, coord2.z));
-    uint4 v111 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord2.y, coord2.z));
-
-    uint4 yz00 = ((v000 * weight1.x) + (v100 * weight2.x)) >> (int4)8;
-    uint4 yz10 = ((v010 * weight1.x) + (v110 * weight2.x)) >> (int4)8;
-    uint4 yz01 = ((v001 * weight1.x) + (v101 * weight2.x)) >> (int4)8;
-    uint4 yz11 = ((v011 * weight1.x) + (v111 * weight2.x)) >> (int4)8;
-
-    uint4 z0 = ((yz00 * weight1.y) + (yz10 * weight2.y)) >> (int4)16;
-    uint4 z1 = ((yz01 * weight1.y) + (yz11 * weight2.y)) >> (int4)16;
-
-    uint4 v = ((z0 * weight1.z) + (z1 * weight2.z)) >> (int4)16;
-    uint4 v2 = (v + 0x7f) >> (int4)8;
-
-    *out = convert_uchar4(v2);
-    out->a = 0xff;
-
-    #if 0
-    if (in->r != out->r) {
-        rsDebug("dr", in->r - out->r);
-        //rsDebug("in", convert_int4(*in));
-        //rsDebug("coord1", coord1);
-        //rsDebug("coord2", coord2);
-        //rsDebug("weight1", weight1);
-        //rsDebug("weight2", weight2);
-        //rsDebug("yz00", yz00);
-        //rsDebug("z0", z0);
-        //rsDebug("v", v);
-        //rsDebug("v2", v2);
-        //rsDebug("out", convert_int4(*out));
-    }
-    #endif
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.fs
deleted file mode 100644
index 86fb248..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/colormatrix.fs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static rs_matrix4x4 Mat;
-
-void init() {
-    rsMatrixLoadIdentity(&Mat);
-}
-
-void setMatrix(rs_matrix4x4 m) {
-    Mat = m;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in) {
-    float4 f = convert_float4(in);
-    f = rsMatrixMultiply(&Mat, f);
-    f = clamp(f, 0.f, 255.f);
-    return convert_uchar4(f);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/contrast.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/contrast.rs
deleted file mode 100644
index d3743d3..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/contrast.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static float brightM = 0.f;
-static float brightC = 0.f;
-
-void setBright(float v) {
-    brightM = pow(2.f, v / 100.f);
-    brightC = 127.f - brightM * 127.f;
-}
-
-void contrast(const uchar4 *in, uchar4 *out)
-{
-#if 0
-    out->r = rsClamp((int)(brightM * in->r + brightC), 0, 255);
-    out->g = rsClamp((int)(brightM * in->g + brightC), 0, 255);
-    out->b = rsClamp((int)(brightM * in->b + brightC), 0, 255);
-#else
-    float3 v = convert_float3(in->rgb) * brightM + brightC;
-    out->rgb = convert_uchar3(clamp(v, 0.f, 255.f));
-#endif
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.fs
deleted file mode 100644
index 177e86e..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve3x3.fs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-int32_t gWidth;
-int32_t gHeight;
-rs_allocation gIn;
-
-float gCoeffs[9];
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    uint32_t x1 = min((int32_t)x+1, gWidth-1);
-    uint32_t x2 = max((int32_t)x-1, 0);
-    uint32_t y1 = min((int32_t)y+1, gHeight-1);
-    uint32_t y2 = max((int32_t)y-1, 0);
-
-    float4 p00 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y1));
-    float4 p01 = convert_float4(rsGetElementAt_uchar4(gIn, x, y1));
-    float4 p02 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y1));
-    float4 p10 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y));
-    float4 p11 = convert_float4(rsGetElementAt_uchar4(gIn, x, y));
-    float4 p12 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y));
-    float4 p20 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y2));
-    float4 p21 = convert_float4(rsGetElementAt_uchar4(gIn, x, y2));
-    float4 p22 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y2));
-    p00 *= gCoeffs[0];
-    p01 *= gCoeffs[1];
-    p02 *= gCoeffs[2];
-    p10 *= gCoeffs[3];
-    p11 *= gCoeffs[4];
-    p12 *= gCoeffs[5];
-    p20 *= gCoeffs[6];
-    p21 *= gCoeffs[7];
-    p22 *= gCoeffs[8];
-
-    p00 += p01;
-    p02 += p10;
-    p11 += p12;
-    p20 += p21;
-
-    p22 += p00;
-    p02 += p11;
-
-    p20 += p22;
-    p20 += p02;
-
-    p20 = clamp(p20, 0.f, 255.f);
-    return convert_uchar4(p20);
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.fs
deleted file mode 100644
index 922a593..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/convolve5x5.fs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-int32_t gWidth;
-int32_t gHeight;
-rs_allocation gIn;
-
-float gCoeffs[25];
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    uint32_t x0 = max((int32_t)x-2, 0);
-    uint32_t x1 = max((int32_t)x-1, 0);
-    uint32_t x2 = x;
-    uint32_t x3 = min((int32_t)x+1, gWidth-1);
-    uint32_t x4 = min((int32_t)x+2, gWidth-1);
-
-    uint32_t y0 = max((int32_t)y-2, 0);
-    uint32_t y1 = max((int32_t)y-1, 0);
-    uint32_t y2 = y;
-    uint32_t y3 = min((int32_t)y+1, gHeight-1);
-    uint32_t y4 = min((int32_t)y+2, gHeight-1);
-
-    float4 p0 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y0)) * gCoeffs[0]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y0)) * gCoeffs[1]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y0)) * gCoeffs[2]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y0)) * gCoeffs[3]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y0)) * gCoeffs[4];
-
-    float4 p1 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y1)) * gCoeffs[5]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y1)) * gCoeffs[6]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y1)) * gCoeffs[7]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y1)) * gCoeffs[8]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y1)) * gCoeffs[9];
-
-    float4 p2 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y2)) * gCoeffs[10]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y2)) * gCoeffs[11]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y2)) * gCoeffs[12]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y2)) * gCoeffs[13]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y2)) * gCoeffs[14];
-
-    float4 p3 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y3)) * gCoeffs[15]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y3)) * gCoeffs[16]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y3)) * gCoeffs[17]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y3)) * gCoeffs[18]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y3)) * gCoeffs[19];
-
-    float4 p4 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y4)) * gCoeffs[20]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y4)) * gCoeffs[21]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y4)) * gCoeffs[22]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y4)) * gCoeffs[23]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y4)) * gCoeffs[24];
-
-    p0 = clamp(p0 + p1 + p2 + p3 + p4, 0.f, 255.f);
-    return convert_uchar4(p0);
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.fs
deleted file mode 100644
index 6595874..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/copy.fs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-uchar4 __attribute__((kernel)) root(uchar4 v_in) {
-    return v_in;
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/exposure.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/exposure.rs
deleted file mode 100644
index 0f05cb9..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/exposure.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static float bright = 0.f;
-
-void setBright(float v) {
-    bright = 255.f / (255.f - v);
-}
-
-void exposure(const uchar4 *in, uchar4 *out)
-{
-    out->r = rsClamp((int)(bright * in->r), 0, 255);
-    out->g = rsClamp((int)(bright * in->g), 0, 255);
-    out->b = rsClamp((int)(bright * in->b), 0, 255);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
deleted file mode 100644
index 2eacb7d..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye.rsh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-rs_allocation in_alloc;
-rs_sampler sampler;
-
-static float2 center, neg_center, inv_dimensions, axis_scale;
-static float alpha, radius2, factor;
-
-void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y, float k) {
-    center.x = center_x;
-    center.y = center_y;
-    neg_center = -center;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-    alpha = k * 2.0f + 0.75f;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-    
-    const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
-    const float bound = sqrt(bound2);
-    const float radius = 1.15f * bound;
-    radius2 = radius*radius;
-    const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
-    factor = bound / max_radian;
-}
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float2 scaledCoord = axis_scale * coord;
-    const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
-    const float inv_dist = rsqrt(dist2);
-    const float radian = M_PI_2 - atan((alpha * sqrt(radius2 - dist2)) * inv_dist);
-    const float scalar = radian * factor * inv_dist;
-    const float2 new_coord = mad(coord, scalar, center);
-    const float4 fout = rsSample(in_alloc, sampler, new_coord);
-    return rsPackColorTo8888(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh
deleted file mode 100644
index fcf0a3d..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx.rsh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-rs_allocation in_alloc;
-rs_sampler sampler;
-
-static float2 center, neg_center, inv_dimensions, axis_scale;
-static float alpha, radius2, factor;
-
-void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y, float k) {
-    center.x = center_x;
-    center.y = center_y;
-    neg_center = -center;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-    alpha = k * 2.0f + 0.75f;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
-    const float bound = sqrt(bound2);
-    const float radius = 1.15f * bound;
-    radius2 = radius*radius;
-    const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
-    factor = bound / max_radian;
-}
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float2 scaledCoord = axis_scale * coord;
-    const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
-    const float inv_dist = half_rsqrt(dist2);
-    const float radian = M_PI_2 - atan((alpha * half_sqrt(radius2 - dist2)) * inv_dist);
-    const float scalar = radian * factor * inv_dist;
-    const float2 new_coord = mad(coord, scalar, center);
-    const float4 fout = rsSample(in_alloc, sampler, new_coord);
-    return rsPackColorTo8888(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_full.rs
deleted file mode 100644
index ed69ff4..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.fs
deleted file mode 100644
index ed69ff4..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_approx_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs
deleted file mode 100644
index f986b5d..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.fs
deleted file mode 100644
index f986b5d..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/fisheye_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.fs
deleted file mode 100644
index 2e62cd7..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/grain.fs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-uchar __attribute__((kernel)) genRand() {
-    return (uchar)rsRand(0xff);
-}
-
-/*
- * Convolution matrix of distance 2 with fixed point of 'kShiftBits' bits
- * shifted. Thus the sum of this matrix should be 'kShiftValue'. Entries of
- * small values are not calculated to gain efficiency.
- * The order ot pixels represented in this matrix is:
- *  1  2  3
- *  4  0  5
- *  6  7  8
- *  and the matrix should be: {230, 56, 114, 56, 114, 114, 56, 114, 56}.
- *  However, since most of the valus are identical, we only use the first three
- *  entries and the entries corresponding to the pixels is:
- *  1  2  1
- *  2  0  2
- *  1  2  1
- */
-
-int32_t gWMask;
-int32_t gHMask;
-
-rs_allocation gBlendSource;
-uchar __attribute__((kernel)) blend9(uint32_t x, uint32_t y) {
-    uint32_t x1 = (x-1) & gWMask;
-    uint32_t x2 = (x+1) & gWMask;
-    uint32_t y1 = (y-1) & gHMask;
-    uint32_t y2 = (y+1) & gHMask;
-
-    uint p00 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y1);
-    uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1);
-    uint p02 = 56 *  rsGetElementAt_uchar(gBlendSource, x2, y1);
-    uint p10 = 114 * rsGetElementAt_uchar(gBlendSource, x1, y);
-    uint p11 = 230 * rsGetElementAt_uchar(gBlendSource, x, y);
-    uint p12 = 114 * rsGetElementAt_uchar(gBlendSource, x2, y);
-    uint p20 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y2);
-    uint p21 = 114 * rsGetElementAt_uchar(gBlendSource, x, y2);
-    uint p22 = 56 *  rsGetElementAt_uchar(gBlendSource, x2, y2);
-
-    p00 += p01;
-    p02 += p10;
-    p11 += p12;
-    p20 += p21;
-
-    p22 += p00;
-    p02 += p11;
-
-    p20 += p22;
-    p20 += p02;
-
-    p20 = min(p20 >> 10, (uint)255);
-    return (uchar)p20;
-}
-
-float gNoiseStrength;
-
-rs_allocation gNoise;
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    float4 ip = convert_float4(in);
-    float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask);
-
-    float energy_level = ip.r + ip.g + ip.b;
-    float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f;
-    pnoise = (pnoise - 128.f) * energy_mask;
-
-    ip += pnoise * gNoiseStrength;
-    ip = clamp(ip, 0.f, 255.f);
-
-    uchar4 p = convert_uchar4(ip);
-    p.a = 0xff;
-    return p;
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.fs
deleted file mode 100644
index 4e13072..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/greyscale.fs
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
-
-uchar4 __attribute__((kernel)) root(uchar4 v_in) {
-    float4 f4 = rsUnpackColor8888(v_in);
-
-    float3 mono = dot(f4.rgb, gMonoMult);
-    return rsPackColorTo8888(mono);
-}
-
-uchar __attribute__((kernel)) toU8(uchar4 v_in) {
-    float4 f4 = convert_float4(v_in);
-    return (uchar)dot(f4.rgb, gMonoMult);
-}
-
-uchar4 __attribute__((kernel)) toU8_4(uchar v_in) {
-    return (uchar4)v_in;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ip.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ip.rsh
deleted file mode 100644
index 01a3346..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/ip.rsh
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.android.rs.image)
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh
deleted file mode 100644
index e289906..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels.rsh
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-float inBlack;
-float outBlack;
-float inWMinInB;
-float outWMinOutB;
-float overInWMinInB;
-rs_matrix3x3 colorMat;
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    uchar4 out;
-    float3 pixel = convert_float4(in).rgb;
-    pixel = rsMatrixMultiply(&colorMat, pixel);
-    pixel = clamp(pixel, 0.f, 255.f);
-    pixel = (pixel - inBlack) * overInWMinInB;
-    pixel = pixel * outWMinOutB + outBlack;
-    pixel = clamp(pixel, 0.f, 255.f);
-    out.xyz = convert_uchar3(pixel);
-    out.w = 0xff;
-    return out;
-}
-
-uchar4 __attribute__((kernel)) root4(uchar4 in, uint32_t x, uint32_t y) {
-    float4 pixel = convert_float4(in);
-    pixel.rgb = rsMatrixMultiply(&colorMat, pixel.rgb);
-    pixel = clamp(pixel, 0.f, 255.f);
-    pixel = (pixel - inBlack) * overInWMinInB;
-    pixel = pixel * outWMinOutB + outBlack;
-    pixel = clamp(pixel, 0.f, 255.f);
-    return convert_uchar4(pixel);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_full.rs
deleted file mode 100644
index 28596ba..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "levels.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.fs
deleted file mode 100644
index 28596ba..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/levels_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "levels.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs
deleted file mode 100644
index de0bd002c..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/mandelbrot.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2011 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.
-
-#include "ip.rsh"
-
-uint32_t gMaxIteration = 500;
-uint32_t gDimX = 1024;
-uint32_t gDimY = 1024;
-
-float lowerBoundX = -2.f;
-float lowerBoundY = -2.f;
-float scaleFactor = 4.f;
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-  float2 p;
-  p.x = lowerBoundX + ((float)x / gDimX) * scaleFactor;
-  p.y = lowerBoundY + ((float)y / gDimY) * scaleFactor;
-
-  float2 t = 0;
-  float2 t2 = t * t;
-  int iter = 0;
-  while((t2.x + t2.y < 4.f) && (iter < gMaxIteration)) {
-    float xtemp = t2.x - t2.y + p.x;
-    t.y = 2 * t.x * t.y + p.y;
-    t.x = xtemp;
-    iter++;
-    t2 = t * t;
-  }
-
-  if(iter >= gMaxIteration) {
-    // write a non-transparent black pixel
-    return (uchar4){0, 0, 0, 0xff};
-  } else {
-    float mi3 = gMaxIteration / 3.f;
-    if (iter <= (gMaxIteration / 3))
-      return (uchar4){0xff * (iter / mi3), 0, 0, 0xff};
-    else if (iter <= (((gMaxIteration / 3) * 2)))
-      return (uchar4){0xff - (0xff * ((iter - mi3) / mi3)),
-                      (0xff * ((iter - mi3) / mi3)), 0, 0xff};
-    else
-      return (uchar4){0, 0xff - (0xff * ((iter - (mi3 * 2)) / mi3)),
-                      (0xff * ((iter - (mi3 * 2)) / mi3)), 0xff};
-  }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/shadows.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/shadows.rs
deleted file mode 100644
index f6c149d..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/shadows.rs
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static double shadowFilterMap[] = {
-    -0.00591,  0.0001,
-     1.16488,  0.01668,
-    -0.18027, -0.06791,
-    -0.12625,  0.09001,
-     0.15065, -0.03897
-};
-
-static double poly[] = {
-    0., 0.,
-    0., 0.,
-    0.
-};
-
-static const int ABITS = 4;
-static const int HSCALE = 256;
-static const int k1=255 << ABITS;
-static const int k2=HSCALE << ABITS;
-
-static double fastevalPoly(double *poly,int n, double x){
-
-    double f =x;
-    double sum = poly[0]+poly[1]*f;
-    int i;
-    for (i = 2; i < n; i++) {
-        f*=x;
-        sum += poly[i]*f;
-    }
-    return sum;
-}
-
-static ushort3 rgb2hsv( uchar4 rgb)
-{
-    int iMin,iMax,chroma;
-
-    int ri = rgb.r;
-    int gi = rgb.g;
-    int bi = rgb.b;
-    short rv,rs,rh;
-
-    if (ri > gi) {
-        iMax = max (ri, bi);
-        iMin = min (gi, bi);
-    } else {
-        iMax = max (gi, bi);
-        iMin = min (ri, bi);
-    }
-
-    chroma = iMax - iMin;
-    // set value
-    rv = (short)( iMax << ABITS);
-
-    // set saturation
-    if (rv == 0)
-        rs = 0;
-    else
-        rs = (short)((k1*chroma)/iMax);
-
-    // set hue
-    if (rs == 0)
-        rh = 0;
-    else {
-        if ( ri == iMax ) {
-            rh  = (short)( (k2*(6*chroma+gi - bi))/(6*chroma));
-            if (rh >= k2) rh -= k2;
-        } else if (gi  == iMax)
-            rh  = (short)( (k2*(2*chroma+bi - ri ))/(6*chroma));
-        else // (bi == iMax )
-                    rh  = (short)( (k2*(4*chroma+ri - gi ))/(6*chroma));
-    }
-
-    ushort3 out;
-    out.x = rv;
-    out.y = rs;
-    out.z = rh;
-    return out;
-}
-
-static uchar4 hsv2rgb(ushort3 hsv)
-{
-    int ABITS = 4;
-    int HSCALE = 256;
-    int m;
-    int H,X,ih,is,iv;
-    int k1=255<<ABITS;
-    int k2=HSCALE<<ABITS;
-    int k3=1<<(ABITS-1);
-    int rr=0;
-    int rg=0;
-    int rb=0;
-    short cv = hsv.x;
-    short cs = hsv.y;
-    short ch = hsv.z;
-
-    // set chroma and min component value m
-    //chroma = ( cv * cs )/k1;
-    //m = cv - chroma;
-    m = ((int)cv*(k1 - (int)cs ))/k1;
-
-    // chroma  == 0 <-> cs == 0 --> m=cv
-    if (cs == 0) {
-        rb = ( rg = ( rr =( cv >> ABITS) ));
-    } else {
-        ih=(int)ch;
-        is=(int)cs;
-        iv=(int)cv;
-
-        H = (6*ih)/k2;
-        X = ((iv*is)/k2)*(k2- abs(6*ih- 2*(H>>1)*k2 - k2)) ;
-
-        // removing additional bits --> unit8
-        X=( (X+iv*(k1 - is ))/k1 + k3 ) >> ABITS;
-        m=m >> ABITS;
-
-        // ( chroma + m ) --> cv ;
-        cv=(short) (cv >> ABITS);
-        switch (H) {
-        case 0:
-            rr = cv;
-            rg = X;
-            rb = m;
-            break;
-        case 1:
-            rr = X;
-            rg = cv;
-            rb = m;
-            break;
-        case 2:
-            rr = m;
-            rg = cv;
-            rb = X;
-            break;
-        case 3:
-            rr = m;
-            rg = X;
-            rb = cv;
-            break;
-        case 4:
-            rr = X;
-            rg = m;
-            rb = cv;
-            break;
-        case 5:
-            rr = cv;
-            rg = m ;
-            rb = X;
-            break;
-        }
-    }
-
-    uchar4 rgb;
-
-    rgb.r =  rr;
-    rgb.g =  rg;
-    rgb.b =  rb;
-
-    return rgb;
-}
-
-void prepareShadows(float scale) {
-    double s = (scale>=0)?scale:scale/5;
-    for (int i = 0; i < 5; i++) {
-        poly[i] = fastevalPoly(shadowFilterMap+i*2,2 , s);
-    }
-}
-
-void shadowsKernel(const uchar4 *in, uchar4 *out) {
-    ushort3 hsv = rgb2hsv(*in);
-    double v = (fastevalPoly(poly,5,hsv.x/4080.)*4080);
-    if (v>4080) v = 4080;
-    hsv.x = (unsigned short) ((v>0)?v:0);
-    *out = hsv2rgb(hsv);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.fs
deleted file mode 100644
index 0b2c2e8..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/threshold.fs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include "ip.rsh"
-
-
-int height;
-int width;
-static int radius;
-
-rs_allocation InPixel;
-rs_allocation ScratchPixel1;
-rs_allocation ScratchPixel2;
-
-const int MAX_RADIUS = 25;
-
-// Store our coefficients here
-static float gaussian[MAX_RADIUS * 2 + 1];
-
-void setRadius(int rad) {
-    radius = rad;
-    // Compute gaussian weights for the blur
-    // e is the euler's number
-    float e = 2.718281828459045f;
-    float pi = 3.1415926535897932f;
-    // g(x) = ( 1 / sqrt( 2 * pi ) * sigma) * e ^ ( -x^2 / 2 * sigma^2 )
-    // x is of the form [-radius .. 0 .. radius]
-    // and sigma varies with radius.
-    // Based on some experimental radius values and sigma's
-    // we approximately fit sigma = f(radius) as
-    // sigma = radius * 0.4  + 0.6
-    // The larger the radius gets, the more our gaussian blur
-    // will resemble a box blur since with large sigma
-    // the gaussian curve begins to lose its shape
-    float sigma = 0.4f * (float)radius + 0.6f;
-
-    // Now compute the coefficints
-    // We will store some redundant values to save some math during
-    // the blur calculations
-    // precompute some values
-    float coeff1 = 1.0f / (sqrt( 2.0f * pi ) * sigma);
-    float coeff2 = - 1.0f / (2.0f * sigma * sigma);
-
-    float normalizeFactor = 0.0f;
-    float floatR = 0.0f;
-    for (int r = -radius; r <= radius; r ++) {
-        floatR = (float)r;
-        gaussian[r + radius] = coeff1 * pow(e, floatR * floatR * coeff2);
-        normalizeFactor += gaussian[r + radius];
-    }
-
-    //Now we need to normalize the weights because all our coefficients need to add up to one
-    normalizeFactor = 1.0f / normalizeFactor;
-    for (int r = -radius; r <= radius; r ++) {
-        floatR = (float)r;
-        gaussian[r + radius] *= normalizeFactor;
-    }
-}
-
-float4 __attribute__((kernel)) copyIn(uchar4 in) {
-    return convert_float4(in);
-}
-
-uchar4 __attribute__((kernel)) vert(uint32_t x, uint32_t y) {
-    float3 blurredPixel = 0;
-    int gi = 0;
-    uchar4 out;
-    if ((y > radius) && (y < (height - radius))) {
-        for (int r = -radius; r <= radius; r ++) {
-            float4 i = rsGetElementAt_float4(ScratchPixel2, x, y + r);
-            blurredPixel += i.xyz * gaussian[gi++];
-        }
-    } else {
-        for (int r = -radius; r <= radius; r ++) {
-            int validH = rsClamp((int)y + r, (int)0, (int)(height - 1));
-            float4 i = rsGetElementAt_float4(ScratchPixel2, x, validH);
-            blurredPixel += i.xyz * gaussian[gi++];
-        }
-    }
-
-    out.xyz = convert_uchar3(clamp(blurredPixel, 0.f, 255.f));
-    out.w = 0xff;
-    return out;
-}
-
-float4 __attribute__((kernel)) horz(uint32_t x, uint32_t y) {
-    float4 blurredPixel = 0;
-    int gi = 0;
-    if ((x > radius) && (x < (width - radius))) {
-        for (int r = -radius; r <= radius; r ++) {
-            float4 i = rsGetElementAt_float4(ScratchPixel1, x + r, y);
-            blurredPixel += i * gaussian[gi++];
-        }
-    } else {
-        for (int r = -radius; r <= radius; r ++) {
-            // Stepping left and right away from the pixel
-            int validX = rsClamp((int)x + r, (int)0, (int)(width - 1));
-            float4 i = rsGetElementAt_float4(ScratchPixel1, validX, y);
-            blurredPixel += i * gaussian[gi++];
-        }
-    }
-
-    return blurredPixel;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vibrance.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vibrance.rs
deleted file mode 100644
index ad4de58..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vibrance.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-float vibrance = 0.f;
-
-static const float Rf = 0.2999f;
-static const float Gf = 0.587f;
-static const float Bf = 0.114f;
-
-static float S  = 0.f;
-static float MS = 0.f;
-static float Rt = 0.f;
-static float Gt = 0.f;
-static float Bt = 0.f;
-static float Vib = 0.f;
-
-void vibranceKernel(const uchar4 *in, uchar4 *out) {
-
-    float R, G, B;
-
-    int r = in->r;
-    int g = in->g;
-    int b = in->b;
-    float red = (r-max(g, b))/256.f;
-    float sx = (float)(Vib/(1+native_exp(-red*3)));
-    S = sx+1;
-    MS = 1.0f - S;
-    Rt = Rf * MS;
-    Gt = Gf * MS;
-    Bt = Bf * MS;
-    int t = (r + g) / 2;
-    R = r;
-    G = g;
-    B = b;
-
-    float Rc = R * (Rt + S) + G * Gt + B * Bt;
-    float Gc = R * Rt + G * (Gt + S) + B * Bt;
-    float Bc = R * Rt + G * Gt + B * (Bt + S);
-
-    out->r = rsClamp(Rc, 0, 255);
-    out->g = rsClamp(Gc, 0, 255);
-    out->b = rsClamp(Bc, 0, 255);
-
-}
-
-void prepareVibrance() {
-
-    Vib = vibrance/100.f;
-    S  = Vib + 1;
-    MS = 1.0f - S;
-    Rt = Rf * MS;
-    Gt = Gf * MS;
-    Bt = Bf * MS;
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
deleted file mode 100644
index 04ca1f1..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette.rsh
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-static float2 neg_center, axis_scale, inv_dimensions;
-static float sloped_neg_range, sloped_inv_max_dist, shade, opp_shade;
-
-void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
-        float desired_scale, float desired_shade, float desired_slope) {
-
-    neg_center.x = -center_x;
-    neg_center.y = -center_y;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float max_dist = 0.5f * length(axis_scale);
-    sloped_inv_max_dist = desired_slope * 1.f/max_dist;
-
-    // Range needs to be between 1.3 to 0.6. When scale is zero then range is
-    // 1.3 which means no vignette at all because the luminousity difference is
-    // less than 1/256.  Expect input scale to be between 0.0 and 1.0.
-    const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
-    sloped_neg_range = exp(neg_range * desired_slope);
-
-    shade = desired_shade;
-    opp_shade = 1.f - desired_shade;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float4 fin = convert_float4(in);
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float sloped_dist_ratio = length(axis_scale * coord)  * sloped_inv_max_dist;
-    const float lumen = opp_shade + shade / ( 1.0f + sloped_neg_range * exp(sloped_dist_ratio) );
-    float4 fout;
-    fout.rgb = fin.rgb * lumen;
-    fout.w = fin.w;
-    return convert_uchar4(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh
deleted file mode 100644
index 5668621..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx.rsh
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-static float2 neg_center, axis_scale, inv_dimensions;
-static float sloped_neg_range, sloped_inv_max_dist, shade, opp_shade;
-
-void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
-        float desired_scale, float desired_shade, float desired_slope) {
-
-    neg_center.x = -center_x;
-    neg_center.y = -center_y;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float max_dist = 0.5f * length(axis_scale);
-    sloped_inv_max_dist = desired_slope * 1.f/max_dist;
-
-    // Range needs to be between 1.3 to 0.6. When scale is zero then range is
-    // 1.3 which means no vignette at all because the luminousity difference is
-    // less than 1/256.  Expect input scale to be between 0.0 and 1.0.
-    const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
-    sloped_neg_range = exp(neg_range * desired_slope);
-
-    shade = desired_shade;
-    opp_shade = 1.f - desired_shade;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float4 fin = convert_float4(in);
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float sloped_dist_ratio = fast_length(axis_scale * coord)  * sloped_inv_max_dist;
-    const float lumen = opp_shade + shade * half_recip(1.f + sloped_neg_range * native_exp(sloped_dist_ratio));
-    float4 fout;
-    fout.rgb = fin.rgb * lumen;
-    fout.w = fin.w;
-    return convert_uchar4(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_full.rs
deleted file mode 100644
index 00cbbc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.fs
deleted file mode 100644
index 00cbbc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_approx_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs
deleted file mode 100644
index 8202c5c..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.fs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.fs
deleted file mode 100644
index 8202c5c..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/vignette_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/wbalance.rs b/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/wbalance.rs
deleted file mode 100644
index 6650671..0000000
--- a/tests/RenderScriptTests/ImageProcessing/src/com/android/rs/image/wbalance.rs
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static int histR[256] = {0}, histG[256] = {0}, histB[256] = {0};
-
-rs_allocation histogramSource;
-uint32_t histogramHeight;
-uint32_t histogramWidth;
-
-static float scaleR;
-static float scaleG;
-static float scaleB;
-
-static uchar4 estimateWhite() {
-
-    for (int i = 0; i < 256; i++) {
-        histR[i] = 0; histG[i] = 0; histB[i] = 0;
-    }
-
-    for (uint32_t i = 0; i < histogramHeight; i++) {
-        for (uint32_t j = 0; j < histogramWidth; j++) {
-            uchar4 in = rsGetElementAt_uchar4(histogramSource, j, i);
-            histR[in.r]++;
-            histG[in.g]++;
-            histB[in.b]++;
-        }
-    }
-
-    int min_r = -1, min_g = -1, min_b = -1;
-    int max_r =  0, max_g =  0, max_b =  0;
-    int sum_r =  0, sum_g =  0, sum_b =  0;
-
-    for (int i = 1; i < 255; i++) {
-        int r = histR[i];
-        int g = histG[i];
-        int b = histB[i];
-        sum_r += r;
-        sum_g += g;
-        sum_b += b;
-
-        if (r>0){
-            if (min_r < 0) min_r = i;
-            max_r = i;
-        }
-        if (g>0){
-            if (min_g < 0) min_g = i;
-            max_g = i;
-        }
-        if (b>0){
-            if (min_b < 0) min_b = i;
-            max_b = i;
-        }
-    }
-
-    int sum15r = 0, sum15g = 0, sum15b = 0;
-    int count15r = 0, count15g = 0, count15b = 0;
-    int tmp_r = 0, tmp_g = 0, tmp_b = 0;
-
-    for (int i = 254; i >0; i--) {
-        int r = histR[i];
-        int g = histG[i];
-        int b = histB[i];
-        tmp_r += r;
-        tmp_g += g;
-        tmp_b += b;
-
-        if ((tmp_r > sum_r/20) && (tmp_r < sum_r/5)) {
-            sum15r += r*i;
-            count15r += r;
-        }
-        if ((tmp_g > sum_g/20) && (tmp_g < sum_g/5)) {
-            sum15g += g*i;
-            count15g += g;
-        }
-        if ((tmp_b > sum_b/20) && (tmp_b < sum_b/5)) {
-            sum15b += b*i;
-            count15b += b;
-        }
-
-    }
-
-    uchar4 out;
-
-    if ((count15r>0) && (count15g>0) && (count15b>0) ){
-        out.r = sum15r/count15r;
-        out.g = sum15g/count15g;
-        out.b = sum15b/count15b;
-    }else {
-        out.r = out.g = out.b = 255;
-    }
-
-    return out;
-
-}
-
-void prepareWhiteBalance() {
-    uchar4 estimation = estimateWhite();
-    int minimum = min(estimation.r, min(estimation.g, estimation.b));
-    int maximum = max(estimation.r, max(estimation.g, estimation.b));
-    float avg = (minimum + maximum) / 2.f;
-
-    scaleR =  avg/estimation.r;
-    scaleG =  avg/estimation.g;
-    scaleB =  avg/estimation.b;
-
-}
-
-static unsigned char contrastClamp(int c)
-{
-    int N = 255;
-    c &= ~(c >> 31);
-    c -= N;
-    c &= (c >> 31);
-    c += N;
-    return  (unsigned char) c;
-}
-
-void whiteBalanceKernel(const uchar4 *in, uchar4 *out) {
-    float Rc =  in->r*scaleR;
-    float Gc =  in->g*scaleG;
-    float Bc =  in->b*scaleB;
-
-    out->r = contrastClamp(Rc);
-    out->g = contrastClamp(Gc);
-    out->b = contrastClamp(Bc);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/Android.mk b/tests/RenderScriptTests/ImageProcessing2/Android.mk
deleted file mode 100644
index 52966a3..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright (C) 2009 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := android.support.v8.renderscript
-
-LOCAL_PACKAGE_NAME := ImageProcessing2
-LOCAL_SDK_VERSION := 8
-LOCAL_RENDERSCRIPT_TARGET_API := 18
-LOCAL_RENDERSCRIPT_COMPATIBILITY := 18
-LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := $(TOPDIR)external/clang/lib/Headers \
-                                        $(TOPDIR)frameworks/rs/scriptc
-
-LOCAL_RENDERSCRIPT_FLAGS := -rs-package-name=android.support.v8.renderscript
-LOCAL_REQUIRED_MODULES := librsjni
-
-include $(BUILD_PACKAGE)
-
-#include $(call all-makefiles-under, $(LOCAL_PATH))
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/AndroidManifest.xml b/tests/RenderScriptTests/ImageProcessing2/AndroidManifest.xml
deleted file mode 100644
index 20ee053..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/AndroidManifest.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.image2">
-    <uses-sdk android:minSdkVersion="8" />
-    <application android:label="IP GB">
-        <activity android:name="ImageProcessingActivity2">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/city.png b/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/city.png
deleted file mode 100644
index 856eeff..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/city.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/img1600x1067.jpg b/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/img1600x1067.jpg
deleted file mode 100644
index 05d3ee2..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/img1600x1067.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/img1600x1067b.jpg b/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/img1600x1067b.jpg
deleted file mode 100644
index aed0781..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/res/drawable-nodpi/img1600x1067b.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing2/res/layout/main.xml b/tests/RenderScriptTests/ImageProcessing2/res/layout/main.xml
deleted file mode 100644
index f0a2b92..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/res/layout/main.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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="fill_parent"
-            android:layout_height="fill_parent"
-            android:id="@+id/toplevel">
-    <SurfaceView
-        android:id="@+id/surface"
-        android:layout_width="1dip"
-        android:layout_height="1dip" />
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-            <ImageView
-                android:id="@+id/display"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content">
-                    <Button
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/benchmark"
-                        android:onClick="benchmark"/>
-                    <TextView
-                        android:id="@+id/benchmarkText"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/saturation"/>
-            </LinearLayout>
-            <Spinner
-                android:id="@+id/filterselection"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <Spinner
-                android:id="@+id/spinner1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider1Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/saturation"/>
-             <SeekBar
-                android:id="@+id/slider1"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider2Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/gamma"/>
-            <SeekBar
-                android:id="@+id/slider2"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider3Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:textSize="8pt"
-                android:text="@string/out_white"/>
-            <SeekBar
-                android:id="@+id/slider3"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider4Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/slider4"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider5Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/slider5"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <Button
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/benchmark_all"
-                    android:onClick="benchmark_all"/>
-            </LinearLayout>
-    </ScrollView>
-</LinearLayout>
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/res/layout/spinner_layout.xml b/tests/RenderScriptTests/ImageProcessing2/res/layout/spinner_layout.xml
deleted file mode 100644
index 8196bbf..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/res/layout/spinner_layout.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2012 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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="10dp"
-    android:textSize="16sp"
-/>
diff --git a/tests/RenderScriptTests/ImageProcessing2/res/values/strings.xml b/tests/RenderScriptTests/ImageProcessing2/res/values/strings.xml
deleted file mode 100644
index a7dd165..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/res/values/strings.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* 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.
-*/
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- General -->
-    <skip />
-    <!--slider label -->
-    <string name="blur_description">Blur Radius</string>
-    <string name="in_white">In White</string>
-    <string name="out_white">Out White</string>
-    <string name="in_black">In Black</string>
-    <string name="out_black">Out Black</string>
-    <string name="gamma">Gamma</string>
-    <string name="saturation">Saturation</string>
-    <string name="benchmark">Benchmark</string>
-    <string name="benchmark_all">Benchmark All</string>
-
-</resources>
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/BWFilter.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/BWFilter.java
deleted file mode 100644
index 4b19856..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/BWFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-
-public class BWFilter extends TestBase {
-    private ScriptC_bwfilter mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_bwfilter(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_prepareBwFilter(50, 50, 50);
-        mScript.forEach_bwFilterKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blend.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blend.java
deleted file mode 100644
index d81ba88..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blend.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-import java.lang.Short;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.view.View;
-import android.widget.Spinner;
-
-public class Blend extends TestBase {
-    private ScriptIntrinsicBlend mBlend;
-    private ScriptC_blend mBlendHelper;
-    private short image1Alpha = 128;
-    private short image2Alpha = 128;
-
-    String mIntrinsicNames[];
-
-    private Allocation image1;
-    private Allocation image2;
-    private int currentIntrinsic = 0;
-
-    private AdapterView.OnItemSelectedListener mIntrinsicSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-                    currentIntrinsic = pos;
-                    if (mRS != null) {
-                        runTest();
-                        act.updateDisplay();
-                    }
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-            };
-
-    public void createTest(android.content.res.Resources res) {
-        mBlend = ScriptIntrinsicBlend.create(mRS, Element.U8_4(mRS));
-        mBlendHelper = new ScriptC_blend(mRS);
-        mBlendHelper.set_alpha((short)128);
-
-        image1 = Allocation.createTyped(mRS, mInPixelsAllocation.getType());
-        image2 = Allocation.createTyped(mRS, mInPixelsAllocation2.getType());
-
-        mIntrinsicNames = new String[14];
-        mIntrinsicNames[0] = "Source";
-        mIntrinsicNames[1] = "Destination";
-        mIntrinsicNames[2] = "Source Over";
-        mIntrinsicNames[3] = "Destination Over";
-        mIntrinsicNames[4] = "Source In";
-        mIntrinsicNames[5] = "Destination In";
-        mIntrinsicNames[6] = "Source Out";
-        mIntrinsicNames[7] = "Destination Out";
-        mIntrinsicNames[8] = "Source Atop";
-        mIntrinsicNames[9] = "Destination Atop";
-        mIntrinsicNames[10] = "XOR";
-        mIntrinsicNames[11] = "Add";
-        mIntrinsicNames[12] = "Subtract";
-        mIntrinsicNames[13] = "Multiply";
-    }
-
-    public boolean onSpinner1Setup(Spinner s) {
-        s.setAdapter(new ArrayAdapter<String>(
-            act, R.layout.spinner_layout, mIntrinsicNames));
-        s.setOnItemSelectedListener(mIntrinsicSpinnerListener);
-        return true;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Image 1 Alpha");
-        b.setMax(255);
-        b.setProgress(image1Alpha);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        image1Alpha = (short)progress;
-    }
-
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Image 2 Alpha");
-        b.setMax(255);
-        b.setProgress(image2Alpha);
-        return true;
-    }
-
-    public void onBar2Changed(int progress) {
-        image2Alpha = (short)progress;
-    }
-
-    public void runTest() {
-        image1.copy2DRangeFrom(0, 0, mInPixelsAllocation.getType().getX(), mInPixelsAllocation.getType().getY(), mInPixelsAllocation, 0, 0);
-        image2.copy2DRangeFrom(0, 0, mInPixelsAllocation2.getType().getX(), mInPixelsAllocation2.getType().getY(), mInPixelsAllocation2, 0, 0);
-
-        mBlendHelper.set_alpha(image1Alpha);
-        mBlendHelper.forEach_setImageAlpha(image1);
-
-        mBlendHelper.set_alpha(image2Alpha);
-        mBlendHelper.forEach_setImageAlpha(image2);
-
-        switch (currentIntrinsic) {
-        case 0:
-            mBlend.forEachSrc(image1, image2);
-            break;
-        case 1:
-            mBlend.forEachDst(image1, image2);
-            break;
-        case 2:
-            mBlend.forEachSrcOver(image1, image2);
-            break;
-        case 3:
-            mBlend.forEachDstOver(image1, image2);
-            break;
-        case 4:
-            mBlend.forEachSrcIn(image1, image2);
-            break;
-        case 5:
-            mBlend.forEachDstIn(image1, image2);
-            break;
-        case 6:
-            mBlend.forEachSrcOut(image1, image2);
-            break;
-        case 7:
-            mBlend.forEachDstOut(image1, image2);
-            break;
-        case 8:
-            mBlend.forEachSrcAtop(image1, image2);
-            break;
-        case 9:
-            mBlend.forEachDstAtop(image1, image2);
-            break;
-        case 10:
-            mBlend.forEachXor(image1, image2);
-            break;
-        case 11:
-            mBlend.forEachAdd(image1, image2);
-            break;
-        case 12:
-            mBlend.forEachSubtract(image1, image2);
-            break;
-        case 13:
-            mBlend.forEachMultiply(image1, image2);
-            break;
-        }
-
-        mOutPixelsAllocation.copy2DRangeFrom(0, 0, image2.getType().getX(), image2.getType().getY(), image2, 0, 0);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blur25.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blur25.java
deleted file mode 100644
index b518b02..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blur25.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Blur25 extends TestBase {
-    private boolean mUseIntrinsic = false;
-    private ScriptIntrinsicBlur mIntrinsic;
-
-    private int MAX_RADIUS = 25;
-    private ScriptC_threshold mScript;
-    private float mRadius = MAX_RADIUS;
-    private float mSaturation = 1.0f;
-    private Allocation mScratchPixelsAllocation1;
-    private Allocation mScratchPixelsAllocation2;
-
-
-    public Blur25(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Radius");
-        b.setProgress(100);
-        return true;
-    }
-
-
-    public void onBar1Changed(int progress) {
-        mRadius = ((float)progress) / 100.0f * MAX_RADIUS;
-        if (mRadius <= 0.10f) {
-            mRadius = 0.10f;
-        }
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(mRadius);
-        } else {
-            mScript.invoke_setRadius((int)mRadius);
-        }
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setRadius(MAX_RADIUS);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-
-            Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS));
-            tb.setX(width);
-            tb.setY(height);
-            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
-            mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());
-
-            mScript = new ScriptC_threshold(mRS, res, R.raw.threshold);
-            mScript.set_width(width);
-            mScript.set_height(height);
-            mScript.invoke_setRadius(MAX_RADIUS);
-
-            mScript.set_InPixel(mInPixelsAllocation);
-            mScript.set_ScratchPixel1(mScratchPixelsAllocation1);
-            mScript.set_ScratchPixel2(mScratchPixelsAllocation2);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_copyIn(mInPixelsAllocation, mScratchPixelsAllocation1);
-            mScript.forEach_horz(mScratchPixelsAllocation2);
-            mScript.forEach_vert(mOutPixelsAllocation);
-        }
-    }
-
-    public void setupBenchmark() {
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(MAX_RADIUS);
-        } else {
-            mScript.invoke_setRadius(MAX_RADIUS);
-        }
-    }
-
-    public void exitBenchmark() {
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(mRadius);
-        } else {
-            mScript.invoke_setRadius((int)mRadius);
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blur25G.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blur25G.java
deleted file mode 100644
index 19aa9f7..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Blur25G.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.graphics.Bitmap;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Blur25G extends TestBase {
-    private final int MAX_RADIUS = 25;
-    private float mRadius = MAX_RADIUS;
-
-    private ScriptIntrinsicBlur mIntrinsic;
-
-    private ScriptC_greyscale mScript;
-    private Allocation mScratchPixelsAllocation1;
-    private Allocation mScratchPixelsAllocation2;
-
-
-    public Blur25G() {
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Radius");
-        b.setProgress(100);
-        return true;
-    }
-
-
-    public void onBar1Changed(int progress) {
-        mRadius = ((float)progress) / 100.0f * MAX_RADIUS;
-        if (mRadius <= 0.10f) {
-            mRadius = 0.10f;
-        }
-        mIntrinsic.setRadius(mRadius);
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS));
-        tb.setX(width);
-        tb.setY(height);
-        mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
-        mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());
-
-        mScript = new ScriptC_greyscale(mRS);
-        mScript.forEach_toU8(mInPixelsAllocation, mScratchPixelsAllocation1);
-
-        mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8(mRS));
-        mIntrinsic.setRadius(MAX_RADIUS);
-        mIntrinsic.setInput(mScratchPixelsAllocation1);
-    }
-
-    public void runTest() {
-        mIntrinsic.forEach(mScratchPixelsAllocation2);
-    }
-
-    public void setupBenchmark() {
-        mIntrinsic.setRadius(MAX_RADIUS);
-    }
-
-    public void exitBenchmark() {
-        mIntrinsic.setRadius(mRadius);
-    }
-
-    public void updateBitmap(Bitmap b) {
-        mScript.forEach_toU8_4(mScratchPixelsAllocation2, mOutPixelsAllocation);
-        mOutPixelsAllocation.copyTo(b);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ColorCube.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ColorCube.java
deleted file mode 100644
index e960385..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ColorCube.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class ColorCube extends TestBase {
-    private Allocation mCube;
-    private ScriptC_colorcube mScript;
-    private ScriptIntrinsic3DLUT mIntrinsic;
-    private boolean mUseIntrinsic;
-
-    public ColorCube(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    private void initCube() {
-        final int sx = 32;
-        final int sy = 32;
-        final int sz = 16;
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8_4(mRS));
-        tb.setX(sx);
-        tb.setY(sy);
-        tb.setZ(sz);
-        Type t = tb.create();
-        mCube = Allocation.createTyped(mRS, t);
-
-        int dat[] = new int[sx * sy * sz];
-        for (int z = 0; z < sz; z++) {
-            for (int y = 0; y < sy; y++) {
-                for (int x = 0; x < sx; x++ ) {
-                    int v = 0xff000000;
-                    v |= (0xff * x / (sx - 1));
-                    v |= (0xff * y / (sy - 1)) << 8;
-                    v |= (0xff * z / (sz - 1)) << 16;
-                    dat[z*sy*sx + y*sx + x] = v;
-                }
-            }
-        }
-
-        mCube.copyFromUnchecked(dat);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_colorcube(mRS, res, R.raw.colorcube);
-        mIntrinsic = ScriptIntrinsic3DLUT.create(mRS, Element.U8_4(mRS));
-
-        initCube();
-        mScript.invoke_setCube(mCube);
-        mIntrinsic.setLUT(mCube);
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ColorMatrix.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ColorMatrix.java
deleted file mode 100644
index 3b0f86a..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ColorMatrix.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class ColorMatrix extends TestBase {
-    private ScriptC_colormatrix mScript;
-    private ScriptIntrinsicColorMatrix mIntrinsic;
-    private boolean mUseIntrinsic;
-    private boolean mUseGrey;
-
-    public ColorMatrix(boolean useIntrinsic, boolean useGrey) {
-        mUseIntrinsic = useIntrinsic;
-        mUseGrey = useGrey;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-            if (mUseGrey) {
-                mIntrinsic.setGreyscale();
-            } else {
-                mIntrinsic.setColorMatrix(m);
-            }
-        } else {
-            mScript = new ScriptC_colormatrix(mRS, res, R.raw.colormatrix);
-            mScript.invoke_setMatrix(m);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Contrast.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Contrast.java
deleted file mode 100644
index 3ae5d2a..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Contrast.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-
-public class Contrast extends TestBase {
-    private ScriptC_contrast mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_contrast(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_setBright(50.f);
-        mScript.forEach_contrast(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Convolve3x3.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Convolve3x3.java
deleted file mode 100644
index d4852f0..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Convolve3x3.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class Convolve3x3 extends TestBase {
-    private ScriptC_ip2_convolve3x3 mScript;
-    private ScriptIntrinsicConvolve3x3 mIntrinsic;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseIntrinsic;
-
-    public Convolve3x3(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        float f[] = new float[9];
-        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
-        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
-        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setCoefficients(f);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-            mScript = new ScriptC_ip2_convolve3x3(mRS, res, R.raw.ip2_convolve3x3);
-            mScript.set_gCoeffs(f);
-            mScript.set_gIn(mInPixelsAllocation);
-            mScript.set_gWidth(mWidth);
-            mScript.set_gHeight(mHeight);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Convolve5x5.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Convolve5x5.java
deleted file mode 100644
index d2da3c4..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Convolve5x5.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class Convolve5x5 extends TestBase {
-    private ScriptC_convolve5x5 mScript;
-    private ScriptIntrinsicConvolve5x5 mIntrinsic;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseIntrinsic;
-
-    public Convolve5x5(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        float f[] = new float[25];
-        //f[0] = 0.012f; f[1] = 0.025f; f[2] = 0.031f; f[3] = 0.025f; f[4] = 0.012f;
-        //f[5] = 0.025f; f[6] = 0.057f; f[7] = 0.075f; f[8] = 0.057f; f[9] = 0.025f;
-        //f[10]= 0.031f; f[11]= 0.075f; f[12]= 0.095f; f[13]= 0.075f; f[14]= 0.031f;
-        //f[15]= 0.025f; f[16]= 0.057f; f[17]= 0.075f; f[18]= 0.057f; f[19]= 0.025f;
-        //f[20]= 0.012f; f[21]= 0.025f; f[22]= 0.031f; f[23]= 0.025f; f[24]= 0.012f;
-
-        //f[0] = 1.f; f[1] = 2.f; f[2] = 0.f; f[3] = -2.f; f[4] = -1.f;
-        //f[5] = 4.f; f[6] = 8.f; f[7] = 0.f; f[8] = -8.f; f[9] = -4.f;
-        //f[10]= 6.f; f[11]=12.f; f[12]= 0.f; f[13]=-12.f; f[14]= -6.f;
-        //f[15]= 4.f; f[16]= 8.f; f[17]= 0.f; f[18]= -8.f; f[19]= -4.f;
-        //f[20]= 1.f; f[21]= 2.f; f[22]= 0.f; f[23]= -2.f; f[24]= -1.f;
-
-        f[0] = -1.f; f[1] = -3.f; f[2] = -4.f; f[3] = -3.f; f[4] = -1.f;
-        f[5] = -3.f; f[6] =  0.f; f[7] =  6.f; f[8] =  0.f; f[9] = -3.f;
-        f[10]= -4.f; f[11]=  6.f; f[12]= 20.f; f[13]=  6.f; f[14]= -4.f;
-        f[15]= -3.f; f[16]=  0.f; f[17]=  6.f; f[18]=  0.f; f[19]= -3.f;
-        f[20]= -1.f; f[21]= -3.f; f[22]= -4.f; f[23]= -3.f; f[24]= -1.f;
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicConvolve5x5.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setCoefficients(f);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-            mScript = new ScriptC_convolve5x5(mRS, res, R.raw.convolve5x5);
-            mScript.set_gCoeffs(f);
-            mScript.set_gIn(mInPixelsAllocation);
-            mScript.set_gWidth(mWidth);
-            mScript.set_gHeight(mHeight);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Copy.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Copy.java
deleted file mode 100644
index ef71907..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Copy.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class Copy extends TestBase {
-    private ScriptC_copy mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_copy(mRS, res, R.raw.copy);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/CrossProcess.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/CrossProcess.java
deleted file mode 100644
index 96787d7..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/CrossProcess.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class CrossProcess extends TestBase {
-    private ScriptIntrinsicLUT mIntrinsic;
-
-    public void createTest(android.content.res.Resources res) {
-        mIntrinsic = ScriptIntrinsicLUT.create(mRS, Element.U8_4(mRS));
-        for (int ct=0; ct < 256; ct++) {
-            float f = ((float)ct) / 255.f;
-
-            float r = f;
-            if (r < 0.5f) {
-                r = 4.0f * r * r * r;
-            } else {
-                r = 1.0f - r;
-                r = 1.0f - (4.0f * r * r * r);
-            }
-            mIntrinsic.setRed(ct, (int)(r * 255.f + 0.5f));
-
-            float g = f;
-            if (g < 0.5f) {
-                g = 2.0f * g * g;
-            } else {
-                g = 1.0f - g;
-                g = 1.0f - (2.0f * g * g);
-            }
-            mIntrinsic.setGreen(ct, (int)(g * 255.f + 0.5f));
-
-            float b = f * 0.5f + 0.25f;
-            mIntrinsic.setBlue(ct, (int)(b * 255.f + 0.5f));
-        }
-
-    }
-
-    public void runTest() {
-        mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Exposure.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Exposure.java
deleted file mode 100644
index deb6b46e..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Exposure.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-
-public class Exposure extends TestBase {
-    private ScriptC_exposure mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_exposure(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_setBright(50.f);
-        mScript.forEach_exposure(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Fisheye.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Fisheye.java
deleted file mode 100644
index 97beb88..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Fisheye.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import android.support.v8.renderscript.*;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Fisheye extends TestBase {
-    private ScriptC_fisheye_full mScript_full = null;
-    private ScriptC_fisheye_relaxed mScript_relaxed = null;
-    private ScriptC_fisheye_approx_full mScript_approx_full = null;
-    private ScriptC_fisheye_approx_relaxed mScript_approx_relaxed = null;
-    private final boolean approx;
-    private final boolean relaxed;
-    private float center_x = 0.5f;
-    private float center_y = 0.5f;
-    private float scale = 0.5f;
-
-    public Fisheye(boolean approx, boolean relaxed) {
-        this.approx = approx;
-        this.relaxed = relaxed;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Scale");
-        b.setMax(100);
-        b.setProgress(25);
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Shift center X");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Shift center Y");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        scale = progress / 50.0f;
-        do_init();
-    }
-    public void onBar2Changed(int progress) {
-        center_x = progress / 100.0f;
-        do_init();
-    }
-    public void onBar3Changed(int progress) {
-        center_y = progress / 100.0f;
-        do_init();
-    }
-
-    private void do_init() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.invoke_init_filter(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale);
-            else
-                mScript_approx_full.invoke_init_filter(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale);
-        } else if (relaxed)
-            mScript_relaxed.invoke_init_filter(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale);
-        else
-            mScript_full.invoke_init_filter(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        if (approx) {
-            if (relaxed) {
-                mScript_approx_relaxed = new ScriptC_fisheye_approx_relaxed(mRS,
-                        res, R.raw.fisheye_approx_relaxed);
-                mScript_approx_relaxed.set_in_alloc(mInPixelsAllocation);
-                mScript_approx_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-            } else {
-                mScript_approx_full = new ScriptC_fisheye_approx_full(mRS, res,
-                        R.raw.fisheye_approx_full);
-                mScript_approx_full.set_in_alloc(mInPixelsAllocation);
-                mScript_approx_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-            }
-        } else if (relaxed) {
-            mScript_relaxed = new ScriptC_fisheye_relaxed(mRS, res,
-                    R.raw.fisheye_relaxed);
-            mScript_relaxed.set_in_alloc(mInPixelsAllocation);
-            mScript_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-        } else {
-            mScript_full = new ScriptC_fisheye_full(mRS, res,
-                    R.raw.fisheye_full);
-            mScript_full.set_in_alloc(mInPixelsAllocation);
-            mScript_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-        }
-        do_init();
-    }
-
-    public void runTest() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.forEach_root(mOutPixelsAllocation);
-            else
-                mScript_approx_full.forEach_root(mOutPixelsAllocation);
-        } else if (relaxed)
-            mScript_relaxed.forEach_root(mOutPixelsAllocation);
-        else
-            mScript_full.forEach_root(mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Grain.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Grain.java
deleted file mode 100644
index dfd3c32..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Grain.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Grain extends TestBase {
-    private ScriptC_grain mScript;
-    private Allocation mNoise;
-    private Allocation mNoise2;
-
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Strength");
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        float s = progress / 100.0f;
-        mScript.set_gNoiseStrength(s);
-    }
-
-    private int findHighBit(int v) {
-        int bit = 0;
-        while (v > 1) {
-            bit++;
-            v >>= 1;
-        }
-        return bit;
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        int noiseW = findHighBit(width);
-        int noiseH = findHighBit(height);
-        if (noiseW > 9) {
-            noiseW = 9;
-        }
-        if (noiseH > 9) {
-            noiseH = 9;
-        }
-        noiseW = 1 << noiseW;
-        noiseH = 1 << noiseH;
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS));
-        tb.setX(noiseW);
-        tb.setY(noiseH);
-        mNoise = Allocation.createTyped(mRS, tb.create());
-        mNoise2 = Allocation.createTyped(mRS, tb.create());
-
-        mScript = new ScriptC_grain(mRS, res, R.raw.grain);
-        mScript.set_gWMask(noiseW - 1);
-        mScript.set_gHMask(noiseH - 1);
-        mScript.set_gNoiseStrength(0.5f);
-        mScript.set_gBlendSource(mNoise);
-        mScript.set_gNoise(mNoise2);
-    }
-
-    public void runTest() {
-        mScript.forEach_genRand(mNoise);
-        mScript.forEach_blend9(mNoise2);
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Greyscale.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Greyscale.java
deleted file mode 100644
index 5b16e24..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Greyscale.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import android.util.Log;
-
-public class Greyscale extends TestBase {
-    private ScriptC_greyscale mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_greyscale(mRS, res, R.raw.greyscale);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/GroupTest.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/GroupTest.java
deleted file mode 100644
index a7ceebee..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/GroupTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class GroupTest extends TestBase {
-    private ScriptIntrinsicConvolve3x3 mConvolve;
-    private ScriptIntrinsicColorMatrix mMatrix;
-
-    private Allocation mScratchPixelsAllocation1;
-    private ScriptGroup mGroup;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseNative;
-
-
-    public GroupTest(boolean useNative) {
-        mUseNative = useNative;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        mConvolve = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
-        mMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-
-        float f[] = new float[9];
-        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
-        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
-        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;
-        mConvolve.setCoefficients(f);
-
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-        mMatrix.setColorMatrix(m);
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8_4(mRS));
-        tb.setX(mWidth);
-        tb.setY(mHeight);
-        Type connect = tb.create();
-
-        if (mUseNative) {
-            ScriptGroup.Builder b = new ScriptGroup.Builder(mRS);
-            b.addKernel(mConvolve.getKernelID());
-            b.addKernel(mMatrix.getKernelID());
-            b.addConnection(connect, mConvolve.getKernelID(), mMatrix.getKernelID());
-            mGroup = b.create();
-        } else {
-            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, connect);
-        }
-    }
-
-    public void runTest() {
-        mConvolve.setInput(mInPixelsAllocation);
-        if (mUseNative) {
-            mGroup.setOutput(mMatrix.getKernelID(), mOutPixelsAllocation);
-            mGroup.execute();
-        } else {
-            mConvolve.forEach(mScratchPixelsAllocation1);
-            mMatrix.forEach(mScratchPixelsAllocation1, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ImageProcessingActivity2.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ImageProcessingActivity2.java
deleted file mode 100644
index 4b0e2dd..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ImageProcessingActivity2.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.support.v8.renderscript.*;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.view.View;
-import android.util.Log;
-import java.lang.Math;
-
-import android.os.Environment;
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-public class ImageProcessingActivity2 extends Activity
-                                       implements SeekBar.OnSeekBarChangeListener {
-    private final String TAG = "Img";
-    public final String RESULT_FILE = "image_processing_result.csv";
-
-    RenderScript mRS;
-    Allocation mInPixelsAllocation;
-    Allocation mInPixelsAllocation2;
-    Allocation mOutPixelsAllocation;
-
-    /**
-     * Define enum type for test names
-     */
-    public enum TestName {
-        // totally there are 38 test cases
-        LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed"),
-        LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed"),
-        LEVELS_VEC3_FULL ("Levels Vec3 Full"),
-        LEVELS_VEC4_FULL ("Levels Vec4 Full"),
-        BLUR_RADIUS_25 ("Blur radius 25"),
-        INTRINSIC_BLUE_RADIUS_25 ("Intrinsic Blur radius 25"),
-        GREYSCALE ("Greyscale"),
-        GRAIN ("Grain"),
-        FISHEYE_FULL ("Fisheye Full"),
-        FISHEYE_RELAXED ("Fisheye Relaxed"),
-        FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full"),
-        FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed"),
-        VIGNETTE_FULL ("Vignette Full"),
-        VIGNETTE_RELAXED ("Vignette Relaxed"),
-        VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full"),
-        VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed"),
-        GROUP_TEST_EMULATED ("Group Test (emulated)"),
-        GROUP_TEST_NATIVE ("Group Test (native)"),
-        CONVOLVE_3X3 ("Convolve 3x3"),
-        INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3"),
-        COLOR_MATRIX ("ColorMatrix"),
-        INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix"),
-        INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey"),
-        COPY ("Copy"),
-        CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)"),
-        CONVOLVE_5X5 ("Convolve 5x5"),
-        INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5"),
-        MANDELBROT ("Mandelbrot"),
-        INTRINSICS_BLEND ("Intrinsics Blend"),
-        INTRINSICS_BLUR_25G ("Intrinsics Blur 25 uchar"),
-        VIBRANCE ("Vibrance"),
-        BW_FILTER ("BW Filter"),
-        SHADOWS ("Shadows"),
-        CONTRAST ("Contrast"),
-        EXPOSURE ("Exposure"),
-        WHITE_BALANCE ("White Balance"),
-        COLOR_CUBE ("Color Cube"),
-        COLOR_CUBE_3D_INTRINSIC ("Color Cube (3D LUT intrinsic)");
-
-
-        private final String name;
-
-        private TestName(String s) {
-            name = s;
-        }
-
-        // return quoted string as displayed test name
-        public String toString() {
-            return name;
-        }
-    }
-
-    Bitmap mBitmapIn;
-    Bitmap mBitmapIn2;
-    Bitmap mBitmapOut;
-
-    private Spinner mSpinner;
-    private SeekBar mBar1;
-    private SeekBar mBar2;
-    private SeekBar mBar3;
-    private SeekBar mBar4;
-    private SeekBar mBar5;
-    private TextView mText1;
-    private TextView mText2;
-    private TextView mText3;
-    private TextView mText4;
-    private TextView mText5;
-
-    private float mSaturation = 1.0f;
-
-    private TextView mBenchmarkResult;
-    private Spinner mTestSpinner;
-
-    private SurfaceView mSurfaceView;
-    private ImageView mDisplayView;
-
-    private boolean mDoingBenchmark;
-
-    private TestBase mTest;
-    private int mRunCount;
-
-    public void updateDisplay() {
-            mTest.updateBitmap(mBitmapOut);
-            mDisplayView.invalidate();
-    }
-
-    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        if (fromUser) {
-
-            if (seekBar == mBar1) {
-                mTest.onBar1Changed(progress);
-            } else if (seekBar == mBar2) {
-                mTest.onBar2Changed(progress);
-            } else if (seekBar == mBar3) {
-                mTest.onBar3Changed(progress);
-            } else if (seekBar == mBar4) {
-                mTest.onBar4Changed(progress);
-            } else if (seekBar == mBar5) {
-                mTest.onBar5Changed(progress);
-            }
-
-            mTest.runTest();
-            updateDisplay();
-        }
-    }
-
-    public void onStartTrackingTouch(SeekBar seekBar) {
-    }
-
-    public void onStopTrackingTouch(SeekBar seekBar) {
-    }
-
-    void setupBars() {
-        mSpinner.setVisibility(View.VISIBLE);
-        mTest.onSpinner1Setup(mSpinner);
-
-        mBar1.setVisibility(View.VISIBLE);
-        mText1.setVisibility(View.VISIBLE);
-        mTest.onBar1Setup(mBar1, mText1);
-
-        mBar2.setVisibility(View.VISIBLE);
-        mText2.setVisibility(View.VISIBLE);
-        mTest.onBar2Setup(mBar2, mText2);
-
-        mBar3.setVisibility(View.VISIBLE);
-        mText3.setVisibility(View.VISIBLE);
-        mTest.onBar3Setup(mBar3, mText3);
-
-        mBar4.setVisibility(View.VISIBLE);
-        mText4.setVisibility(View.VISIBLE);
-        mTest.onBar4Setup(mBar4, mText4);
-
-        mBar5.setVisibility(View.VISIBLE);
-        mText5.setVisibility(View.VISIBLE);
-        mTest.onBar5Setup(mBar5, mText5);
-    }
-
-
-    void changeTest(TestName testName) {
-        if (mTest != null) {
-            mTest.destroy();
-        }
-        switch(testName) {
-        case LEVELS_VEC3_RELAXED:
-            mTest = new LevelsV4(false, false);
-            break;
-        case LEVELS_VEC4_RELAXED:
-            mTest = new LevelsV4(false, true);
-            break;
-        case LEVELS_VEC3_FULL:
-            mTest = new LevelsV4(true, false);
-            break;
-        case LEVELS_VEC4_FULL:
-            mTest = new LevelsV4(true, true);
-            break;
-        case BLUR_RADIUS_25:
-            mTest = new Blur25(false);
-            break;
-        case INTRINSIC_BLUE_RADIUS_25:
-            mTest = new Blur25(true);
-            break;
-        case GREYSCALE:
-            mTest = new Greyscale();
-            break;
-        case GRAIN:
-            mTest = new Grain();
-            break;
-        case FISHEYE_FULL:
-            mTest = new Fisheye(false, false);
-            break;
-        case FISHEYE_RELAXED:
-            mTest = new Fisheye(false, true);
-            break;
-        case FISHEYE_APPROXIMATE_FULL:
-            mTest = new Fisheye(true, false);
-            break;
-        case FISHEYE_APPROXIMATE_RELAXED:
-            mTest = new Fisheye(true, true);
-            break;
-        case VIGNETTE_FULL:
-            mTest = new Vignette(false, false);
-            break;
-        case VIGNETTE_RELAXED:
-            mTest = new Vignette(false, true);
-            break;
-        case VIGNETTE_APPROXIMATE_FULL:
-            mTest = new Vignette(true, false);
-            break;
-        case VIGNETTE_APPROXIMATE_RELAXED:
-            mTest = new Vignette(true, true);
-            break;
-        case GROUP_TEST_EMULATED:
-            mTest = new GroupTest(false);
-            break;
-        case GROUP_TEST_NATIVE:
-            mTest = new GroupTest(true);
-            break;
-        case CONVOLVE_3X3:
-            mTest = new Convolve3x3(false);
-            break;
-        case INTRINSICS_CONVOLVE_3X3:
-            mTest = new Convolve3x3(true);
-            break;
-        case COLOR_MATRIX:
-            mTest = new ColorMatrix(false, false);
-            break;
-        case INTRINSICS_COLOR_MATRIX:
-            mTest = new ColorMatrix(true, false);
-            break;
-        case INTRINSICS_COLOR_MATRIX_GREY:
-            mTest = new ColorMatrix(true, true);
-            break;
-        case COPY:
-            mTest = new Copy();
-            break;
-        case CROSS_PROCESS_USING_LUT:
-            mTest = new CrossProcess();
-            break;
-        case CONVOLVE_5X5:
-            mTest = new Convolve5x5(false);
-            break;
-        case INTRINSICS_CONVOLVE_5X5:
-            mTest = new Convolve5x5(true);
-            break;
-        case MANDELBROT:
-            mTest = new Mandelbrot();
-            break;
-        case INTRINSICS_BLEND:
-            mTest = new Blend();
-            break;
-        case INTRINSICS_BLUR_25G:
-            mTest = new Blur25G();
-            break;
-        case VIBRANCE:
-            mTest = new Vibrance();
-            break;
-        case BW_FILTER:
-            mTest = new BWFilter();
-            break;
-        case SHADOWS:
-            mTest = new Shadows();
-            break;
-        case CONTRAST:
-            mTest = new Contrast();
-            break;
-        case EXPOSURE:
-            mTest = new Exposure();
-            break;
-        case WHITE_BALANCE:
-            mTest = new WhiteBalance();
-            break;
-        case COLOR_CUBE:
-            mTest = new ColorCube(false);
-            break;
-        case COLOR_CUBE_3D_INTRINSIC:
-            mTest = new ColorCube(true);
-            break;
-        }
-
-        mTest.createBaseTest(this, mBitmapIn, mBitmapIn2, mBitmapOut);
-        setupBars();
-
-        mTest.runTest();
-        updateDisplay();
-        mBenchmarkResult.setText("Result: not run");
-    }
-
-    void setupTests() {
-        mTestSpinner.setAdapter(new ArrayAdapter<TestName>(
-            this, R.layout.spinner_layout, TestName.values()));
-    }
-
-    private AdapterView.OnItemSelectedListener mTestSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-                    changeTest(TestName.values()[pos]);
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-            };
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        mBitmapIn = loadBitmap(R.drawable.img1600x1067);
-        mBitmapIn2 = loadBitmap(R.drawable.img1600x1067b);
-        mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), mBitmapIn.getHeight(),
-                                         mBitmapIn.getConfig());
-
-        mSurfaceView = (SurfaceView) findViewById(R.id.surface);
-
-        mDisplayView = (ImageView) findViewById(R.id.display);
-        mDisplayView.setImageBitmap(mBitmapOut);
-
-        mSpinner = (Spinner) findViewById(R.id.spinner1);
-
-        mBar1 = (SeekBar) findViewById(R.id.slider1);
-        mBar2 = (SeekBar) findViewById(R.id.slider2);
-        mBar3 = (SeekBar) findViewById(R.id.slider3);
-        mBar4 = (SeekBar) findViewById(R.id.slider4);
-        mBar5 = (SeekBar) findViewById(R.id.slider5);
-
-        mBar1.setOnSeekBarChangeListener(this);
-        mBar2.setOnSeekBarChangeListener(this);
-        mBar3.setOnSeekBarChangeListener(this);
-        mBar4.setOnSeekBarChangeListener(this);
-        mBar5.setOnSeekBarChangeListener(this);
-
-        mText1 = (TextView) findViewById(R.id.slider1Text);
-        mText2 = (TextView) findViewById(R.id.slider2Text);
-        mText3 = (TextView) findViewById(R.id.slider3Text);
-        mText4 = (TextView) findViewById(R.id.slider4Text);
-        mText5 = (TextView) findViewById(R.id.slider5Text);
-
-        mTestSpinner = (Spinner) findViewById(R.id.filterselection);
-        mTestSpinner.setOnItemSelectedListener(mTestSpinnerListener);
-
-        mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText);
-        mBenchmarkResult.setText("Result: not run");
-
-
-        mRS = RenderScript.create(this);
-        mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn);
-        mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2);
-        mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut);
-
-
-        setupTests();
-        changeTest(TestName.LEVELS_VEC3_RELAXED);
-    }
-
-
-    private Bitmap loadBitmap(int resource) {
-        final BitmapFactory.Options options = new BitmapFactory.Options();
-        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
-        return BitmapFactory.decodeResource(getResources(), resource, options);
-    }
-
-    // button hook
-    public void benchmark(View v) {
-        float t = getBenchmark();
-        //long javaTime = javaFilter();
-        //mBenchmarkResult.setText("RS: " + t + " ms  Java: " + javaTime + " ms");
-        mBenchmarkResult.setText("Result: " + t + " ms");
-        Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + t);
-    }
-
-    public void benchmark_all(View v) {
-        // write result into a file
-        File externalStorage = Environment.getExternalStorageDirectory();
-        if (!externalStorage.canWrite()) {
-            Log.v(TAG, "sdcard is not writable");
-            return;
-        }
-        File resultFile = new File(externalStorage, RESULT_FILE);
-        //resultFile.setWritable(true, false);
-        try {
-            BufferedWriter rsWriter = new BufferedWriter(new FileWriter(resultFile));
-            Log.v(TAG, "Saved results in: " + resultFile.getAbsolutePath());
-            for (TestName tn: TestName.values()) {
-                changeTest(tn);
-                float t = getBenchmark();
-                String s = new String("" + tn.toString() + ", " + t);
-                rsWriter.write(s + "\n");
-                Log.v(TAG, "Test " + s + "ms\n");
-            }
-            rsWriter.close();
-        } catch (IOException e) {
-            Log.v(TAG, "Unable to write result file " + e.getMessage());
-        }
-        changeTest(TestName.LEVELS_VEC3_RELAXED);
-    }
-
-    // For benchmark test
-    public float getBenchmark() {
-        mDoingBenchmark = true;
-
-        mTest.setupBenchmark();
-        long result = 0;
-
-        //Log.v(TAG, "Warming");
-        long t = java.lang.System.currentTimeMillis() + 250;
-        do {
-            mTest.runTest();
-            mTest.finish();
-        } while (t > java.lang.System.currentTimeMillis());
-
-        //Log.v(TAG, "Benchmarking");
-        int ct = 0;
-        t = java.lang.System.currentTimeMillis();
-        do {
-            mTest.runTest();
-            mTest.finish();
-            ct++;
-        } while ((t+1000) > java.lang.System.currentTimeMillis());
-        t = java.lang.System.currentTimeMillis() - t;
-        float ft = (float)t;
-        ft /= ct;
-
-        mTest.exitBenchmark();
-        mDoingBenchmark = false;
-
-        return ft;
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/LevelsV4.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/LevelsV4.java
deleted file mode 100644
index fbe3727..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/LevelsV4.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-
-public class LevelsV4 extends TestBase {
-    private ScriptC_levels_relaxed mScriptR;
-    private ScriptC_levels_full mScriptF;
-    private float mInBlack = 0.0f;
-    private float mOutBlack = 0.0f;
-    private float mInWhite = 255.0f;
-    private float mOutWhite = 255.0f;
-    private float mSaturation = 1.0f;
-
-    Matrix3f satMatrix = new Matrix3f();
-    float mInWMinInB;
-    float mOutWMinOutB;
-    float mOverInWMinInB;
-
-    boolean mUseFull;
-    boolean mUseV4;
-
-    LevelsV4(boolean useFull, boolean useV4) {
-        mUseFull = useFull;
-        mUseV4 = useV4;
-    }
-
-
-    private void setLevels() {
-        mInWMinInB = mInWhite - mInBlack;
-        mOutWMinOutB = mOutWhite - mOutBlack;
-        mOverInWMinInB = 1.f / mInWMinInB;
-
-        mScriptR.set_inBlack(mInBlack);
-        mScriptR.set_outBlack(mOutBlack);
-        mScriptR.set_inWMinInB(mInWMinInB);
-        mScriptR.set_outWMinOutB(mOutWMinOutB);
-        mScriptR.set_overInWMinInB(mOverInWMinInB);
-        mScriptF.set_inBlack(mInBlack);
-        mScriptF.set_outBlack(mOutBlack);
-        mScriptF.set_inWMinInB(mInWMinInB);
-        mScriptF.set_outWMinOutB(mOutWMinOutB);
-        mScriptF.set_overInWMinInB(mOverInWMinInB);
-    }
-
-    private void setSaturation() {
-        float rWeight = 0.299f;
-        float gWeight = 0.587f;
-        float bWeight = 0.114f;
-        float oneMinusS = 1.0f - mSaturation;
-
-        satMatrix.set(0, 0, oneMinusS * rWeight + mSaturation);
-        satMatrix.set(0, 1, oneMinusS * rWeight);
-        satMatrix.set(0, 2, oneMinusS * rWeight);
-        satMatrix.set(1, 0, oneMinusS * gWeight);
-        satMatrix.set(1, 1, oneMinusS * gWeight + mSaturation);
-        satMatrix.set(1, 2, oneMinusS * gWeight);
-        satMatrix.set(2, 0, oneMinusS * bWeight);
-        satMatrix.set(2, 1, oneMinusS * bWeight);
-        satMatrix.set(2, 2, oneMinusS * bWeight + mSaturation);
-        mScriptR.set_colorMat(satMatrix);
-        mScriptF.set_colorMat(satMatrix);
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        b.setProgress(50);
-        t.setText("Saturation");
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(0);
-        t.setText("In Black");
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(0);
-        t.setText("Out Black");
-        return true;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(128);
-        t.setText("Out White");
-        return true;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(128);
-        t.setText("Out White");
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        mSaturation = (float)progress / 50.0f;
-        setSaturation();
-    }
-    public void onBar2Changed(int progress) {
-        mInBlack = (float)progress;
-        setLevels();
-    }
-    public void onBar3Changed(int progress) {
-        mOutBlack = (float)progress;
-        setLevels();
-    }
-    public void onBar4Changed(int progress) {
-        mInWhite = (float)progress + 127.0f;
-        setLevels();
-    }
-    public void onBar5Changed(int progress) {
-        mOutWhite = (float)progress + 127.0f;
-        setLevels();
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mScriptR = new ScriptC_levels_relaxed(mRS, res, R.raw.levels_relaxed);
-        mScriptF = new ScriptC_levels_full(mRS, res, R.raw.levels_full);
-        setSaturation();
-        setLevels();
-    }
-
-    public void runTest() {
-        if (mUseFull) {
-            if (mUseV4) {
-                mScriptF.forEach_root4(mInPixelsAllocation, mOutPixelsAllocation);
-            } else {
-                mScriptF.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-            }
-        } else {
-            if (mUseV4) {
-                mScriptR.forEach_root4(mInPixelsAllocation, mOutPixelsAllocation);
-            } else {
-                mScriptR.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-            }
-        }
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Mandelbrot.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Mandelbrot.java
deleted file mode 100644
index 1780587..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Mandelbrot.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Mandelbrot extends TestBase {
-    private ScriptC_mandelbrot mScript;
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Iterations");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        int iters = progress * 3 + 50;
-        mScript.set_gMaxIteration(iters);
-    }
-
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Lower Bound: X");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar2Changed(int progress) {
-        float scaleFactor = mScript.get_scaleFactor();
-        // allow viewport to be moved by 2x scale factor
-        float lowerBoundX = -2.f + ((progress / scaleFactor) / 50.f);
-        mScript.set_lowerBoundX(lowerBoundX);
-    }
-
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Lower Bound: Y");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar3Changed(int progress) {
-        float scaleFactor = mScript.get_scaleFactor();
-        // allow viewport to be moved by 2x scale factor
-        float lowerBoundY = -2.f + ((progress / scaleFactor) / 50.f);
-        mScript.set_lowerBoundY(lowerBoundY);
-    }
-
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        t.setText("Scale Factor");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar4Changed(int progress) {
-        float scaleFactor = 4.f - (3.96f * (progress / 100.f));
-        mScript.set_scaleFactor(scaleFactor);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mOutPixelsAllocation.getType().getX();
-        int height = mOutPixelsAllocation.getType().getY();
-
-        mScript = new ScriptC_mandelbrot(mRS, res, R.raw.mandelbrot);
-        mScript.set_gDimX(width);
-        mScript.set_gDimY(height);
-        mScript.set_gMaxIteration(50);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mOutPixelsAllocation);
-        mRS.finish();
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Shadows.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Shadows.java
deleted file mode 100644
index 353c56d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Shadows.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-
-public class Shadows extends TestBase {
-    private ScriptC_shadows mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_shadows(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_prepareShadows(50.f);
-        mScript.forEach_shadowsKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/TestBase.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/TestBase.java
deleted file mode 100644
index eeabc73..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/TestBase.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.support.v8.renderscript.*;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.view.View;
-import android.util.Log;
-import java.lang.Math;
-import android.widget.Spinner;
-
-public class TestBase  {
-    protected final String TAG = "Img";
-
-    protected RenderScript mRS;
-    protected Allocation mInPixelsAllocation;
-    protected Allocation mInPixelsAllocation2;
-    protected Allocation mOutPixelsAllocation;
-
-    protected ImageProcessingActivity2 act;
-
-    // Override to use UI elements
-    public void onBar1Changed(int progress) {
-    }
-    public void onBar2Changed(int progress) {
-    }
-    public void onBar3Changed(int progress) {
-    }
-    public void onBar4Changed(int progress) {
-    }
-    public void onBar5Changed(int progress) {
-    }
-
-    // Override to use UI elements
-    // Unused bars will be hidden.
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-
-    public boolean onSpinner1Setup(Spinner s) {
-        s.setVisibility(View.INVISIBLE);
-        return false;
-    }
-
-    public final void createBaseTest(ImageProcessingActivity2 ipact, Bitmap b, Bitmap b2, Bitmap outb) {
-        act = ipact;
-        mRS = ipact.mRS;
-
-        mInPixelsAllocation = ipact.mInPixelsAllocation;
-        mInPixelsAllocation2 = ipact.mInPixelsAllocation2;
-        mOutPixelsAllocation = ipact.mOutPixelsAllocation;
-
-        createTest(act.getResources());
-    }
-
-    // Must override
-    public void createTest(android.content.res.Resources res) {
-    }
-
-    // Must override
-    public void runTest() {
-    }
-
-    public void finish() {
-        mRS.finish();
-    }
-
-    public void destroy() {
-    }
-
-    public void updateBitmap(Bitmap b) {
-        mOutPixelsAllocation.copyTo(b);
-    }
-
-    // Override to configure specific benchmark config.
-    public void setupBenchmark() {
-    }
-
-    // Override to reset after benchmark.
-    public void exitBenchmark() {
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Vibrance.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Vibrance.java
deleted file mode 100644
index 37c0aa7..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Vibrance.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-public class Vibrance extends TestBase {
-    private ScriptC_vibrance mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_vibrance(mRS);
-    }
-
-    public void runTest() {
-        mScript.set_vibrance(50.f);
-        mScript.invoke_prepareVibrance();
-        mScript.forEach_vibranceKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Vignette.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Vignette.java
deleted file mode 100644
index 9f6d34d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/Vignette.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Vignette extends TestBase {
-    private ScriptC_vignette_full mScript_full = null;
-    private ScriptC_vignette_relaxed mScript_relaxed = null;
-    private ScriptC_vignette_approx_full mScript_approx_full = null;
-    private ScriptC_vignette_approx_relaxed mScript_approx_relaxed = null;
-    private final boolean approx;
-    private final boolean relaxed;
-    private float center_x = 0.5f;
-    private float center_y = 0.5f;
-    private float scale = 0.5f;
-    private float shade = 0.5f;
-    private float slope = 20.0f;
-
-    public Vignette(boolean approx, boolean relaxed) {
-        this.approx = approx;
-        this.relaxed = relaxed;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Scale");
-        b.setMax(100);
-        b.setProgress(25);
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Shade");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Slope");
-        b.setMax(100);
-        b.setProgress(20);
-        return true;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        t.setText("Shift center X");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        t.setText("Shift center Y");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        scale = progress / 50.0f;
-        do_init();
-    }
-    public void onBar2Changed(int progress) {
-        shade = progress / 100.0f;
-        do_init();
-    }
-    public void onBar3Changed(int progress) {
-        slope = (float)progress;
-        do_init();
-    }
-    public void onBar4Changed(int progress) {
-        center_x = progress / 100.0f;
-        do_init();
-    }
-    public void onBar5Changed(int progress) {
-        center_y = progress / 100.0f;
-        do_init();
-    }
-
-    private void do_init() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.invoke_init_vignette(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale, shade, slope);
-            else
-                mScript_approx_full.invoke_init_vignette(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale, shade, slope);
-        } else if (relaxed)
-            mScript_relaxed.invoke_init_vignette(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale, shade, slope);
-        else
-            mScript_full.invoke_init_vignette(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale, shade, slope);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed = new ScriptC_vignette_approx_relaxed(
-                        mRS, res, R.raw.vignette_approx_relaxed);
-            else
-                mScript_approx_full = new ScriptC_vignette_approx_full(
-                        mRS, res, R.raw.vignette_approx_full);
-        } else if (relaxed)
-            mScript_relaxed = new ScriptC_vignette_relaxed(mRS, res,
-                    R.raw.vignette_relaxed);
-        else
-            mScript_full = new ScriptC_vignette_full(mRS, res,
-                    R.raw.vignette_full);
-        do_init();
-    }
-
-    public void runTest() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.forEach_root(mInPixelsAllocation,
-                        mOutPixelsAllocation);
-            else
-                mScript_approx_full.forEach_root(mInPixelsAllocation,
-                        mOutPixelsAllocation);
-        } else if (relaxed)
-            mScript_relaxed.forEach_root(mInPixelsAllocation,
-                    mOutPixelsAllocation);
-        else
-            mScript_full.forEach_root(mInPixelsAllocation,
-                    mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/WhiteBalance.java b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/WhiteBalance.java
deleted file mode 100644
index 658e3b1..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/WhiteBalance.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.image2;
-
-import java.lang.Math;
-
-import android.support.v8.renderscript.*;
-
-public class WhiteBalance extends TestBase {
-    private ScriptC_wbalance mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_wbalance(mRS);
-    }
-
-    public void runTest() {
-        mScript.set_histogramSource(mInPixelsAllocation);
-        mScript.set_histogramWidth(mInPixelsAllocation.getType().getX());
-        mScript.set_histogramHeight(mInPixelsAllocation.getType().getY());
-        mScript.invoke_prepareWhiteBalance();
-        mScript.forEach_whiteBalanceKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/blend.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/blend.rs
deleted file mode 100644
index 9ec1246..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/blend.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2011 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.
-
-#include "ip.rsh"
-
-uchar alpha = 0x0;
-
-void setImageAlpha(uchar4 *v_out, uint32_t x, uint32_t y) {
-  v_out->rgba = convert_uchar4((convert_uint4(v_out->rgba) * alpha) >> (uint4)8);
-  v_out->a = alpha;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/bwfilter.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/bwfilter.rs
deleted file mode 100644
index e706d44..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/bwfilter.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static float sr = 0.f;
-static float sg = 0.f;
-static float sb = 0.f;
-
-void prepareBwFilter(uint32_t rw, uint32_t gw, uint32_t bw) {
-
-    sr = rw;
-    sg = gw;
-    sb = bw;
-
-    float imageMin = min(sg,sb);
-    imageMin = fmin(sr,imageMin);
-    float imageMax = max(sg,sb);
-    imageMax = fmax(sr,imageMax);
-    float avg = (imageMin + imageMax)/2;
-    sb /= avg;
-    sg /= avg;
-    sr /= avg;
-
-}
-
-void bwFilterKernel(const uchar4 *in, uchar4 *out) {
-    float r = in->r * sr;
-    float g = in->g * sg;
-    float b = in->b * sb;
-    float localMin, localMax, avg;
-    localMin = fmin(g,b);
-    localMin = fmin(r,localMin);
-    localMax = fmax(g,b);
-    localMax = fmax(r,localMax);
-    avg = (localMin+localMax) * 0.5f;
-    out->r = out->g = out->b = rsClamp(avg, 0, 255);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/colorcube.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/colorcube.rs
deleted file mode 100644
index 4f1e73e..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/colorcube.rs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-#pragma rs_fp_relaxed
-
-
-static rs_allocation gCube;
-static int4 gDims;
-static int4 gCoordMul;
-
-
-void setCube(rs_allocation c) {
-    gCube = c;
-    gDims.x = rsAllocationGetDimX(gCube);
-    gDims.y = rsAllocationGetDimY(gCube);
-    gDims.z = rsAllocationGetDimZ(gCube);
-    gDims.w = 0;
-
-    float4 m = (float4)(1.f / 255.f) * convert_float4(gDims - 1);
-    gCoordMul = convert_int4(m * (float4)0x10000);
-
-    rsDebug("dims", gDims);
-    rsDebug("gCoordMul", gCoordMul);
-}
-
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
-    //rsDebug("root", in);
-
-    int4 baseCoord = convert_int4(*in) * gCoordMul;
-    int4 coord1 = baseCoord >> (int4)16;
-    int4 coord2 = min(coord1 + 1, gDims - 1);
-
-    int4 weight2 = baseCoord & 0xffff;
-    int4 weight1 = (int4)0x10000 - weight2;
-
-    uint4 v000 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord1.y, coord1.z));
-    uint4 v100 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord1.y, coord1.z));
-    uint4 v010 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord2.y, coord1.z));
-    uint4 v110 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord2.y, coord1.z));
-    uint4 v001 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord1.y, coord2.z));
-    uint4 v101 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord1.y, coord2.z));
-    uint4 v011 = convert_uint4(rsGetElementAt_uchar4(gCube, coord1.x, coord2.y, coord2.z));
-    uint4 v111 = convert_uint4(rsGetElementAt_uchar4(gCube, coord2.x, coord2.y, coord2.z));
-
-    uint4 yz00 = ((v000 * weight1.x) + (v100 * weight2.x)) >> (int4)8;
-    uint4 yz10 = ((v010 * weight1.x) + (v110 * weight2.x)) >> (int4)8;
-    uint4 yz01 = ((v001 * weight1.x) + (v101 * weight2.x)) >> (int4)8;
-    uint4 yz11 = ((v011 * weight1.x) + (v111 * weight2.x)) >> (int4)8;
-
-    uint4 z0 = ((yz00 * weight1.y) + (yz10 * weight2.y)) >> (int4)16;
-    uint4 z1 = ((yz01 * weight1.y) + (yz11 * weight2.y)) >> (int4)16;
-
-    uint4 v = ((z0 * weight1.z) + (z1 * weight2.z)) >> (int4)16;
-    uint4 v2 = (v + 0x7f) >> (int4)8;
-
-    *out = convert_uchar4(v2);
-    out->a = 0xff;
-
-    #if 0
-    if (in->r != out->r) {
-        rsDebug("dr", in->r - out->r);
-        //rsDebug("in", convert_int4(*in));
-        //rsDebug("coord1", coord1);
-        //rsDebug("coord2", coord2);
-        //rsDebug("weight1", weight1);
-        //rsDebug("weight2", weight2);
-        //rsDebug("yz00", yz00);
-        //rsDebug("z0", z0);
-        //rsDebug("v", v);
-        //rsDebug("v2", v2);
-        //rsDebug("out", convert_int4(*out));
-    }
-    #endif
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/colormatrix.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/colormatrix.fs
deleted file mode 100644
index 86fb248..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/colormatrix.fs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static rs_matrix4x4 Mat;
-
-void init() {
-    rsMatrixLoadIdentity(&Mat);
-}
-
-void setMatrix(rs_matrix4x4 m) {
-    Mat = m;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in) {
-    float4 f = convert_float4(in);
-    f = rsMatrixMultiply(&Mat, f);
-    f = clamp(f, 0.f, 255.f);
-    return convert_uchar4(f);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/contrast.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/contrast.rs
deleted file mode 100644
index d3743d3..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/contrast.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static float brightM = 0.f;
-static float brightC = 0.f;
-
-void setBright(float v) {
-    brightM = pow(2.f, v / 100.f);
-    brightC = 127.f - brightM * 127.f;
-}
-
-void contrast(const uchar4 *in, uchar4 *out)
-{
-#if 0
-    out->r = rsClamp((int)(brightM * in->r + brightC), 0, 255);
-    out->g = rsClamp((int)(brightM * in->g + brightC), 0, 255);
-    out->b = rsClamp((int)(brightM * in->b + brightC), 0, 255);
-#else
-    float3 v = convert_float3(in->rgb) * brightM + brightC;
-    out->rgb = convert_uchar3(clamp(v, 0.f, 255.f));
-#endif
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/convolve5x5.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/convolve5x5.fs
deleted file mode 100644
index 922a593..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/convolve5x5.fs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-int32_t gWidth;
-int32_t gHeight;
-rs_allocation gIn;
-
-float gCoeffs[25];
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    uint32_t x0 = max((int32_t)x-2, 0);
-    uint32_t x1 = max((int32_t)x-1, 0);
-    uint32_t x2 = x;
-    uint32_t x3 = min((int32_t)x+1, gWidth-1);
-    uint32_t x4 = min((int32_t)x+2, gWidth-1);
-
-    uint32_t y0 = max((int32_t)y-2, 0);
-    uint32_t y1 = max((int32_t)y-1, 0);
-    uint32_t y2 = y;
-    uint32_t y3 = min((int32_t)y+1, gHeight-1);
-    uint32_t y4 = min((int32_t)y+2, gHeight-1);
-
-    float4 p0 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y0)) * gCoeffs[0]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y0)) * gCoeffs[1]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y0)) * gCoeffs[2]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y0)) * gCoeffs[3]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y0)) * gCoeffs[4];
-
-    float4 p1 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y1)) * gCoeffs[5]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y1)) * gCoeffs[6]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y1)) * gCoeffs[7]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y1)) * gCoeffs[8]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y1)) * gCoeffs[9];
-
-    float4 p2 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y2)) * gCoeffs[10]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y2)) * gCoeffs[11]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y2)) * gCoeffs[12]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y2)) * gCoeffs[13]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y2)) * gCoeffs[14];
-
-    float4 p3 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y3)) * gCoeffs[15]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y3)) * gCoeffs[16]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y3)) * gCoeffs[17]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y3)) * gCoeffs[18]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y3)) * gCoeffs[19];
-
-    float4 p4 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y4)) * gCoeffs[20]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y4)) * gCoeffs[21]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y4)) * gCoeffs[22]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y4)) * gCoeffs[23]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y4)) * gCoeffs[24];
-
-    p0 = clamp(p0 + p1 + p2 + p3 + p4, 0.f, 255.f);
-    return convert_uchar4(p0);
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/copy.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/copy.fs
deleted file mode 100644
index 6595874..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/copy.fs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-uchar4 __attribute__((kernel)) root(uchar4 v_in) {
-    return v_in;
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/exposure.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/exposure.rs
deleted file mode 100644
index 0f05cb9..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/exposure.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static float bright = 0.f;
-
-void setBright(float v) {
-    bright = 255.f / (255.f - v);
-}
-
-void exposure(const uchar4 *in, uchar4 *out)
-{
-    out->r = rsClamp((int)(bright * in->r), 0, 255);
-    out->g = rsClamp((int)(bright * in->g), 0, 255);
-    out->b = rsClamp((int)(bright * in->b), 0, 255);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye.rsh b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye.rsh
deleted file mode 100644
index 2eacb7d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye.rsh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-rs_allocation in_alloc;
-rs_sampler sampler;
-
-static float2 center, neg_center, inv_dimensions, axis_scale;
-static float alpha, radius2, factor;
-
-void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y, float k) {
-    center.x = center_x;
-    center.y = center_y;
-    neg_center = -center;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-    alpha = k * 2.0f + 0.75f;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-    
-    const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
-    const float bound = sqrt(bound2);
-    const float radius = 1.15f * bound;
-    radius2 = radius*radius;
-    const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
-    factor = bound / max_radian;
-}
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float2 scaledCoord = axis_scale * coord;
-    const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
-    const float inv_dist = rsqrt(dist2);
-    const float radian = M_PI_2 - atan((alpha * sqrt(radius2 - dist2)) * inv_dist);
-    const float scalar = radian * factor * inv_dist;
-    const float2 new_coord = mad(coord, scalar, center);
-    const float4 fout = rsSample(in_alloc, sampler, new_coord);
-    return rsPackColorTo8888(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx.rsh b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx.rsh
deleted file mode 100644
index fcf0a3d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx.rsh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-rs_allocation in_alloc;
-rs_sampler sampler;
-
-static float2 center, neg_center, inv_dimensions, axis_scale;
-static float alpha, radius2, factor;
-
-void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y, float k) {
-    center.x = center_x;
-    center.y = center_y;
-    neg_center = -center;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-    alpha = k * 2.0f + 0.75f;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
-    const float bound = sqrt(bound2);
-    const float radius = 1.15f * bound;
-    radius2 = radius*radius;
-    const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
-    factor = bound / max_radian;
-}
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float2 scaledCoord = axis_scale * coord;
-    const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
-    const float inv_dist = half_rsqrt(dist2);
-    const float radian = M_PI_2 - atan((alpha * half_sqrt(radius2 - dist2)) * inv_dist);
-    const float scalar = radian * factor * inv_dist;
-    const float2 new_coord = mad(coord, scalar, center);
-    const float4 fout = rsSample(in_alloc, sampler, new_coord);
-    return rsPackColorTo8888(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx_full.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx_full.rs
deleted file mode 100644
index ed69ff4..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx_relaxed.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx_relaxed.fs
deleted file mode 100644
index ed69ff4..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_approx_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_full.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_full.rs
deleted file mode 100644
index f986b5d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_relaxed.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_relaxed.fs
deleted file mode 100644
index f986b5d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/fisheye_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/grain.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/grain.fs
deleted file mode 100644
index 2e62cd7..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/grain.fs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-uchar __attribute__((kernel)) genRand() {
-    return (uchar)rsRand(0xff);
-}
-
-/*
- * Convolution matrix of distance 2 with fixed point of 'kShiftBits' bits
- * shifted. Thus the sum of this matrix should be 'kShiftValue'. Entries of
- * small values are not calculated to gain efficiency.
- * The order ot pixels represented in this matrix is:
- *  1  2  3
- *  4  0  5
- *  6  7  8
- *  and the matrix should be: {230, 56, 114, 56, 114, 114, 56, 114, 56}.
- *  However, since most of the valus are identical, we only use the first three
- *  entries and the entries corresponding to the pixels is:
- *  1  2  1
- *  2  0  2
- *  1  2  1
- */
-
-int32_t gWMask;
-int32_t gHMask;
-
-rs_allocation gBlendSource;
-uchar __attribute__((kernel)) blend9(uint32_t x, uint32_t y) {
-    uint32_t x1 = (x-1) & gWMask;
-    uint32_t x2 = (x+1) & gWMask;
-    uint32_t y1 = (y-1) & gHMask;
-    uint32_t y2 = (y+1) & gHMask;
-
-    uint p00 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y1);
-    uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1);
-    uint p02 = 56 *  rsGetElementAt_uchar(gBlendSource, x2, y1);
-    uint p10 = 114 * rsGetElementAt_uchar(gBlendSource, x1, y);
-    uint p11 = 230 * rsGetElementAt_uchar(gBlendSource, x, y);
-    uint p12 = 114 * rsGetElementAt_uchar(gBlendSource, x2, y);
-    uint p20 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y2);
-    uint p21 = 114 * rsGetElementAt_uchar(gBlendSource, x, y2);
-    uint p22 = 56 *  rsGetElementAt_uchar(gBlendSource, x2, y2);
-
-    p00 += p01;
-    p02 += p10;
-    p11 += p12;
-    p20 += p21;
-
-    p22 += p00;
-    p02 += p11;
-
-    p20 += p22;
-    p20 += p02;
-
-    p20 = min(p20 >> 10, (uint)255);
-    return (uchar)p20;
-}
-
-float gNoiseStrength;
-
-rs_allocation gNoise;
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    float4 ip = convert_float4(in);
-    float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask);
-
-    float energy_level = ip.r + ip.g + ip.b;
-    float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f;
-    pnoise = (pnoise - 128.f) * energy_mask;
-
-    ip += pnoise * gNoiseStrength;
-    ip = clamp(ip, 0.f, 255.f);
-
-    uchar4 p = convert_uchar4(ip);
-    p.a = 0xff;
-    return p;
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/greyscale.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/greyscale.fs
deleted file mode 100644
index 4e13072..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/greyscale.fs
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
-
-uchar4 __attribute__((kernel)) root(uchar4 v_in) {
-    float4 f4 = rsUnpackColor8888(v_in);
-
-    float3 mono = dot(f4.rgb, gMonoMult);
-    return rsPackColorTo8888(mono);
-}
-
-uchar __attribute__((kernel)) toU8(uchar4 v_in) {
-    float4 f4 = convert_float4(v_in);
-    return (uchar)dot(f4.rgb, gMonoMult);
-}
-
-uchar4 __attribute__((kernel)) toU8_4(uchar v_in) {
-    return (uchar4)v_in;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ip.rsh b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ip.rsh
deleted file mode 100644
index 34e213c..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ip.rsh
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.android.rs.image2)
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ip2_convolve3x3.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ip2_convolve3x3.rs
deleted file mode 100644
index 177e86e..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/ip2_convolve3x3.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-int32_t gWidth;
-int32_t gHeight;
-rs_allocation gIn;
-
-float gCoeffs[9];
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    uint32_t x1 = min((int32_t)x+1, gWidth-1);
-    uint32_t x2 = max((int32_t)x-1, 0);
-    uint32_t y1 = min((int32_t)y+1, gHeight-1);
-    uint32_t y2 = max((int32_t)y-1, 0);
-
-    float4 p00 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y1));
-    float4 p01 = convert_float4(rsGetElementAt_uchar4(gIn, x, y1));
-    float4 p02 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y1));
-    float4 p10 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y));
-    float4 p11 = convert_float4(rsGetElementAt_uchar4(gIn, x, y));
-    float4 p12 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y));
-    float4 p20 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y2));
-    float4 p21 = convert_float4(rsGetElementAt_uchar4(gIn, x, y2));
-    float4 p22 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y2));
-    p00 *= gCoeffs[0];
-    p01 *= gCoeffs[1];
-    p02 *= gCoeffs[2];
-    p10 *= gCoeffs[3];
-    p11 *= gCoeffs[4];
-    p12 *= gCoeffs[5];
-    p20 *= gCoeffs[6];
-    p21 *= gCoeffs[7];
-    p22 *= gCoeffs[8];
-
-    p00 += p01;
-    p02 += p10;
-    p11 += p12;
-    p20 += p21;
-
-    p22 += p00;
-    p02 += p11;
-
-    p20 += p22;
-    p20 += p02;
-
-    p20 = clamp(p20, 0.f, 255.f);
-    return convert_uchar4(p20);
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels.rsh b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels.rsh
deleted file mode 100644
index e289906..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels.rsh
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-float inBlack;
-float outBlack;
-float inWMinInB;
-float outWMinOutB;
-float overInWMinInB;
-rs_matrix3x3 colorMat;
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    uchar4 out;
-    float3 pixel = convert_float4(in).rgb;
-    pixel = rsMatrixMultiply(&colorMat, pixel);
-    pixel = clamp(pixel, 0.f, 255.f);
-    pixel = (pixel - inBlack) * overInWMinInB;
-    pixel = pixel * outWMinOutB + outBlack;
-    pixel = clamp(pixel, 0.f, 255.f);
-    out.xyz = convert_uchar3(pixel);
-    out.w = 0xff;
-    return out;
-}
-
-uchar4 __attribute__((kernel)) root4(uchar4 in, uint32_t x, uint32_t y) {
-    float4 pixel = convert_float4(in);
-    pixel.rgb = rsMatrixMultiply(&colorMat, pixel.rgb);
-    pixel = clamp(pixel, 0.f, 255.f);
-    pixel = (pixel - inBlack) * overInWMinInB;
-    pixel = pixel * outWMinOutB + outBlack;
-    pixel = clamp(pixel, 0.f, 255.f);
-    return convert_uchar4(pixel);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels_full.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels_full.rs
deleted file mode 100644
index 28596ba..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "levels.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels_relaxed.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels_relaxed.fs
deleted file mode 100644
index 28596ba..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/levels_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "levels.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/mandelbrot.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/mandelbrot.rs
deleted file mode 100644
index de0bd002c..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/mandelbrot.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2011 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.
-
-#include "ip.rsh"
-
-uint32_t gMaxIteration = 500;
-uint32_t gDimX = 1024;
-uint32_t gDimY = 1024;
-
-float lowerBoundX = -2.f;
-float lowerBoundY = -2.f;
-float scaleFactor = 4.f;
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-  float2 p;
-  p.x = lowerBoundX + ((float)x / gDimX) * scaleFactor;
-  p.y = lowerBoundY + ((float)y / gDimY) * scaleFactor;
-
-  float2 t = 0;
-  float2 t2 = t * t;
-  int iter = 0;
-  while((t2.x + t2.y < 4.f) && (iter < gMaxIteration)) {
-    float xtemp = t2.x - t2.y + p.x;
-    t.y = 2 * t.x * t.y + p.y;
-    t.x = xtemp;
-    iter++;
-    t2 = t * t;
-  }
-
-  if(iter >= gMaxIteration) {
-    // write a non-transparent black pixel
-    return (uchar4){0, 0, 0, 0xff};
-  } else {
-    float mi3 = gMaxIteration / 3.f;
-    if (iter <= (gMaxIteration / 3))
-      return (uchar4){0xff * (iter / mi3), 0, 0, 0xff};
-    else if (iter <= (((gMaxIteration / 3) * 2)))
-      return (uchar4){0xff - (0xff * ((iter - mi3) / mi3)),
-                      (0xff * ((iter - mi3) / mi3)), 0, 0xff};
-    else
-      return (uchar4){0, 0xff - (0xff * ((iter - (mi3 * 2)) / mi3)),
-                      (0xff * ((iter - (mi3 * 2)) / mi3)), 0xff};
-  }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/shadows.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/shadows.rs
deleted file mode 100644
index f6c149d..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/shadows.rs
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static double shadowFilterMap[] = {
-    -0.00591,  0.0001,
-     1.16488,  0.01668,
-    -0.18027, -0.06791,
-    -0.12625,  0.09001,
-     0.15065, -0.03897
-};
-
-static double poly[] = {
-    0., 0.,
-    0., 0.,
-    0.
-};
-
-static const int ABITS = 4;
-static const int HSCALE = 256;
-static const int k1=255 << ABITS;
-static const int k2=HSCALE << ABITS;
-
-static double fastevalPoly(double *poly,int n, double x){
-
-    double f =x;
-    double sum = poly[0]+poly[1]*f;
-    int i;
-    for (i = 2; i < n; i++) {
-        f*=x;
-        sum += poly[i]*f;
-    }
-    return sum;
-}
-
-static ushort3 rgb2hsv( uchar4 rgb)
-{
-    int iMin,iMax,chroma;
-
-    int ri = rgb.r;
-    int gi = rgb.g;
-    int bi = rgb.b;
-    short rv,rs,rh;
-
-    if (ri > gi) {
-        iMax = max (ri, bi);
-        iMin = min (gi, bi);
-    } else {
-        iMax = max (gi, bi);
-        iMin = min (ri, bi);
-    }
-
-    chroma = iMax - iMin;
-    // set value
-    rv = (short)( iMax << ABITS);
-
-    // set saturation
-    if (rv == 0)
-        rs = 0;
-    else
-        rs = (short)((k1*chroma)/iMax);
-
-    // set hue
-    if (rs == 0)
-        rh = 0;
-    else {
-        if ( ri == iMax ) {
-            rh  = (short)( (k2*(6*chroma+gi - bi))/(6*chroma));
-            if (rh >= k2) rh -= k2;
-        } else if (gi  == iMax)
-            rh  = (short)( (k2*(2*chroma+bi - ri ))/(6*chroma));
-        else // (bi == iMax )
-                    rh  = (short)( (k2*(4*chroma+ri - gi ))/(6*chroma));
-    }
-
-    ushort3 out;
-    out.x = rv;
-    out.y = rs;
-    out.z = rh;
-    return out;
-}
-
-static uchar4 hsv2rgb(ushort3 hsv)
-{
-    int ABITS = 4;
-    int HSCALE = 256;
-    int m;
-    int H,X,ih,is,iv;
-    int k1=255<<ABITS;
-    int k2=HSCALE<<ABITS;
-    int k3=1<<(ABITS-1);
-    int rr=0;
-    int rg=0;
-    int rb=0;
-    short cv = hsv.x;
-    short cs = hsv.y;
-    short ch = hsv.z;
-
-    // set chroma and min component value m
-    //chroma = ( cv * cs )/k1;
-    //m = cv - chroma;
-    m = ((int)cv*(k1 - (int)cs ))/k1;
-
-    // chroma  == 0 <-> cs == 0 --> m=cv
-    if (cs == 0) {
-        rb = ( rg = ( rr =( cv >> ABITS) ));
-    } else {
-        ih=(int)ch;
-        is=(int)cs;
-        iv=(int)cv;
-
-        H = (6*ih)/k2;
-        X = ((iv*is)/k2)*(k2- abs(6*ih- 2*(H>>1)*k2 - k2)) ;
-
-        // removing additional bits --> unit8
-        X=( (X+iv*(k1 - is ))/k1 + k3 ) >> ABITS;
-        m=m >> ABITS;
-
-        // ( chroma + m ) --> cv ;
-        cv=(short) (cv >> ABITS);
-        switch (H) {
-        case 0:
-            rr = cv;
-            rg = X;
-            rb = m;
-            break;
-        case 1:
-            rr = X;
-            rg = cv;
-            rb = m;
-            break;
-        case 2:
-            rr = m;
-            rg = cv;
-            rb = X;
-            break;
-        case 3:
-            rr = m;
-            rg = X;
-            rb = cv;
-            break;
-        case 4:
-            rr = X;
-            rg = m;
-            rb = cv;
-            break;
-        case 5:
-            rr = cv;
-            rg = m ;
-            rb = X;
-            break;
-        }
-    }
-
-    uchar4 rgb;
-
-    rgb.r =  rr;
-    rgb.g =  rg;
-    rgb.b =  rb;
-
-    return rgb;
-}
-
-void prepareShadows(float scale) {
-    double s = (scale>=0)?scale:scale/5;
-    for (int i = 0; i < 5; i++) {
-        poly[i] = fastevalPoly(shadowFilterMap+i*2,2 , s);
-    }
-}
-
-void shadowsKernel(const uchar4 *in, uchar4 *out) {
-    ushort3 hsv = rgb2hsv(*in);
-    double v = (fastevalPoly(poly,5,hsv.x/4080.)*4080);
-    if (v>4080) v = 4080;
-    hsv.x = (unsigned short) ((v>0)?v:0);
-    *out = hsv2rgb(hsv);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/threshold.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/threshold.fs
deleted file mode 100644
index 0b2c2e8..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/threshold.fs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include "ip.rsh"
-
-
-int height;
-int width;
-static int radius;
-
-rs_allocation InPixel;
-rs_allocation ScratchPixel1;
-rs_allocation ScratchPixel2;
-
-const int MAX_RADIUS = 25;
-
-// Store our coefficients here
-static float gaussian[MAX_RADIUS * 2 + 1];
-
-void setRadius(int rad) {
-    radius = rad;
-    // Compute gaussian weights for the blur
-    // e is the euler's number
-    float e = 2.718281828459045f;
-    float pi = 3.1415926535897932f;
-    // g(x) = ( 1 / sqrt( 2 * pi ) * sigma) * e ^ ( -x^2 / 2 * sigma^2 )
-    // x is of the form [-radius .. 0 .. radius]
-    // and sigma varies with radius.
-    // Based on some experimental radius values and sigma's
-    // we approximately fit sigma = f(radius) as
-    // sigma = radius * 0.4  + 0.6
-    // The larger the radius gets, the more our gaussian blur
-    // will resemble a box blur since with large sigma
-    // the gaussian curve begins to lose its shape
-    float sigma = 0.4f * (float)radius + 0.6f;
-
-    // Now compute the coefficints
-    // We will store some redundant values to save some math during
-    // the blur calculations
-    // precompute some values
-    float coeff1 = 1.0f / (sqrt( 2.0f * pi ) * sigma);
-    float coeff2 = - 1.0f / (2.0f * sigma * sigma);
-
-    float normalizeFactor = 0.0f;
-    float floatR = 0.0f;
-    for (int r = -radius; r <= radius; r ++) {
-        floatR = (float)r;
-        gaussian[r + radius] = coeff1 * pow(e, floatR * floatR * coeff2);
-        normalizeFactor += gaussian[r + radius];
-    }
-
-    //Now we need to normalize the weights because all our coefficients need to add up to one
-    normalizeFactor = 1.0f / normalizeFactor;
-    for (int r = -radius; r <= radius; r ++) {
-        floatR = (float)r;
-        gaussian[r + radius] *= normalizeFactor;
-    }
-}
-
-float4 __attribute__((kernel)) copyIn(uchar4 in) {
-    return convert_float4(in);
-}
-
-uchar4 __attribute__((kernel)) vert(uint32_t x, uint32_t y) {
-    float3 blurredPixel = 0;
-    int gi = 0;
-    uchar4 out;
-    if ((y > radius) && (y < (height - radius))) {
-        for (int r = -radius; r <= radius; r ++) {
-            float4 i = rsGetElementAt_float4(ScratchPixel2, x, y + r);
-            blurredPixel += i.xyz * gaussian[gi++];
-        }
-    } else {
-        for (int r = -radius; r <= radius; r ++) {
-            int validH = rsClamp((int)y + r, (int)0, (int)(height - 1));
-            float4 i = rsGetElementAt_float4(ScratchPixel2, x, validH);
-            blurredPixel += i.xyz * gaussian[gi++];
-        }
-    }
-
-    out.xyz = convert_uchar3(clamp(blurredPixel, 0.f, 255.f));
-    out.w = 0xff;
-    return out;
-}
-
-float4 __attribute__((kernel)) horz(uint32_t x, uint32_t y) {
-    float4 blurredPixel = 0;
-    int gi = 0;
-    if ((x > radius) && (x < (width - radius))) {
-        for (int r = -radius; r <= radius; r ++) {
-            float4 i = rsGetElementAt_float4(ScratchPixel1, x + r, y);
-            blurredPixel += i * gaussian[gi++];
-        }
-    } else {
-        for (int r = -radius; r <= radius; r ++) {
-            // Stepping left and right away from the pixel
-            int validX = rsClamp((int)x + r, (int)0, (int)(width - 1));
-            float4 i = rsGetElementAt_float4(ScratchPixel1, validX, y);
-            blurredPixel += i * gaussian[gi++];
-        }
-    }
-
-    return blurredPixel;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vibrance.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vibrance.rs
deleted file mode 100644
index ad4de58..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vibrance.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-float vibrance = 0.f;
-
-static const float Rf = 0.2999f;
-static const float Gf = 0.587f;
-static const float Bf = 0.114f;
-
-static float S  = 0.f;
-static float MS = 0.f;
-static float Rt = 0.f;
-static float Gt = 0.f;
-static float Bt = 0.f;
-static float Vib = 0.f;
-
-void vibranceKernel(const uchar4 *in, uchar4 *out) {
-
-    float R, G, B;
-
-    int r = in->r;
-    int g = in->g;
-    int b = in->b;
-    float red = (r-max(g, b))/256.f;
-    float sx = (float)(Vib/(1+native_exp(-red*3)));
-    S = sx+1;
-    MS = 1.0f - S;
-    Rt = Rf * MS;
-    Gt = Gf * MS;
-    Bt = Bf * MS;
-    int t = (r + g) / 2;
-    R = r;
-    G = g;
-    B = b;
-
-    float Rc = R * (Rt + S) + G * Gt + B * Bt;
-    float Gc = R * Rt + G * (Gt + S) + B * Bt;
-    float Bc = R * Rt + G * Gt + B * (Bt + S);
-
-    out->r = rsClamp(Rc, 0, 255);
-    out->g = rsClamp(Gc, 0, 255);
-    out->b = rsClamp(Bc, 0, 255);
-
-}
-
-void prepareVibrance() {
-
-    Vib = vibrance/100.f;
-    S  = Vib + 1;
-    MS = 1.0f - S;
-    Rt = Rf * MS;
-    Gt = Gf * MS;
-    Bt = Bf * MS;
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette.rsh b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette.rsh
deleted file mode 100644
index 04ca1f1..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette.rsh
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-static float2 neg_center, axis_scale, inv_dimensions;
-static float sloped_neg_range, sloped_inv_max_dist, shade, opp_shade;
-
-void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
-        float desired_scale, float desired_shade, float desired_slope) {
-
-    neg_center.x = -center_x;
-    neg_center.y = -center_y;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float max_dist = 0.5f * length(axis_scale);
-    sloped_inv_max_dist = desired_slope * 1.f/max_dist;
-
-    // Range needs to be between 1.3 to 0.6. When scale is zero then range is
-    // 1.3 which means no vignette at all because the luminousity difference is
-    // less than 1/256.  Expect input scale to be between 0.0 and 1.0.
-    const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
-    sloped_neg_range = exp(neg_range * desired_slope);
-
-    shade = desired_shade;
-    opp_shade = 1.f - desired_shade;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float4 fin = convert_float4(in);
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float sloped_dist_ratio = length(axis_scale * coord)  * sloped_inv_max_dist;
-    const float lumen = opp_shade + shade / ( 1.0f + sloped_neg_range * exp(sloped_dist_ratio) );
-    float4 fout;
-    fout.rgb = fin.rgb * lumen;
-    fout.w = fin.w;
-    return convert_uchar4(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx.rsh b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx.rsh
deleted file mode 100644
index 5668621..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx.rsh
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-static float2 neg_center, axis_scale, inv_dimensions;
-static float sloped_neg_range, sloped_inv_max_dist, shade, opp_shade;
-
-void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
-        float desired_scale, float desired_shade, float desired_slope) {
-
-    neg_center.x = -center_x;
-    neg_center.y = -center_y;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float max_dist = 0.5f * length(axis_scale);
-    sloped_inv_max_dist = desired_slope * 1.f/max_dist;
-
-    // Range needs to be between 1.3 to 0.6. When scale is zero then range is
-    // 1.3 which means no vignette at all because the luminousity difference is
-    // less than 1/256.  Expect input scale to be between 0.0 and 1.0.
-    const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
-    sloped_neg_range = exp(neg_range * desired_slope);
-
-    shade = desired_shade;
-    opp_shade = 1.f - desired_shade;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float4 fin = convert_float4(in);
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float sloped_dist_ratio = fast_length(axis_scale * coord)  * sloped_inv_max_dist;
-    const float lumen = opp_shade + shade * half_recip(1.f + sloped_neg_range * native_exp(sloped_dist_ratio));
-    float4 fout;
-    fout.rgb = fin.rgb * lumen;
-    fout.w = fin.w;
-    return convert_uchar4(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx_full.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx_full.rs
deleted file mode 100644
index 00cbbc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx_relaxed.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx_relaxed.fs
deleted file mode 100644
index 00cbbc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_approx_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_full.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_full.rs
deleted file mode 100644
index 8202c5c..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_relaxed.fs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_relaxed.fs
deleted file mode 100644
index 8202c5c..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/vignette_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/wbalance.rs b/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/wbalance.rs
deleted file mode 100644
index 6650671..0000000
--- a/tests/RenderScriptTests/ImageProcessing2/src/com/android/rs/image/wbalance.rs
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static int histR[256] = {0}, histG[256] = {0}, histB[256] = {0};
-
-rs_allocation histogramSource;
-uint32_t histogramHeight;
-uint32_t histogramWidth;
-
-static float scaleR;
-static float scaleG;
-static float scaleB;
-
-static uchar4 estimateWhite() {
-
-    for (int i = 0; i < 256; i++) {
-        histR[i] = 0; histG[i] = 0; histB[i] = 0;
-    }
-
-    for (uint32_t i = 0; i < histogramHeight; i++) {
-        for (uint32_t j = 0; j < histogramWidth; j++) {
-            uchar4 in = rsGetElementAt_uchar4(histogramSource, j, i);
-            histR[in.r]++;
-            histG[in.g]++;
-            histB[in.b]++;
-        }
-    }
-
-    int min_r = -1, min_g = -1, min_b = -1;
-    int max_r =  0, max_g =  0, max_b =  0;
-    int sum_r =  0, sum_g =  0, sum_b =  0;
-
-    for (int i = 1; i < 255; i++) {
-        int r = histR[i];
-        int g = histG[i];
-        int b = histB[i];
-        sum_r += r;
-        sum_g += g;
-        sum_b += b;
-
-        if (r>0){
-            if (min_r < 0) min_r = i;
-            max_r = i;
-        }
-        if (g>0){
-            if (min_g < 0) min_g = i;
-            max_g = i;
-        }
-        if (b>0){
-            if (min_b < 0) min_b = i;
-            max_b = i;
-        }
-    }
-
-    int sum15r = 0, sum15g = 0, sum15b = 0;
-    int count15r = 0, count15g = 0, count15b = 0;
-    int tmp_r = 0, tmp_g = 0, tmp_b = 0;
-
-    for (int i = 254; i >0; i--) {
-        int r = histR[i];
-        int g = histG[i];
-        int b = histB[i];
-        tmp_r += r;
-        tmp_g += g;
-        tmp_b += b;
-
-        if ((tmp_r > sum_r/20) && (tmp_r < sum_r/5)) {
-            sum15r += r*i;
-            count15r += r;
-        }
-        if ((tmp_g > sum_g/20) && (tmp_g < sum_g/5)) {
-            sum15g += g*i;
-            count15g += g;
-        }
-        if ((tmp_b > sum_b/20) && (tmp_b < sum_b/5)) {
-            sum15b += b*i;
-            count15b += b;
-        }
-
-    }
-
-    uchar4 out;
-
-    if ((count15r>0) && (count15g>0) && (count15b>0) ){
-        out.r = sum15r/count15r;
-        out.g = sum15g/count15g;
-        out.b = sum15b/count15b;
-    }else {
-        out.r = out.g = out.b = 255;
-    }
-
-    return out;
-
-}
-
-void prepareWhiteBalance() {
-    uchar4 estimation = estimateWhite();
-    int minimum = min(estimation.r, min(estimation.g, estimation.b));
-    int maximum = max(estimation.r, max(estimation.g, estimation.b));
-    float avg = (minimum + maximum) / 2.f;
-
-    scaleR =  avg/estimation.r;
-    scaleG =  avg/estimation.g;
-    scaleB =  avg/estimation.b;
-
-}
-
-static unsigned char contrastClamp(int c)
-{
-    int N = 255;
-    c &= ~(c >> 31);
-    c -= N;
-    c &= (c >> 31);
-    c += N;
-    return  (unsigned char) c;
-}
-
-void whiteBalanceKernel(const uchar4 *in, uchar4 *out) {
-    float Rc =  in->r*scaleR;
-    float Gc =  in->g*scaleG;
-    float Bc =  in->b*scaleB;
-
-    out->r = contrastClamp(Rc);
-    out->g = contrastClamp(Gc);
-    out->b = contrastClamp(Bc);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/Android.mk b/tests/RenderScriptTests/ImageProcessing_jb/Android.mk
deleted file mode 100644
index 20d6be7..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright (C) 2009 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-#LOCAL_STATIC_JAVA_LIBRARIES := android.renderscript
-
-LOCAL_PACKAGE_NAME := ImageProcessingJB
-LOCAL_SDK_VERSION := 17
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/AndroidManifest.xml b/tests/RenderScriptTests/ImageProcessing_jb/AndroidManifest.xml
deleted file mode 100644
index b3fcfc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.imagejb">
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-sdk android:minSdkVersion="11" />
-    <application android:label="Image Processing JB"
-                 android:hardwareAccelerated="true">
-        <activity android:name="ImageProcessingActivityJB">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/res/drawable-nodpi/img1600x1067.jpg b/tests/RenderScriptTests/ImageProcessing_jb/res/drawable-nodpi/img1600x1067.jpg
deleted file mode 100644
index 05d3ee2..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/res/drawable-nodpi/img1600x1067.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/res/drawable-nodpi/img1600x1067b.jpg b/tests/RenderScriptTests/ImageProcessing_jb/res/drawable-nodpi/img1600x1067b.jpg
deleted file mode 100644
index aed0781..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/res/drawable-nodpi/img1600x1067b.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/res/layout/main.xml b/tests/RenderScriptTests/ImageProcessing_jb/res/layout/main.xml
deleted file mode 100644
index f0a2b92..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/res/layout/main.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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="fill_parent"
-            android:layout_height="fill_parent"
-            android:id="@+id/toplevel">
-    <SurfaceView
-        android:id="@+id/surface"
-        android:layout_width="1dip"
-        android:layout_height="1dip" />
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-            <ImageView
-                android:id="@+id/display"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content">
-                    <Button
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/benchmark"
-                        android:onClick="benchmark"/>
-                    <TextView
-                        android:id="@+id/benchmarkText"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/saturation"/>
-            </LinearLayout>
-            <Spinner
-                android:id="@+id/filterselection"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <Spinner
-                android:id="@+id/spinner1"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider1Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/saturation"/>
-             <SeekBar
-                android:id="@+id/slider1"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider2Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/gamma"/>
-            <SeekBar
-                android:id="@+id/slider2"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider3Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:textSize="8pt"
-                android:text="@string/out_white"/>
-            <SeekBar
-                android:id="@+id/slider3"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider4Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/slider4"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/slider5Text"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/slider5"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <Button
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/benchmark_all"
-                    android:onClick="benchmark_all"/>
-            </LinearLayout>
-    </ScrollView>
-</LinearLayout>
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/res/layout/spinner_layout.xml b/tests/RenderScriptTests/ImageProcessing_jb/res/layout/spinner_layout.xml
deleted file mode 100644
index 8196bbf..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/res/layout/spinner_layout.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2012 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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="10dp"
-    android:textSize="16sp"
-/>
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/res/values/strings.xml b/tests/RenderScriptTests/ImageProcessing_jb/res/values/strings.xml
deleted file mode 100644
index a7dd165..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/res/values/strings.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* 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.
-*/
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- General -->
-    <skip />
-    <!--slider label -->
-    <string name="blur_description">Blur Radius</string>
-    <string name="in_white">In White</string>
-    <string name="out_white">Out White</string>
-    <string name="in_black">In Black</string>
-    <string name="out_black">Out Black</string>
-    <string name="gamma">Gamma</string>
-    <string name="saturation">Saturation</string>
-    <string name="benchmark">Benchmark</string>
-    <string name="benchmark_all">Benchmark All</string>
-
-</resources>
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/BWFilter.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/BWFilter.java
deleted file mode 100644
index 4870ac4..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/BWFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-
-public class BWFilter extends TestBase {
-    private ScriptC_bwfilter mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_bwfilter(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_prepareBwFilter(50, 50, 50);
-        mScript.forEach_bwFilterKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Blend.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Blend.java
deleted file mode 100644
index 302dc31..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Blend.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-import java.lang.Short;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicBlend;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.view.View;
-import android.widget.Spinner;
-
-public class Blend extends TestBase {
-    private ScriptIntrinsicBlend mBlend;
-    private ScriptC_blend mBlendHelper;
-    private short image1Alpha = 128;
-    private short image2Alpha = 128;
-
-    String mIntrinsicNames[];
-
-    private Allocation image1;
-    private Allocation image2;
-    private int currentIntrinsic = 0;
-
-    private AdapterView.OnItemSelectedListener mIntrinsicSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-                    currentIntrinsic = pos;
-                    if (mRS != null) {
-                        runTest();
-                        act.updateDisplay();
-                    }
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-            };
-
-    public void createTest(android.content.res.Resources res) {
-        mBlend = ScriptIntrinsicBlend.create(mRS, Element.U8_4(mRS));
-        mBlendHelper = new ScriptC_blend(mRS);
-        mBlendHelper.set_alpha((short)128);
-
-        image1 = Allocation.createTyped(mRS, mInPixelsAllocation.getType());
-        image2 = Allocation.createTyped(mRS, mInPixelsAllocation2.getType());
-
-        mIntrinsicNames = new String[14];
-        mIntrinsicNames[0] = "Source";
-        mIntrinsicNames[1] = "Destination";
-        mIntrinsicNames[2] = "Source Over";
-        mIntrinsicNames[3] = "Destination Over";
-        mIntrinsicNames[4] = "Source In";
-        mIntrinsicNames[5] = "Destination In";
-        mIntrinsicNames[6] = "Source Out";
-        mIntrinsicNames[7] = "Destination Out";
-        mIntrinsicNames[8] = "Source Atop";
-        mIntrinsicNames[9] = "Destination Atop";
-        mIntrinsicNames[10] = "XOR";
-        mIntrinsicNames[11] = "Add";
-        mIntrinsicNames[12] = "Subtract";
-        mIntrinsicNames[13] = "Multiply";
-    }
-
-    public boolean onSpinner1Setup(Spinner s) {
-        s.setAdapter(new ArrayAdapter<String>(
-            act, R.layout.spinner_layout, mIntrinsicNames));
-        s.setOnItemSelectedListener(mIntrinsicSpinnerListener);
-        return true;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Image 1 Alpha");
-        b.setMax(255);
-        b.setProgress(image1Alpha);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        image1Alpha = (short)progress;
-    }
-
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Image 2 Alpha");
-        b.setMax(255);
-        b.setProgress(image2Alpha);
-        return true;
-    }
-
-    public void onBar2Changed(int progress) {
-        image2Alpha = (short)progress;
-    }
-
-    public void runTest() {
-        image1.copy2DRangeFrom(0, 0, mInPixelsAllocation.getType().getX(), mInPixelsAllocation.getType().getY(), mInPixelsAllocation, 0, 0);
-        image2.copy2DRangeFrom(0, 0, mInPixelsAllocation2.getType().getX(), mInPixelsAllocation2.getType().getY(), mInPixelsAllocation2, 0, 0);
-
-        mBlendHelper.set_alpha(image1Alpha);
-        mBlendHelper.forEach_setImageAlpha(image1);
-
-        mBlendHelper.set_alpha(image2Alpha);
-        mBlendHelper.forEach_setImageAlpha(image2);
-
-        switch (currentIntrinsic) {
-        case 0:
-            mBlend.forEachSrc(image1, image2);
-            break;
-        case 1:
-            mBlend.forEachDst(image1, image2);
-            break;
-        case 2:
-            mBlend.forEachSrcOver(image1, image2);
-            break;
-        case 3:
-            mBlend.forEachDstOver(image1, image2);
-            break;
-        case 4:
-            mBlend.forEachSrcIn(image1, image2);
-            break;
-        case 5:
-            mBlend.forEachDstIn(image1, image2);
-            break;
-        case 6:
-            mBlend.forEachSrcOut(image1, image2);
-            break;
-        case 7:
-            mBlend.forEachDstOut(image1, image2);
-            break;
-        case 8:
-            mBlend.forEachSrcAtop(image1, image2);
-            break;
-        case 9:
-            mBlend.forEachDstAtop(image1, image2);
-            break;
-        case 10:
-            mBlend.forEachXor(image1, image2);
-            break;
-        case 11:
-            mBlend.forEachAdd(image1, image2);
-            break;
-        case 12:
-            mBlend.forEachSubtract(image1, image2);
-            break;
-        case 13:
-            mBlend.forEachMultiply(image1, image2);
-            break;
-        }
-
-        mOutPixelsAllocation.copy2DRangeFrom(0, 0, image2.getType().getX(), image2.getType().getY(), image2, 0, 0);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Blur25.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Blur25.java
deleted file mode 100644
index 90acd00..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Blur25.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicBlur;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Blur25 extends TestBase {
-    private boolean mUseIntrinsic = false;
-    private ScriptIntrinsicBlur mIntrinsic;
-
-    private int MAX_RADIUS = 25;
-    private ScriptC_threshold mScript;
-    private float mRadius = MAX_RADIUS;
-    private float mSaturation = 1.0f;
-    private Allocation mScratchPixelsAllocation1;
-    private Allocation mScratchPixelsAllocation2;
-
-
-    public Blur25(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Radius");
-        b.setProgress(100);
-        return true;
-    }
-
-
-    public void onBar1Changed(int progress) {
-        mRadius = ((float)progress) / 100.0f * MAX_RADIUS;
-        if (mRadius <= 0.10f) {
-            mRadius = 0.10f;
-        }
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(mRadius);
-        } else {
-            mScript.invoke_setRadius((int)mRadius);
-        }
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicBlur.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setRadius(MAX_RADIUS);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-
-            Type.Builder tb = new Type.Builder(mRS, Element.F32_4(mRS));
-            tb.setX(width);
-            tb.setY(height);
-            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, tb.create());
-            mScratchPixelsAllocation2 = Allocation.createTyped(mRS, tb.create());
-
-            mScript = new ScriptC_threshold(mRS, res, R.raw.threshold);
-            mScript.set_width(width);
-            mScript.set_height(height);
-            mScript.invoke_setRadius(MAX_RADIUS);
-
-            mScript.set_InPixel(mInPixelsAllocation);
-            mScript.set_ScratchPixel1(mScratchPixelsAllocation1);
-            mScript.set_ScratchPixel2(mScratchPixelsAllocation2);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_copyIn(mInPixelsAllocation, mScratchPixelsAllocation1);
-            mScript.forEach_horz(mScratchPixelsAllocation2);
-            mScript.forEach_vert(mOutPixelsAllocation);
-        }
-    }
-
-    public void setupBenchmark() {
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(MAX_RADIUS);
-        } else {
-            mScript.invoke_setRadius(MAX_RADIUS);
-        }
-    }
-
-    public void exitBenchmark() {
-        if (mUseIntrinsic) {
-            mIntrinsic.setRadius(mRadius);
-        } else {
-            mScript.invoke_setRadius((int)mRadius);
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ColorMatrix.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ColorMatrix.java
deleted file mode 100644
index 5053d4d..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ColorMatrix.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicColorMatrix;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class ColorMatrix extends TestBase {
-    private ScriptC_colormatrix mScript;
-    private ScriptIntrinsicColorMatrix mIntrinsic;
-    private boolean mUseIntrinsic;
-    private boolean mUseGrey;
-
-    public ColorMatrix(boolean useIntrinsic, boolean useGrey) {
-        mUseIntrinsic = useIntrinsic;
-        mUseGrey = useGrey;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-            if (mUseGrey) {
-                mIntrinsic.setGreyscale();
-            } else {
-                mIntrinsic.setColorMatrix(m);
-            }
-        } else {
-            mScript = new ScriptC_colormatrix(mRS, res, R.raw.colormatrix);
-            mScript.invoke_setMatrix(m);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Contrast.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Contrast.java
deleted file mode 100644
index 20b28ff..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Contrast.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Contrast extends TestBase {
-    private ScriptC_contrast mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_contrast(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_setBright(50.f);
-        mScript.forEach_contrast(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Convolve3x3.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Convolve3x3.java
deleted file mode 100644
index d7acf4a..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Convolve3x3.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicConvolve3x3;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Convolve3x3 extends TestBase {
-    private ScriptC_convolve3x3 mScript;
-    private ScriptIntrinsicConvolve3x3 mIntrinsic;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseIntrinsic;
-
-    public Convolve3x3(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        float f[] = new float[9];
-        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
-        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
-        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setCoefficients(f);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-            mScript = new ScriptC_convolve3x3(mRS, res, R.raw.convolve3x3);
-            mScript.set_gCoeffs(f);
-            mScript.set_gIn(mInPixelsAllocation);
-            mScript.set_gWidth(mWidth);
-            mScript.set_gHeight(mHeight);
-        }
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Convolve5x5.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Convolve5x5.java
deleted file mode 100644
index d1dbb1f..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Convolve5x5.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix4f;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.ScriptGroup;
-import android.renderscript.ScriptIntrinsicConvolve5x5;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Convolve5x5 extends TestBase {
-    private ScriptC_convolve5x5 mScript;
-    private ScriptIntrinsicConvolve5x5 mIntrinsic;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseIntrinsic;
-
-    public Convolve5x5(boolean useIntrinsic) {
-        mUseIntrinsic = useIntrinsic;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        float f[] = new float[25];
-        //f[0] = 0.012f; f[1] = 0.025f; f[2] = 0.031f; f[3] = 0.025f; f[4] = 0.012f;
-        //f[5] = 0.025f; f[6] = 0.057f; f[7] = 0.075f; f[8] = 0.057f; f[9] = 0.025f;
-        //f[10]= 0.031f; f[11]= 0.075f; f[12]= 0.095f; f[13]= 0.075f; f[14]= 0.031f;
-        //f[15]= 0.025f; f[16]= 0.057f; f[17]= 0.075f; f[18]= 0.057f; f[19]= 0.025f;
-        //f[20]= 0.012f; f[21]= 0.025f; f[22]= 0.031f; f[23]= 0.025f; f[24]= 0.012f;
-
-        //f[0] = 1.f; f[1] = 2.f; f[2] = 0.f; f[3] = -2.f; f[4] = -1.f;
-        //f[5] = 4.f; f[6] = 8.f; f[7] = 0.f; f[8] = -8.f; f[9] = -4.f;
-        //f[10]= 6.f; f[11]=12.f; f[12]= 0.f; f[13]=-12.f; f[14]= -6.f;
-        //f[15]= 4.f; f[16]= 8.f; f[17]= 0.f; f[18]= -8.f; f[19]= -4.f;
-        //f[20]= 1.f; f[21]= 2.f; f[22]= 0.f; f[23]= -2.f; f[24]= -1.f;
-
-        f[0] = -1.f; f[1] = -3.f; f[2] = -4.f; f[3] = -3.f; f[4] = -1.f;
-        f[5] = -3.f; f[6] =  0.f; f[7] =  6.f; f[8] =  0.f; f[9] = -3.f;
-        f[10]= -4.f; f[11]=  6.f; f[12]= 20.f; f[13]=  6.f; f[14]= -4.f;
-        f[15]= -3.f; f[16]=  0.f; f[17]=  6.f; f[18]=  0.f; f[19]= -3.f;
-        f[20]= -1.f; f[21]= -3.f; f[22]= -4.f; f[23]= -3.f; f[24]= -1.f;
-
-        if (mUseIntrinsic) {
-            mIntrinsic = ScriptIntrinsicConvolve5x5.create(mRS, Element.U8_4(mRS));
-            mIntrinsic.setCoefficients(f);
-            mIntrinsic.setInput(mInPixelsAllocation);
-        } else {
-            mScript = new ScriptC_convolve5x5(mRS, res, R.raw.convolve5x5);
-            mScript.set_gCoeffs(f);
-            mScript.set_gIn(mInPixelsAllocation);
-            mScript.set_gWidth(mWidth);
-            mScript.set_gHeight(mHeight);
-        }
-    }
-
-    public void runTest() {
-        if (mUseIntrinsic) {
-            mIntrinsic.forEach(mOutPixelsAllocation);
-        } else {
-            mScript.forEach_root(mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Copy.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Copy.java
deleted file mode 100644
index 1bdee4b..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Copy.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Copy extends TestBase {
-    private ScriptC_copy mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_copy(mRS, res, R.raw.copy);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/CrossProcess.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/CrossProcess.java
deleted file mode 100644
index 75ee39b..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/CrossProcess.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicLUT;
-import android.util.Log;
-
-public class CrossProcess extends TestBase {
-    private ScriptIntrinsicLUT mIntrinsic;
-
-    public void createTest(android.content.res.Resources res) {
-        mIntrinsic = ScriptIntrinsicLUT.create(mRS, Element.U8_4(mRS));
-        for (int ct=0; ct < 256; ct++) {
-            float f = ((float)ct) / 255.f;
-
-            float r = f;
-            if (r < 0.5f) {
-                r = 4.0f * r * r * r;
-            } else {
-                r = 1.0f - r;
-                r = 1.0f - (4.0f * r * r * r);
-            }
-            mIntrinsic.setRed(ct, (int)(r * 255.f + 0.5f));
-
-            float g = f;
-            if (g < 0.5f) {
-                g = 2.0f * g * g;
-            } else {
-                g = 1.0f - g;
-                g = 1.0f - (2.0f * g * g);
-            }
-            mIntrinsic.setGreen(ct, (int)(g * 255.f + 0.5f));
-
-            float b = f * 0.5f + 0.25f;
-            mIntrinsic.setBlue(ct, (int)(b * 255.f + 0.5f));
-        }
-
-    }
-
-    public void runTest() {
-        mIntrinsic.forEach(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Exposure.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Exposure.java
deleted file mode 100644
index ddde96f..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Exposure.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Exposure extends TestBase {
-    private ScriptC_exposure mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_exposure(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_setBright(50.f);
-        mScript.forEach_exposure(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Fisheye.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Fisheye.java
deleted file mode 100644
index 114839c..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Fisheye.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Sampler;
-import android.renderscript.Type;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Fisheye extends TestBase {
-    private ScriptC_fisheye_full mScript_full = null;
-    private ScriptC_fisheye_relaxed mScript_relaxed = null;
-    private ScriptC_fisheye_approx_full mScript_approx_full = null;
-    private ScriptC_fisheye_approx_relaxed mScript_approx_relaxed = null;
-    private final boolean approx;
-    private final boolean relaxed;
-    private float center_x = 0.5f;
-    private float center_y = 0.5f;
-    private float scale = 0.5f;
-
-    public Fisheye(boolean approx, boolean relaxed) {
-        this.approx = approx;
-        this.relaxed = relaxed;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Scale");
-        b.setMax(100);
-        b.setProgress(25);
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Shift center X");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Shift center Y");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        scale = progress / 50.0f;
-        do_init();
-    }
-    public void onBar2Changed(int progress) {
-        center_x = progress / 100.0f;
-        do_init();
-    }
-    public void onBar3Changed(int progress) {
-        center_y = progress / 100.0f;
-        do_init();
-    }
-
-    private void do_init() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.invoke_init_filter(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale);
-            else
-                mScript_approx_full.invoke_init_filter(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale);
-        } else if (relaxed)
-            mScript_relaxed.invoke_init_filter(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale);
-        else
-            mScript_full.invoke_init_filter(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        if (approx) {
-            if (relaxed) {
-                mScript_approx_relaxed = new ScriptC_fisheye_approx_relaxed(mRS,
-                        res, R.raw.fisheye_approx_relaxed);
-                mScript_approx_relaxed.set_in_alloc(mInPixelsAllocation);
-                mScript_approx_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-            } else {
-                mScript_approx_full = new ScriptC_fisheye_approx_full(mRS, res,
-                        R.raw.fisheye_approx_full);
-                mScript_approx_full.set_in_alloc(mInPixelsAllocation);
-                mScript_approx_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-            }
-        } else if (relaxed) {
-            mScript_relaxed = new ScriptC_fisheye_relaxed(mRS, res,
-                    R.raw.fisheye_relaxed);
-            mScript_relaxed.set_in_alloc(mInPixelsAllocation);
-            mScript_relaxed.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-        } else {
-            mScript_full = new ScriptC_fisheye_full(mRS, res,
-                    R.raw.fisheye_full);
-            mScript_full.set_in_alloc(mInPixelsAllocation);
-            mScript_full.set_sampler(Sampler.CLAMP_LINEAR(mRS));
-        }
-        do_init();
-    }
-
-    public void runTest() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.forEach_root(mOutPixelsAllocation);
-            else
-                mScript_approx_full.forEach_root(mOutPixelsAllocation);
-        } else if (relaxed)
-            mScript_relaxed.forEach_root(mOutPixelsAllocation);
-        else
-            mScript_full.forEach_root(mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Grain.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Grain.java
deleted file mode 100644
index 5cd19a2..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Grain.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Grain extends TestBase {
-    private ScriptC_grain mScript;
-    private Allocation mNoise;
-    private Allocation mNoise2;
-
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Strength");
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        float s = progress / 100.0f;
-        mScript.set_gNoiseStrength(s);
-    }
-
-    private int findHighBit(int v) {
-        int bit = 0;
-        while (v > 1) {
-            bit++;
-            v >>= 1;
-        }
-        return bit;
-    }
-
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mInPixelsAllocation.getType().getX();
-        int height = mInPixelsAllocation.getType().getY();
-
-        int noiseW = findHighBit(width);
-        int noiseH = findHighBit(height);
-        if (noiseW > 9) {
-            noiseW = 9;
-        }
-        if (noiseH > 9) {
-            noiseH = 9;
-        }
-        noiseW = 1 << noiseW;
-        noiseH = 1 << noiseH;
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8(mRS));
-        tb.setX(noiseW);
-        tb.setY(noiseH);
-        mNoise = Allocation.createTyped(mRS, tb.create());
-        mNoise2 = Allocation.createTyped(mRS, tb.create());
-
-        mScript = new ScriptC_grain(mRS, res, R.raw.grain);
-        mScript.set_gWMask(noiseW - 1);
-        mScript.set_gHMask(noiseH - 1);
-        mScript.set_gNoiseStrength(0.5f);
-        mScript.set_gBlendSource(mNoise);
-        mScript.set_gNoise(mNoise2);
-    }
-
-    public void runTest() {
-        mScript.forEach_genRand(mNoise);
-        mScript.forEach_blend9(mNoise2);
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Greyscale.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Greyscale.java
deleted file mode 100644
index f1952e7..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Greyscale.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-
-public class Greyscale extends TestBase {
-    private ScriptC_greyscale mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_greyscale(mRS, res, R.raw.greyscale);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/GroupTest.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/GroupTest.java
deleted file mode 100644
index 3e5175a..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/GroupTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.ScriptIntrinsicConvolve3x3;
-import android.renderscript.ScriptIntrinsicColorMatrix;
-import android.renderscript.Type;
-import android.renderscript.Matrix4f;
-import android.renderscript.ScriptGroup;
-import android.util.Log;
-
-public class GroupTest extends TestBase {
-    private ScriptIntrinsicConvolve3x3 mConvolve;
-    private ScriptIntrinsicColorMatrix mMatrix;
-
-    private Allocation mScratchPixelsAllocation1;
-    private ScriptGroup mGroup;
-
-    private int mWidth;
-    private int mHeight;
-    private boolean mUseNative;
-
-
-    public GroupTest(boolean useNative) {
-        mUseNative = useNative;
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mWidth = mInPixelsAllocation.getType().getX();
-        mHeight = mInPixelsAllocation.getType().getY();
-
-        mConvolve = ScriptIntrinsicConvolve3x3.create(mRS, Element.U8_4(mRS));
-        mMatrix = ScriptIntrinsicColorMatrix.create(mRS, Element.U8_4(mRS));
-
-        float f[] = new float[9];
-        f[0] =  0.f;    f[1] = -1.f;    f[2] =  0.f;
-        f[3] = -1.f;    f[4] =  5.f;    f[5] = -1.f;
-        f[6] =  0.f;    f[7] = -1.f;    f[8] =  0.f;
-        mConvolve.setCoefficients(f);
-
-        Matrix4f m = new Matrix4f();
-        m.set(1, 0, 0.2f);
-        m.set(1, 1, 0.9f);
-        m.set(1, 2, 0.2f);
-        mMatrix.setColorMatrix(m);
-
-        Type.Builder tb = new Type.Builder(mRS, Element.U8_4(mRS));
-        tb.setX(mWidth);
-        tb.setY(mHeight);
-        Type connect = tb.create();
-
-        if (mUseNative) {
-            ScriptGroup.Builder b = new ScriptGroup.Builder(mRS);
-            b.addKernel(mConvolve.getKernelID());
-            b.addKernel(mMatrix.getKernelID());
-            b.addConnection(connect, mConvolve.getKernelID(), mMatrix.getKernelID());
-            mGroup = b.create();
-        } else {
-            mScratchPixelsAllocation1 = Allocation.createTyped(mRS, connect);
-        }
-    }
-
-    public void runTest() {
-        mConvolve.setInput(mInPixelsAllocation);
-        if (mUseNative) {
-            mGroup.setOutput(mMatrix.getKernelID(), mOutPixelsAllocation);
-            mGroup.execute();
-        } else {
-            mConvolve.forEach(mScratchPixelsAllocation1);
-            mMatrix.forEach(mScratchPixelsAllocation1, mOutPixelsAllocation);
-        }
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java
deleted file mode 100644
index 93937ef..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ImageProcessingActivityJB.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.view.SurfaceView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.Spinner;
-import android.widget.TextView;
-import android.view.View;
-import android.util.Log;
-import android.renderscript.ScriptC;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Script;
-
-import android.os.Environment;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-public class ImageProcessingActivityJB extends Activity
-                                       implements SeekBar.OnSeekBarChangeListener {
-    private final String TAG = "Img";
-    public final String RESULT_FILE = "image_processing_result.csv";
-
-    RenderScript mRS;
-    Allocation mInPixelsAllocation;
-    Allocation mInPixelsAllocation2;
-    Allocation mOutPixelsAllocation;
-
-    /**
-     * Define enum type for test names
-     */
-    public enum TestName {
-        // totally there are 38 test cases
-        LEVELS_VEC3_RELAXED ("Levels Vec3 Relaxed"),
-        LEVELS_VEC4_RELAXED ("Levels Vec4 Relaxed"),
-        LEVELS_VEC3_FULL ("Levels Vec3 Full"),
-        LEVELS_VEC4_FULL ("Levels Vec4 Full"),
-        BLUR_RADIUS_25 ("Blur radius 25"),
-        INTRINSIC_BLUE_RADIUS_25 ("Intrinsic Blur radius 25"),
-        GREYSCALE ("Greyscale"),
-        GRAIN ("Grain"),
-        FISHEYE_FULL ("Fisheye Full"),
-        FISHEYE_RELAXED ("Fisheye Relaxed"),
-        FISHEYE_APPROXIMATE_FULL ("Fisheye Approximate Full"),
-        FISHEYE_APPROXIMATE_RELAXED ("Fisheye Approximate Relaxed"),
-        VIGNETTE_FULL ("Vignette Full"),
-        VIGNETTE_RELAXED ("Vignette Relaxed"),
-        VIGNETTE_APPROXIMATE_FULL ("Vignette Approximate Full"),
-        VIGNETTE_APPROXIMATE_RELAXED ("Vignette Approximate Relaxed"),
-        GROUP_TEST_EMULATED ("Group Test (emulated)"),
-        GROUP_TEST_NATIVE ("Group Test (native)"),
-        CONVOLVE_3X3 ("Convolve 3x3"),
-        INTRINSICS_CONVOLVE_3X3 ("Intrinsics Convolve 3x3"),
-        COLOR_MATRIX ("ColorMatrix"),
-        INTRINSICS_COLOR_MATRIX ("Intrinsics ColorMatrix"),
-        INTRINSICS_COLOR_MATRIX_GREY ("Intrinsics ColorMatrix Grey"),
-        COPY ("Copy"),
-        CROSS_PROCESS_USING_LUT ("CrossProcess (using LUT)"),
-        CONVOLVE_5X5 ("Convolve 5x5"),
-        INTRINSICS_CONVOLVE_5X5 ("Intrinsics Convolve 5x5"),
-        MANDELBROT ("Mandelbrot"),
-        INTRINSICS_BLEND ("Intrinsics Blend"),
-        VIBRANCE ("Vibrance"),
-        BW_FILTER ("BW Filter"),
-        SHADOWS ("Shadows"),
-        CONTRAST ("Contrast"),
-        EXPOSURE ("Exposure"),
-        WHITE_BALANCE ("White Balance");
-
-
-        private final String name;
-
-        private TestName(String s) {
-            name = s;
-        }
-
-        // return quoted string as displayed test name
-        public String toString() {
-            return name;
-        }
-    }
-
-    Bitmap mBitmapIn;
-    Bitmap mBitmapIn2;
-    Bitmap mBitmapOut;
-
-    private Spinner mSpinner;
-    private SeekBar mBar1;
-    private SeekBar mBar2;
-    private SeekBar mBar3;
-    private SeekBar mBar4;
-    private SeekBar mBar5;
-    private TextView mText1;
-    private TextView mText2;
-    private TextView mText3;
-    private TextView mText4;
-    private TextView mText5;
-
-    private float mSaturation = 1.0f;
-
-    private TextView mBenchmarkResult;
-    private Spinner mTestSpinner;
-
-    private SurfaceView mSurfaceView;
-    private ImageView mDisplayView;
-
-    private boolean mDoingBenchmark;
-
-    private TestBase mTest;
-    private int mRunCount;
-
-    public void updateDisplay() {
-        mHandler.sendMessage(Message.obtain());
-    }
-
-    private Handler mHandler = new Handler() {
-        // Allow the filter to complete without blocking the UI
-        // thread.  When the message arrives that the op is complete
-        // we will either mark completion or start a new filter if
-        // more work is ready.  Either way, display the result.
-        @Override
-        public void handleMessage(Message msg) {
-            mTest.updateBitmap(mBitmapOut);
-            mDisplayView.invalidate();
-
-            boolean doTest = false;
-            synchronized(this) {
-                if (mRunCount > 0) {
-                    mRunCount--;
-                    if (mRunCount > 0) {
-                        doTest = true;
-                    }
-                }
-            }
-            if (doTest) {
-                mTest.runTestSendMessage();
-            }
-        }
-
-    };
-
-    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        if (fromUser) {
-
-            if (seekBar == mBar1) {
-                mTest.onBar1Changed(progress);
-            } else if (seekBar == mBar2) {
-                mTest.onBar2Changed(progress);
-            } else if (seekBar == mBar3) {
-                mTest.onBar3Changed(progress);
-            } else if (seekBar == mBar4) {
-                mTest.onBar4Changed(progress);
-            } else if (seekBar == mBar5) {
-                mTest.onBar5Changed(progress);
-            }
-
-            boolean doTest = false;
-            synchronized(this) {
-                if (mRunCount == 0) {
-                    doTest = true;
-                    mRunCount = 1;
-                } else {
-                    mRunCount = 2;
-                }
-            }
-            if (doTest) {
-                mTest.runTestSendMessage();
-            }
-        }
-    }
-
-    public void onStartTrackingTouch(SeekBar seekBar) {
-    }
-
-    public void onStopTrackingTouch(SeekBar seekBar) {
-    }
-
-    void setupBars() {
-        mSpinner.setVisibility(View.VISIBLE);
-        mTest.onSpinner1Setup(mSpinner);
-
-        mBar1.setVisibility(View.VISIBLE);
-        mText1.setVisibility(View.VISIBLE);
-        mTest.onBar1Setup(mBar1, mText1);
-
-        mBar2.setVisibility(View.VISIBLE);
-        mText2.setVisibility(View.VISIBLE);
-        mTest.onBar2Setup(mBar2, mText2);
-
-        mBar3.setVisibility(View.VISIBLE);
-        mText3.setVisibility(View.VISIBLE);
-        mTest.onBar3Setup(mBar3, mText3);
-
-        mBar4.setVisibility(View.VISIBLE);
-        mText4.setVisibility(View.VISIBLE);
-        mTest.onBar4Setup(mBar4, mText4);
-
-        mBar5.setVisibility(View.VISIBLE);
-        mText5.setVisibility(View.VISIBLE);
-        mTest.onBar5Setup(mBar5, mText5);
-    }
-
-
-    void changeTest(TestName testName) {
-        if (mTest != null) {
-            mTest.destroy();
-        }
-        switch(testName) {
-        case LEVELS_VEC3_RELAXED:
-            mTest = new LevelsV4(false, false);
-            break;
-        case LEVELS_VEC4_RELAXED:
-            mTest = new LevelsV4(false, true);
-            break;
-        case LEVELS_VEC3_FULL:
-            mTest = new LevelsV4(true, false);
-            break;
-        case LEVELS_VEC4_FULL:
-            mTest = new LevelsV4(true, true);
-            break;
-        case BLUR_RADIUS_25:
-            mTest = new Blur25(false);
-            break;
-        case INTRINSIC_BLUE_RADIUS_25:
-            mTest = new Blur25(true);
-            break;
-        case GREYSCALE:
-            mTest = new Greyscale();
-            break;
-        case GRAIN:
-            mTest = new Grain();
-            break;
-        case FISHEYE_FULL:
-            mTest = new Fisheye(false, false);
-            break;
-        case FISHEYE_RELAXED:
-            mTest = new Fisheye(false, true);
-            break;
-        case FISHEYE_APPROXIMATE_FULL:
-            mTest = new Fisheye(true, false);
-            break;
-        case FISHEYE_APPROXIMATE_RELAXED:
-            mTest = new Fisheye(true, true);
-            break;
-        case VIGNETTE_FULL:
-            mTest = new Vignette(false, false);
-            break;
-        case VIGNETTE_RELAXED:
-            mTest = new Vignette(false, true);
-            break;
-        case VIGNETTE_APPROXIMATE_FULL:
-            mTest = new Vignette(true, false);
-            break;
-        case VIGNETTE_APPROXIMATE_RELAXED:
-            mTest = new Vignette(true, true);
-            break;
-        case GROUP_TEST_EMULATED:
-            mTest = new GroupTest(false);
-            break;
-        case GROUP_TEST_NATIVE:
-            mTest = new GroupTest(true);
-            break;
-        case CONVOLVE_3X3:
-            mTest = new Convolve3x3(false);
-            break;
-        case INTRINSICS_CONVOLVE_3X3:
-            mTest = new Convolve3x3(true);
-            break;
-        case COLOR_MATRIX:
-            mTest = new ColorMatrix(false, false);
-            break;
-        case INTRINSICS_COLOR_MATRIX:
-            mTest = new ColorMatrix(true, false);
-            break;
-        case INTRINSICS_COLOR_MATRIX_GREY:
-            mTest = new ColorMatrix(true, true);
-            break;
-        case COPY:
-            mTest = new Copy();
-            break;
-        case CROSS_PROCESS_USING_LUT:
-            mTest = new CrossProcess();
-            break;
-        case CONVOLVE_5X5:
-            mTest = new Convolve5x5(false);
-            break;
-        case INTRINSICS_CONVOLVE_5X5:
-            mTest = new Convolve5x5(true);
-            break;
-        case MANDELBROT:
-            mTest = new Mandelbrot();
-            break;
-        case INTRINSICS_BLEND:
-            mTest = new Blend();
-            break;
-        case VIBRANCE:
-            mTest = new Vibrance();
-            break;
-        case BW_FILTER:
-            mTest = new BWFilter();
-            break;
-        case SHADOWS:
-            mTest = new Shadows();
-            break;
-        case CONTRAST:
-            mTest = new Contrast();
-            break;
-        case EXPOSURE:
-            mTest = new Exposure();
-            break;
-        case WHITE_BALANCE:
-            mTest = new WhiteBalance();
-            break;
-        }
-
-        mTest.createBaseTest(this, mBitmapIn, mBitmapIn2, mBitmapOut);
-        setupBars();
-
-        mTest.runTest();
-        updateDisplay();
-        mBenchmarkResult.setText("Result: not run");
-    }
-
-    void setupTests() {
-        mTestSpinner.setAdapter(new ArrayAdapter<TestName>(
-            this, R.layout.spinner_layout, TestName.values()));
-    }
-
-    private AdapterView.OnItemSelectedListener mTestSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
-                    changeTest(TestName.values()[pos]);
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-            };
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        mBitmapIn = loadBitmap(R.drawable.img1600x1067);
-        mBitmapIn2 = loadBitmap(R.drawable.img1600x1067b);
-        mBitmapOut = Bitmap.createBitmap(mBitmapIn.getWidth(), mBitmapIn.getHeight(),
-                                         mBitmapIn.getConfig());
-
-        mSurfaceView = (SurfaceView) findViewById(R.id.surface);
-
-        mDisplayView = (ImageView) findViewById(R.id.display);
-        mDisplayView.setImageBitmap(mBitmapOut);
-
-        mSpinner = (Spinner) findViewById(R.id.spinner1);
-
-        mBar1 = (SeekBar) findViewById(R.id.slider1);
-        mBar2 = (SeekBar) findViewById(R.id.slider2);
-        mBar3 = (SeekBar) findViewById(R.id.slider3);
-        mBar4 = (SeekBar) findViewById(R.id.slider4);
-        mBar5 = (SeekBar) findViewById(R.id.slider5);
-
-        mBar1.setOnSeekBarChangeListener(this);
-        mBar2.setOnSeekBarChangeListener(this);
-        mBar3.setOnSeekBarChangeListener(this);
-        mBar4.setOnSeekBarChangeListener(this);
-        mBar5.setOnSeekBarChangeListener(this);
-
-        mText1 = (TextView) findViewById(R.id.slider1Text);
-        mText2 = (TextView) findViewById(R.id.slider2Text);
-        mText3 = (TextView) findViewById(R.id.slider3Text);
-        mText4 = (TextView) findViewById(R.id.slider4Text);
-        mText5 = (TextView) findViewById(R.id.slider5Text);
-
-        mTestSpinner = (Spinner) findViewById(R.id.filterselection);
-        mTestSpinner.setOnItemSelectedListener(mTestSpinnerListener);
-
-        mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText);
-        mBenchmarkResult.setText("Result: not run");
-
-
-        mRS = RenderScript.create(this);
-        mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn);
-        mInPixelsAllocation2 = Allocation.createFromBitmap(mRS, mBitmapIn2);
-        mOutPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapOut);
-
-
-        setupTests();
-        changeTest(TestName.LEVELS_VEC3_RELAXED);
-    }
-
-
-    private Bitmap loadBitmap(int resource) {
-        final BitmapFactory.Options options = new BitmapFactory.Options();
-        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
-        return BitmapFactory.decodeResource(getResources(), resource, options);
-    }
-
-    // button hook
-    public void benchmark(View v) {
-        float t = getBenchmark();
-        //long javaTime = javaFilter();
-        //mBenchmarkResult.setText("RS: " + t + " ms  Java: " + javaTime + " ms");
-        mBenchmarkResult.setText("Result: " + t + " ms");
-        Log.v(TAG, "getBenchmark: Renderscript frame time core ms " + t);
-    }
-
-    public void benchmark_all(View v) {
-        // write result into a file
-        File externalStorage = Environment.getExternalStorageDirectory();
-        if (!externalStorage.canWrite()) {
-            Log.v(TAG, "sdcard is not writable");
-            return;
-        }
-        File resultFile = new File(externalStorage, RESULT_FILE);
-        resultFile.setWritable(true, false);
-        try {
-            BufferedWriter rsWriter = new BufferedWriter(new FileWriter(resultFile));
-            Log.v(TAG, "Saved results in: " + resultFile.getAbsolutePath());
-            for (TestName tn: TestName.values()) {
-                changeTest(tn);
-                float t = getBenchmark();
-                String s = new String("" + tn.toString() + ", " + t);
-                rsWriter.write(s + "\n");
-                Log.v(TAG, "Test " + s + "ms\n");
-            }
-            rsWriter.close();
-        } catch (IOException e) {
-            Log.v(TAG, "Unable to write result file " + e.getMessage());
-        }
-        changeTest(TestName.LEVELS_VEC3_RELAXED);
-    }
-
-    // For benchmark test
-    public float getBenchmark() {
-        mDoingBenchmark = true;
-
-        mTest.setupBenchmark();
-        long result = 0;
-
-        //Log.v(TAG, "Warming");
-        long t = java.lang.System.currentTimeMillis() + 250;
-        do {
-            mTest.runTest();
-            mTest.finish();
-        } while (t > java.lang.System.currentTimeMillis());
-
-        //Log.v(TAG, "Benchmarking");
-        int ct = 0;
-        t = java.lang.System.currentTimeMillis();
-        do {
-            mTest.runTest();
-            mTest.finish();
-            ct++;
-        } while ((t+1000) > java.lang.System.currentTimeMillis());
-        t = java.lang.System.currentTimeMillis() - t;
-        float ft = (float)t;
-        ft /= ct;
-
-        mTest.exitBenchmark();
-        mDoingBenchmark = false;
-
-        return ft;
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/LevelsV4.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/LevelsV4.java
deleted file mode 100644
index 741e480..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/LevelsV4.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Matrix3f;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-
-public class LevelsV4 extends TestBase {
-    private ScriptC_levels_relaxed mScriptR;
-    private ScriptC_levels_full mScriptF;
-    private float mInBlack = 0.0f;
-    private float mOutBlack = 0.0f;
-    private float mInWhite = 255.0f;
-    private float mOutWhite = 255.0f;
-    private float mSaturation = 1.0f;
-
-    Matrix3f satMatrix = new Matrix3f();
-    float mInWMinInB;
-    float mOutWMinOutB;
-    float mOverInWMinInB;
-
-    boolean mUseFull;
-    boolean mUseV4;
-
-    LevelsV4(boolean useFull, boolean useV4) {
-        mUseFull = useFull;
-        mUseV4 = useV4;
-    }
-
-
-    private void setLevels() {
-        mInWMinInB = mInWhite - mInBlack;
-        mOutWMinOutB = mOutWhite - mOutBlack;
-        mOverInWMinInB = 1.f / mInWMinInB;
-
-        mScriptR.set_inBlack(mInBlack);
-        mScriptR.set_outBlack(mOutBlack);
-        mScriptR.set_inWMinInB(mInWMinInB);
-        mScriptR.set_outWMinOutB(mOutWMinOutB);
-        mScriptR.set_overInWMinInB(mOverInWMinInB);
-        mScriptF.set_inBlack(mInBlack);
-        mScriptF.set_outBlack(mOutBlack);
-        mScriptF.set_inWMinInB(mInWMinInB);
-        mScriptF.set_outWMinOutB(mOutWMinOutB);
-        mScriptF.set_overInWMinInB(mOverInWMinInB);
-    }
-
-    private void setSaturation() {
-        float rWeight = 0.299f;
-        float gWeight = 0.587f;
-        float bWeight = 0.114f;
-        float oneMinusS = 1.0f - mSaturation;
-
-        satMatrix.set(0, 0, oneMinusS * rWeight + mSaturation);
-        satMatrix.set(0, 1, oneMinusS * rWeight);
-        satMatrix.set(0, 2, oneMinusS * rWeight);
-        satMatrix.set(1, 0, oneMinusS * gWeight);
-        satMatrix.set(1, 1, oneMinusS * gWeight + mSaturation);
-        satMatrix.set(1, 2, oneMinusS * gWeight);
-        satMatrix.set(2, 0, oneMinusS * bWeight);
-        satMatrix.set(2, 1, oneMinusS * bWeight);
-        satMatrix.set(2, 2, oneMinusS * bWeight + mSaturation);
-        mScriptR.set_colorMat(satMatrix);
-        mScriptF.set_colorMat(satMatrix);
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        b.setProgress(50);
-        t.setText("Saturation");
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(0);
-        t.setText("In Black");
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(0);
-        t.setText("Out Black");
-        return true;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(128);
-        t.setText("Out White");
-        return true;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        b.setMax(128);
-        b.setProgress(128);
-        t.setText("Out White");
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        mSaturation = (float)progress / 50.0f;
-        setSaturation();
-    }
-    public void onBar2Changed(int progress) {
-        mInBlack = (float)progress;
-        setLevels();
-    }
-    public void onBar3Changed(int progress) {
-        mOutBlack = (float)progress;
-        setLevels();
-    }
-    public void onBar4Changed(int progress) {
-        mInWhite = (float)progress + 127.0f;
-        setLevels();
-    }
-    public void onBar5Changed(int progress) {
-        mOutWhite = (float)progress + 127.0f;
-        setLevels();
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        mScriptR = new ScriptC_levels_relaxed(mRS, res, R.raw.levels_relaxed);
-        mScriptF = new ScriptC_levels_full(mRS, res, R.raw.levels_full);
-        setSaturation();
-        setLevels();
-    }
-
-    public void runTest() {
-        if (mUseFull) {
-            if (mUseV4) {
-                mScriptF.forEach_root4(mInPixelsAllocation, mOutPixelsAllocation);
-            } else {
-                mScriptF.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-            }
-        } else {
-            if (mUseV4) {
-                mScriptR.forEach_root4(mInPixelsAllocation, mOutPixelsAllocation);
-            } else {
-                mScriptR.forEach_root(mInPixelsAllocation, mOutPixelsAllocation);
-            }
-        }
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Mandelbrot.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Mandelbrot.java
deleted file mode 100644
index ca34848..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Mandelbrot.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Script;
-import android.renderscript.ScriptC;
-import android.renderscript.Type;
-import android.util.Log;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Mandelbrot extends TestBase {
-    private ScriptC_mandelbrot mScript;
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Iterations");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        int iters = progress * 3 + 50;
-        mScript.set_gMaxIteration(iters);
-    }
-
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Lower Bound: X");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar2Changed(int progress) {
-        float scaleFactor = mScript.get_scaleFactor();
-        // allow viewport to be moved by 2x scale factor
-        float lowerBoundX = -2.f + ((progress / scaleFactor) / 50.f);
-        mScript.set_lowerBoundX(lowerBoundX);
-    }
-
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Lower Bound: Y");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar3Changed(int progress) {
-        float scaleFactor = mScript.get_scaleFactor();
-        // allow viewport to be moved by 2x scale factor
-        float lowerBoundY = -2.f + ((progress / scaleFactor) / 50.f);
-        mScript.set_lowerBoundY(lowerBoundY);
-    }
-
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        t.setText("Scale Factor");
-        b.setProgress(0);
-        return true;
-    }
-
-    public void onBar4Changed(int progress) {
-        float scaleFactor = 4.f - (3.96f * (progress / 100.f));
-        mScript.set_scaleFactor(scaleFactor);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        int width = mOutPixelsAllocation.getType().getX();
-        int height = mOutPixelsAllocation.getType().getY();
-
-        mScript = new ScriptC_mandelbrot(mRS, res, R.raw.mandelbrot);
-        mScript.set_gDimX(width);
-        mScript.set_gDimY(height);
-        mScript.set_gMaxIteration(50);
-    }
-
-    public void runTest() {
-        mScript.forEach_root(mOutPixelsAllocation);
-        mRS.finish();
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Shadows.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Shadows.java
deleted file mode 100644
index d246d59..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Shadows.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Shadows extends TestBase {
-    private ScriptC_shadows mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_shadows(mRS);
-    }
-
-    public void runTest() {
-        mScript.invoke_prepareShadows(50.f);
-        mScript.forEach_shadowsKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/TestBase.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/TestBase.java
deleted file mode 100644
index 9ae366a..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/TestBase.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.graphics.BitmapFactory;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.renderscript.ScriptC;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Script;
-import android.view.SurfaceView;
-import android.view.SurfaceHolder;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.view.View;
-import android.util.Log;
-import java.lang.Math;
-import android.widget.Spinner;
-
-public class TestBase  {
-    protected final String TAG = "Img";
-
-    protected RenderScript mRS;
-    protected Allocation mInPixelsAllocation;
-    protected Allocation mInPixelsAllocation2;
-    protected Allocation mOutPixelsAllocation;
-    protected ScriptC_msg mMessageScript;
-
-    protected ImageProcessingActivityJB act;
-
-    private class MessageProcessor extends RenderScript.RSMessageHandler {
-        ImageProcessingActivityJB mAct;
-
-        MessageProcessor(ImageProcessingActivityJB act) {
-            mAct = act;
-        }
-
-        public void run() {
-            mAct.updateDisplay();
-        }
-    }
-
-    // Override to use UI elements
-    public void onBar1Changed(int progress) {
-    }
-    public void onBar2Changed(int progress) {
-    }
-    public void onBar3Changed(int progress) {
-    }
-    public void onBar4Changed(int progress) {
-    }
-    public void onBar5Changed(int progress) {
-    }
-
-    // Override to use UI elements
-    // Unused bars will be hidden.
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        b.setVisibility(View.INVISIBLE);
-        t.setVisibility(View.INVISIBLE);
-        return false;
-    }
-
-    public boolean onSpinner1Setup(Spinner s) {
-        s.setVisibility(View.INVISIBLE);
-        return false;
-    }
-
-    public final void createBaseTest(ImageProcessingActivityJB ipact, Bitmap b, Bitmap b2, Bitmap outb) {
-        act = ipact;
-        mRS = ipact.mRS;
-        mRS.setMessageHandler(new MessageProcessor(act));
-
-        mInPixelsAllocation = ipact.mInPixelsAllocation;
-        mInPixelsAllocation2 = ipact.mInPixelsAllocation2;
-        mOutPixelsAllocation = ipact.mOutPixelsAllocation;
-
-        createTest(act.getResources());
-    }
-
-    // Must override
-    public void createTest(android.content.res.Resources res) {
-    }
-
-    // Must override
-    public void runTest() {
-    }
-
-    final public void runTestSendMessage() {
-        runTest();
-        mMessageScript.invoke_sendMsg();
-    }
-
-    public void finish() {
-        mRS.finish();
-    }
-
-    public void destroy() {
-        mRS.setMessageHandler(null);
-    }
-
-    public void updateBitmap(Bitmap b) {
-        mOutPixelsAllocation.copyTo(b);
-    }
-
-    // Override to configure specific benchmark config.
-    public void setupBenchmark() {
-    }
-
-    // Override to reset after benchmark.
-    public void exitBenchmark() {
-    }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Vibrance.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Vibrance.java
deleted file mode 100644
index 09822a9..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Vibrance.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class Vibrance extends TestBase {
-    private ScriptC_vibrance mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_vibrance(mRS);
-    }
-
-    public void runTest() {
-        mScript.set_vibrance(50.f);
-        mScript.invoke_prepareVibrance();
-        mScript.forEach_vibranceKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Vignette.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Vignette.java
deleted file mode 100644
index 9451757..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/Vignette.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Sampler;
-import android.renderscript.Type;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class Vignette extends TestBase {
-    private ScriptC_vignette_full mScript_full = null;
-    private ScriptC_vignette_relaxed mScript_relaxed = null;
-    private ScriptC_vignette_approx_full mScript_approx_full = null;
-    private ScriptC_vignette_approx_relaxed mScript_approx_relaxed = null;
-    private final boolean approx;
-    private final boolean relaxed;
-    private float center_x = 0.5f;
-    private float center_y = 0.5f;
-    private float scale = 0.5f;
-    private float shade = 0.5f;
-    private float slope = 20.0f;
-
-    public Vignette(boolean approx, boolean relaxed) {
-        this.approx = approx;
-        this.relaxed = relaxed;
-    }
-
-    public boolean onBar1Setup(SeekBar b, TextView t) {
-        t.setText("Scale");
-        b.setMax(100);
-        b.setProgress(25);
-        return true;
-    }
-    public boolean onBar2Setup(SeekBar b, TextView t) {
-        t.setText("Shade");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar3Setup(SeekBar b, TextView t) {
-        t.setText("Slope");
-        b.setMax(100);
-        b.setProgress(20);
-        return true;
-    }
-    public boolean onBar4Setup(SeekBar b, TextView t) {
-        t.setText("Shift center X");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-    public boolean onBar5Setup(SeekBar b, TextView t) {
-        t.setText("Shift center Y");
-        b.setMax(100);
-        b.setProgress(50);
-        return true;
-    }
-
-    public void onBar1Changed(int progress) {
-        scale = progress / 50.0f;
-        do_init();
-    }
-    public void onBar2Changed(int progress) {
-        shade = progress / 100.0f;
-        do_init();
-    }
-    public void onBar3Changed(int progress) {
-        slope = (float)progress;
-        do_init();
-    }
-    public void onBar4Changed(int progress) {
-        center_x = progress / 100.0f;
-        do_init();
-    }
-    public void onBar5Changed(int progress) {
-        center_y = progress / 100.0f;
-        do_init();
-    }
-
-    private void do_init() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.invoke_init_vignette(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale, shade, slope);
-            else
-                mScript_approx_full.invoke_init_vignette(
-                        mInPixelsAllocation.getType().getX(),
-                        mInPixelsAllocation.getType().getY(), center_x,
-                        center_y, scale, shade, slope);
-        } else if (relaxed)
-            mScript_relaxed.invoke_init_vignette(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale, shade, slope);
-        else
-            mScript_full.invoke_init_vignette(
-                    mInPixelsAllocation.getType().getX(),
-                    mInPixelsAllocation.getType().getY(), center_x, center_y,
-                    scale, shade, slope);
-    }
-
-    public void createTest(android.content.res.Resources res) {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed = new ScriptC_vignette_approx_relaxed(
-                        mRS, res, R.raw.vignette_approx_relaxed);
-            else
-                mScript_approx_full = new ScriptC_vignette_approx_full(
-                        mRS, res, R.raw.vignette_approx_full);
-        } else if (relaxed)
-            mScript_relaxed = new ScriptC_vignette_relaxed(mRS, res,
-                    R.raw.vignette_relaxed);
-        else
-            mScript_full = new ScriptC_vignette_full(mRS, res,
-                    R.raw.vignette_full);
-        do_init();
-    }
-
-    public void runTest() {
-        if (approx) {
-            if (relaxed)
-                mScript_approx_relaxed.forEach_root(mInPixelsAllocation,
-                        mOutPixelsAllocation);
-            else
-                mScript_approx_full.forEach_root(mInPixelsAllocation,
-                        mOutPixelsAllocation);
-        } else if (relaxed)
-            mScript_relaxed.forEach_root(mInPixelsAllocation,
-                    mOutPixelsAllocation);
-        else
-            mScript_full.forEach_root(mInPixelsAllocation,
-                    mOutPixelsAllocation);
-    }
-
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/WhiteBalance.java b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/WhiteBalance.java
deleted file mode 100644
index f15aaf5b..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/WhiteBalance.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.imagejb;
-
-import java.lang.Math;
-
-import android.renderscript.Allocation;
-
-public class WhiteBalance extends TestBase {
-    private ScriptC_wbalance mScript;
-
-    public void createTest(android.content.res.Resources res) {
-        mScript = new ScriptC_wbalance(mRS);
-    }
-
-    public void runTest() {
-        mScript.set_histogramSource(mInPixelsAllocation);
-        mScript.set_histogramWidth(mInPixelsAllocation.getType().getX());
-        mScript.set_histogramHeight(mInPixelsAllocation.getType().getY());
-        mScript.invoke_prepareWhiteBalance();
-        mScript.forEach_whiteBalanceKernel(mInPixelsAllocation, mOutPixelsAllocation);
-    }
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/blend.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/blend.rs
deleted file mode 100644
index 9ec1246..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/blend.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2011 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.
-
-#include "ip.rsh"
-
-uchar alpha = 0x0;
-
-void setImageAlpha(uchar4 *v_out, uint32_t x, uint32_t y) {
-  v_out->rgba = convert_uchar4((convert_uint4(v_out->rgba) * alpha) >> (uint4)8);
-  v_out->a = alpha;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs
deleted file mode 100644
index e706d44..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static float sr = 0.f;
-static float sg = 0.f;
-static float sb = 0.f;
-
-void prepareBwFilter(uint32_t rw, uint32_t gw, uint32_t bw) {
-
-    sr = rw;
-    sg = gw;
-    sb = bw;
-
-    float imageMin = min(sg,sb);
-    imageMin = fmin(sr,imageMin);
-    float imageMax = max(sg,sb);
-    imageMax = fmax(sr,imageMax);
-    float avg = (imageMin + imageMax)/2;
-    sb /= avg;
-    sg /= avg;
-    sr /= avg;
-
-}
-
-void bwFilterKernel(const uchar4 *in, uchar4 *out) {
-    float r = in->r * sr;
-    float g = in->g * sg;
-    float b = in->b * sb;
-    float localMin, localMax, avg;
-    localMin = fmin(g,b);
-    localMin = fmin(r,localMin);
-    localMax = fmax(g,b);
-    localMax = fmax(r,localMax);
-    avg = (localMin+localMax) * 0.5f;
-    out->r = out->g = out->b = rsClamp(avg, 0, 255);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/colormatrix.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/colormatrix.fs
deleted file mode 100644
index 86fb248..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/colormatrix.fs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static rs_matrix4x4 Mat;
-
-void init() {
-    rsMatrixLoadIdentity(&Mat);
-}
-
-void setMatrix(rs_matrix4x4 m) {
-    Mat = m;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in) {
-    float4 f = convert_float4(in);
-    f = rsMatrixMultiply(&Mat, f);
-    f = clamp(f, 0.f, 255.f);
-    return convert_uchar4(f);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/contrast.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/contrast.rs
deleted file mode 100644
index d3743d3..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/contrast.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static float brightM = 0.f;
-static float brightC = 0.f;
-
-void setBright(float v) {
-    brightM = pow(2.f, v / 100.f);
-    brightC = 127.f - brightM * 127.f;
-}
-
-void contrast(const uchar4 *in, uchar4 *out)
-{
-#if 0
-    out->r = rsClamp((int)(brightM * in->r + brightC), 0, 255);
-    out->g = rsClamp((int)(brightM * in->g + brightC), 0, 255);
-    out->b = rsClamp((int)(brightM * in->b + brightC), 0, 255);
-#else
-    float3 v = convert_float3(in->rgb) * brightM + brightC;
-    out->rgb = convert_uchar3(clamp(v, 0.f, 255.f));
-#endif
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/convolve3x3.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/convolve3x3.fs
deleted file mode 100644
index 177e86e..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/convolve3x3.fs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-int32_t gWidth;
-int32_t gHeight;
-rs_allocation gIn;
-
-float gCoeffs[9];
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    uint32_t x1 = min((int32_t)x+1, gWidth-1);
-    uint32_t x2 = max((int32_t)x-1, 0);
-    uint32_t y1 = min((int32_t)y+1, gHeight-1);
-    uint32_t y2 = max((int32_t)y-1, 0);
-
-    float4 p00 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y1));
-    float4 p01 = convert_float4(rsGetElementAt_uchar4(gIn, x, y1));
-    float4 p02 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y1));
-    float4 p10 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y));
-    float4 p11 = convert_float4(rsGetElementAt_uchar4(gIn, x, y));
-    float4 p12 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y));
-    float4 p20 = convert_float4(rsGetElementAt_uchar4(gIn, x1, y2));
-    float4 p21 = convert_float4(rsGetElementAt_uchar4(gIn, x, y2));
-    float4 p22 = convert_float4(rsGetElementAt_uchar4(gIn, x2, y2));
-    p00 *= gCoeffs[0];
-    p01 *= gCoeffs[1];
-    p02 *= gCoeffs[2];
-    p10 *= gCoeffs[3];
-    p11 *= gCoeffs[4];
-    p12 *= gCoeffs[5];
-    p20 *= gCoeffs[6];
-    p21 *= gCoeffs[7];
-    p22 *= gCoeffs[8];
-
-    p00 += p01;
-    p02 += p10;
-    p11 += p12;
-    p20 += p21;
-
-    p22 += p00;
-    p02 += p11;
-
-    p20 += p22;
-    p20 += p02;
-
-    p20 = clamp(p20, 0.f, 255.f);
-    return convert_uchar4(p20);
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/convolve5x5.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/convolve5x5.fs
deleted file mode 100644
index 922a593..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/convolve5x5.fs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-int32_t gWidth;
-int32_t gHeight;
-rs_allocation gIn;
-
-float gCoeffs[25];
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    uint32_t x0 = max((int32_t)x-2, 0);
-    uint32_t x1 = max((int32_t)x-1, 0);
-    uint32_t x2 = x;
-    uint32_t x3 = min((int32_t)x+1, gWidth-1);
-    uint32_t x4 = min((int32_t)x+2, gWidth-1);
-
-    uint32_t y0 = max((int32_t)y-2, 0);
-    uint32_t y1 = max((int32_t)y-1, 0);
-    uint32_t y2 = y;
-    uint32_t y3 = min((int32_t)y+1, gHeight-1);
-    uint32_t y4 = min((int32_t)y+2, gHeight-1);
-
-    float4 p0 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y0)) * gCoeffs[0]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y0)) * gCoeffs[1]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y0)) * gCoeffs[2]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y0)) * gCoeffs[3]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y0)) * gCoeffs[4];
-
-    float4 p1 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y1)) * gCoeffs[5]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y1)) * gCoeffs[6]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y1)) * gCoeffs[7]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y1)) * gCoeffs[8]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y1)) * gCoeffs[9];
-
-    float4 p2 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y2)) * gCoeffs[10]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y2)) * gCoeffs[11]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y2)) * gCoeffs[12]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y2)) * gCoeffs[13]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y2)) * gCoeffs[14];
-
-    float4 p3 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y3)) * gCoeffs[15]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y3)) * gCoeffs[16]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y3)) * gCoeffs[17]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y3)) * gCoeffs[18]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y3)) * gCoeffs[19];
-
-    float4 p4 = convert_float4(rsGetElementAt_uchar4(gIn, x0, y4)) * gCoeffs[20]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x1, y4)) * gCoeffs[21]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x2, y4)) * gCoeffs[22]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x3, y4)) * gCoeffs[23]
-              + convert_float4(rsGetElementAt_uchar4(gIn, x4, y4)) * gCoeffs[24];
-
-    p0 = clamp(p0 + p1 + p2 + p3 + p4, 0.f, 255.f);
-    return convert_uchar4(p0);
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/copy.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/copy.fs
deleted file mode 100644
index 6595874..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/copy.fs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-uchar4 __attribute__((kernel)) root(uchar4 v_in) {
-    return v_in;
-}
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/exposure.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/exposure.rs
deleted file mode 100644
index 0f05cb9..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/exposure.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-static float bright = 0.f;
-
-void setBright(float v) {
-    bright = 255.f / (255.f - v);
-}
-
-void exposure(const uchar4 *in, uchar4 *out)
-{
-    out->r = rsClamp((int)(bright * in->r), 0, 255);
-    out->g = rsClamp((int)(bright * in->g), 0, 255);
-    out->b = rsClamp((int)(bright * in->b), 0, 255);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye.rsh b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye.rsh
deleted file mode 100644
index 2eacb7d..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye.rsh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-rs_allocation in_alloc;
-rs_sampler sampler;
-
-static float2 center, neg_center, inv_dimensions, axis_scale;
-static float alpha, radius2, factor;
-
-void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y, float k) {
-    center.x = center_x;
-    center.y = center_y;
-    neg_center = -center;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-    alpha = k * 2.0f + 0.75f;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-    
-    const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
-    const float bound = sqrt(bound2);
-    const float radius = 1.15f * bound;
-    radius2 = radius*radius;
-    const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
-    factor = bound / max_radian;
-}
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float2 scaledCoord = axis_scale * coord;
-    const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
-    const float inv_dist = rsqrt(dist2);
-    const float radian = M_PI_2 - atan((alpha * sqrt(radius2 - dist2)) * inv_dist);
-    const float scalar = radian * factor * inv_dist;
-    const float2 new_coord = mad(coord, scalar, center);
-    const float4 fout = rsSample(in_alloc, sampler, new_coord);
-    return rsPackColorTo8888(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx.rsh b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx.rsh
deleted file mode 100644
index fcf0a3d..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx.rsh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-rs_allocation in_alloc;
-rs_sampler sampler;
-
-static float2 center, neg_center, inv_dimensions, axis_scale;
-static float alpha, radius2, factor;
-
-void init_filter(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y, float k) {
-    center.x = center_x;
-    center.y = center_y;
-    neg_center = -center;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-    alpha = k * 2.0f + 0.75f;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float bound2 = 0.25f * (axis_scale.x*axis_scale.x + axis_scale.y*axis_scale.y);
-    const float bound = sqrt(bound2);
-    const float radius = 1.15f * bound;
-    radius2 = radius*radius;
-    const float max_radian = M_PI_2 - atan(alpha / bound * sqrt(radius2 - bound2));
-    factor = bound / max_radian;
-}
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float2 scaledCoord = axis_scale * coord;
-    const float dist2 = scaledCoord.x*scaledCoord.x + scaledCoord.y*scaledCoord.y;
-    const float inv_dist = half_rsqrt(dist2);
-    const float radian = M_PI_2 - atan((alpha * half_sqrt(radius2 - dist2)) * inv_dist);
-    const float scalar = radian * factor * inv_dist;
-    const float2 new_coord = mad(coord, scalar, center);
-    const float4 fout = rsSample(in_alloc, sampler, new_coord);
-    return rsPackColorTo8888(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx_full.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx_full.rs
deleted file mode 100644
index ed69ff4..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx_relaxed.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx_relaxed.fs
deleted file mode 100644
index ed69ff4..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_approx_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_full.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_full.rs
deleted file mode 100644
index f986b5d..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_relaxed.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_relaxed.fs
deleted file mode 100644
index f986b5d..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/fisheye_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "fisheye.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/grain.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/grain.fs
deleted file mode 100644
index 2e62cd7..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/grain.fs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-uchar __attribute__((kernel)) genRand() {
-    return (uchar)rsRand(0xff);
-}
-
-/*
- * Convolution matrix of distance 2 with fixed point of 'kShiftBits' bits
- * shifted. Thus the sum of this matrix should be 'kShiftValue'. Entries of
- * small values are not calculated to gain efficiency.
- * The order ot pixels represented in this matrix is:
- *  1  2  3
- *  4  0  5
- *  6  7  8
- *  and the matrix should be: {230, 56, 114, 56, 114, 114, 56, 114, 56}.
- *  However, since most of the valus are identical, we only use the first three
- *  entries and the entries corresponding to the pixels is:
- *  1  2  1
- *  2  0  2
- *  1  2  1
- */
-
-int32_t gWMask;
-int32_t gHMask;
-
-rs_allocation gBlendSource;
-uchar __attribute__((kernel)) blend9(uint32_t x, uint32_t y) {
-    uint32_t x1 = (x-1) & gWMask;
-    uint32_t x2 = (x+1) & gWMask;
-    uint32_t y1 = (y-1) & gHMask;
-    uint32_t y2 = (y+1) & gHMask;
-
-    uint p00 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y1);
-    uint p01 = 114 * rsGetElementAt_uchar(gBlendSource, x, y1);
-    uint p02 = 56 *  rsGetElementAt_uchar(gBlendSource, x2, y1);
-    uint p10 = 114 * rsGetElementAt_uchar(gBlendSource, x1, y);
-    uint p11 = 230 * rsGetElementAt_uchar(gBlendSource, x, y);
-    uint p12 = 114 * rsGetElementAt_uchar(gBlendSource, x2, y);
-    uint p20 = 56 *  rsGetElementAt_uchar(gBlendSource, x1, y2);
-    uint p21 = 114 * rsGetElementAt_uchar(gBlendSource, x, y2);
-    uint p22 = 56 *  rsGetElementAt_uchar(gBlendSource, x2, y2);
-
-    p00 += p01;
-    p02 += p10;
-    p11 += p12;
-    p20 += p21;
-
-    p22 += p00;
-    p02 += p11;
-
-    p20 += p22;
-    p20 += p02;
-
-    p20 = min(p20 >> 10, (uint)255);
-    return (uchar)p20;
-}
-
-float gNoiseStrength;
-
-rs_allocation gNoise;
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    float4 ip = convert_float4(in);
-    float pnoise = (float) rsGetElementAt_uchar(gNoise, x & gWMask, y & gHMask);
-
-    float energy_level = ip.r + ip.g + ip.b;
-    float energy_mask = (28.f - sqrt(energy_level)) * 0.03571f;
-    pnoise = (pnoise - 128.f) * energy_mask;
-
-    ip += pnoise * gNoiseStrength;
-    ip = clamp(ip, 0.f, 255.f);
-
-    uchar4 p = convert_uchar4(ip);
-    p.a = 0xff;
-    return p;
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/greyscale.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/greyscale.fs
deleted file mode 100644
index 4e13072..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/greyscale.fs
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
-
-uchar4 __attribute__((kernel)) root(uchar4 v_in) {
-    float4 f4 = rsUnpackColor8888(v_in);
-
-    float3 mono = dot(f4.rgb, gMonoMult);
-    return rsPackColorTo8888(mono);
-}
-
-uchar __attribute__((kernel)) toU8(uchar4 v_in) {
-    float4 f4 = convert_float4(v_in);
-    return (uchar)dot(f4.rgb, gMonoMult);
-}
-
-uchar4 __attribute__((kernel)) toU8_4(uchar v_in) {
-    return (uchar4)v_in;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ip.rsh b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ip.rsh
deleted file mode 100644
index 8124211..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/ip.rsh
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.android.rs.imagejb)
-
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels.rsh b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels.rsh
deleted file mode 100644
index e289906..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels.rsh
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-float inBlack;
-float outBlack;
-float inWMinInB;
-float outWMinOutB;
-float overInWMinInB;
-rs_matrix3x3 colorMat;
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    uchar4 out;
-    float3 pixel = convert_float4(in).rgb;
-    pixel = rsMatrixMultiply(&colorMat, pixel);
-    pixel = clamp(pixel, 0.f, 255.f);
-    pixel = (pixel - inBlack) * overInWMinInB;
-    pixel = pixel * outWMinOutB + outBlack;
-    pixel = clamp(pixel, 0.f, 255.f);
-    out.xyz = convert_uchar3(pixel);
-    out.w = 0xff;
-    return out;
-}
-
-uchar4 __attribute__((kernel)) root4(uchar4 in, uint32_t x, uint32_t y) {
-    float4 pixel = convert_float4(in);
-    pixel.rgb = rsMatrixMultiply(&colorMat, pixel.rgb);
-    pixel = clamp(pixel, 0.f, 255.f);
-    pixel = (pixel - inBlack) * overInWMinInB;
-    pixel = pixel * outWMinOutB + outBlack;
-    pixel = clamp(pixel, 0.f, 255.f);
-    return convert_uchar4(pixel);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels_full.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels_full.rs
deleted file mode 100644
index 28596ba..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "levels.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels_relaxed.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels_relaxed.fs
deleted file mode 100644
index 28596ba..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/levels_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "levels.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/mandelbrot.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/mandelbrot.rs
deleted file mode 100644
index de0bd002c..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/mandelbrot.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2011 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.
-
-#include "ip.rsh"
-
-uint32_t gMaxIteration = 500;
-uint32_t gDimX = 1024;
-uint32_t gDimY = 1024;
-
-float lowerBoundX = -2.f;
-float lowerBoundY = -2.f;
-float scaleFactor = 4.f;
-
-uchar4 __attribute__((kernel)) root(uint32_t x, uint32_t y) {
-  float2 p;
-  p.x = lowerBoundX + ((float)x / gDimX) * scaleFactor;
-  p.y = lowerBoundY + ((float)y / gDimY) * scaleFactor;
-
-  float2 t = 0;
-  float2 t2 = t * t;
-  int iter = 0;
-  while((t2.x + t2.y < 4.f) && (iter < gMaxIteration)) {
-    float xtemp = t2.x - t2.y + p.x;
-    t.y = 2 * t.x * t.y + p.y;
-    t.x = xtemp;
-    iter++;
-    t2 = t * t;
-  }
-
-  if(iter >= gMaxIteration) {
-    // write a non-transparent black pixel
-    return (uchar4){0, 0, 0, 0xff};
-  } else {
-    float mi3 = gMaxIteration / 3.f;
-    if (iter <= (gMaxIteration / 3))
-      return (uchar4){0xff * (iter / mi3), 0, 0, 0xff};
-    else if (iter <= (((gMaxIteration / 3) * 2)))
-      return (uchar4){0xff - (0xff * ((iter - mi3) / mi3)),
-                      (0xff * ((iter - mi3) / mi3)), 0, 0xff};
-    else
-      return (uchar4){0, 0xff - (0xff * ((iter - (mi3 * 2)) / mi3)),
-                      (0xff * ((iter - (mi3 * 2)) / mi3)), 0xff};
-  }
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/msg.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/msg.rs
deleted file mode 100644
index 645eb98..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/msg.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.android.rs.imagejb)
-
-void sendMsg() {
-    rsSendToClientBlocking(0);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/shadows.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/shadows.rs
deleted file mode 100644
index f6c149d..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/shadows.rs
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static double shadowFilterMap[] = {
-    -0.00591,  0.0001,
-     1.16488,  0.01668,
-    -0.18027, -0.06791,
-    -0.12625,  0.09001,
-     0.15065, -0.03897
-};
-
-static double poly[] = {
-    0., 0.,
-    0., 0.,
-    0.
-};
-
-static const int ABITS = 4;
-static const int HSCALE = 256;
-static const int k1=255 << ABITS;
-static const int k2=HSCALE << ABITS;
-
-static double fastevalPoly(double *poly,int n, double x){
-
-    double f =x;
-    double sum = poly[0]+poly[1]*f;
-    int i;
-    for (i = 2; i < n; i++) {
-        f*=x;
-        sum += poly[i]*f;
-    }
-    return sum;
-}
-
-static ushort3 rgb2hsv( uchar4 rgb)
-{
-    int iMin,iMax,chroma;
-
-    int ri = rgb.r;
-    int gi = rgb.g;
-    int bi = rgb.b;
-    short rv,rs,rh;
-
-    if (ri > gi) {
-        iMax = max (ri, bi);
-        iMin = min (gi, bi);
-    } else {
-        iMax = max (gi, bi);
-        iMin = min (ri, bi);
-    }
-
-    chroma = iMax - iMin;
-    // set value
-    rv = (short)( iMax << ABITS);
-
-    // set saturation
-    if (rv == 0)
-        rs = 0;
-    else
-        rs = (short)((k1*chroma)/iMax);
-
-    // set hue
-    if (rs == 0)
-        rh = 0;
-    else {
-        if ( ri == iMax ) {
-            rh  = (short)( (k2*(6*chroma+gi - bi))/(6*chroma));
-            if (rh >= k2) rh -= k2;
-        } else if (gi  == iMax)
-            rh  = (short)( (k2*(2*chroma+bi - ri ))/(6*chroma));
-        else // (bi == iMax )
-                    rh  = (short)( (k2*(4*chroma+ri - gi ))/(6*chroma));
-    }
-
-    ushort3 out;
-    out.x = rv;
-    out.y = rs;
-    out.z = rh;
-    return out;
-}
-
-static uchar4 hsv2rgb(ushort3 hsv)
-{
-    int ABITS = 4;
-    int HSCALE = 256;
-    int m;
-    int H,X,ih,is,iv;
-    int k1=255<<ABITS;
-    int k2=HSCALE<<ABITS;
-    int k3=1<<(ABITS-1);
-    int rr=0;
-    int rg=0;
-    int rb=0;
-    short cv = hsv.x;
-    short cs = hsv.y;
-    short ch = hsv.z;
-
-    // set chroma and min component value m
-    //chroma = ( cv * cs )/k1;
-    //m = cv - chroma;
-    m = ((int)cv*(k1 - (int)cs ))/k1;
-
-    // chroma  == 0 <-> cs == 0 --> m=cv
-    if (cs == 0) {
-        rb = ( rg = ( rr =( cv >> ABITS) ));
-    } else {
-        ih=(int)ch;
-        is=(int)cs;
-        iv=(int)cv;
-
-        H = (6*ih)/k2;
-        X = ((iv*is)/k2)*(k2- abs(6*ih- 2*(H>>1)*k2 - k2)) ;
-
-        // removing additional bits --> unit8
-        X=( (X+iv*(k1 - is ))/k1 + k3 ) >> ABITS;
-        m=m >> ABITS;
-
-        // ( chroma + m ) --> cv ;
-        cv=(short) (cv >> ABITS);
-        switch (H) {
-        case 0:
-            rr = cv;
-            rg = X;
-            rb = m;
-            break;
-        case 1:
-            rr = X;
-            rg = cv;
-            rb = m;
-            break;
-        case 2:
-            rr = m;
-            rg = cv;
-            rb = X;
-            break;
-        case 3:
-            rr = m;
-            rg = X;
-            rb = cv;
-            break;
-        case 4:
-            rr = X;
-            rg = m;
-            rb = cv;
-            break;
-        case 5:
-            rr = cv;
-            rg = m ;
-            rb = X;
-            break;
-        }
-    }
-
-    uchar4 rgb;
-
-    rgb.r =  rr;
-    rgb.g =  rg;
-    rgb.b =  rb;
-
-    return rgb;
-}
-
-void prepareShadows(float scale) {
-    double s = (scale>=0)?scale:scale/5;
-    for (int i = 0; i < 5; i++) {
-        poly[i] = fastevalPoly(shadowFilterMap+i*2,2 , s);
-    }
-}
-
-void shadowsKernel(const uchar4 *in, uchar4 *out) {
-    ushort3 hsv = rgb2hsv(*in);
-    double v = (fastevalPoly(poly,5,hsv.x/4080.)*4080);
-    if (v>4080) v = 4080;
-    hsv.x = (unsigned short) ((v>0)?v:0);
-    *out = hsv2rgb(hsv);
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/threshold.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/threshold.fs
deleted file mode 100644
index 0b2c2e8..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/threshold.fs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#include "ip.rsh"
-
-
-int height;
-int width;
-static int radius;
-
-rs_allocation InPixel;
-rs_allocation ScratchPixel1;
-rs_allocation ScratchPixel2;
-
-const int MAX_RADIUS = 25;
-
-// Store our coefficients here
-static float gaussian[MAX_RADIUS * 2 + 1];
-
-void setRadius(int rad) {
-    radius = rad;
-    // Compute gaussian weights for the blur
-    // e is the euler's number
-    float e = 2.718281828459045f;
-    float pi = 3.1415926535897932f;
-    // g(x) = ( 1 / sqrt( 2 * pi ) * sigma) * e ^ ( -x^2 / 2 * sigma^2 )
-    // x is of the form [-radius .. 0 .. radius]
-    // and sigma varies with radius.
-    // Based on some experimental radius values and sigma's
-    // we approximately fit sigma = f(radius) as
-    // sigma = radius * 0.4  + 0.6
-    // The larger the radius gets, the more our gaussian blur
-    // will resemble a box blur since with large sigma
-    // the gaussian curve begins to lose its shape
-    float sigma = 0.4f * (float)radius + 0.6f;
-
-    // Now compute the coefficints
-    // We will store some redundant values to save some math during
-    // the blur calculations
-    // precompute some values
-    float coeff1 = 1.0f / (sqrt( 2.0f * pi ) * sigma);
-    float coeff2 = - 1.0f / (2.0f * sigma * sigma);
-
-    float normalizeFactor = 0.0f;
-    float floatR = 0.0f;
-    for (int r = -radius; r <= radius; r ++) {
-        floatR = (float)r;
-        gaussian[r + radius] = coeff1 * pow(e, floatR * floatR * coeff2);
-        normalizeFactor += gaussian[r + radius];
-    }
-
-    //Now we need to normalize the weights because all our coefficients need to add up to one
-    normalizeFactor = 1.0f / normalizeFactor;
-    for (int r = -radius; r <= radius; r ++) {
-        floatR = (float)r;
-        gaussian[r + radius] *= normalizeFactor;
-    }
-}
-
-float4 __attribute__((kernel)) copyIn(uchar4 in) {
-    return convert_float4(in);
-}
-
-uchar4 __attribute__((kernel)) vert(uint32_t x, uint32_t y) {
-    float3 blurredPixel = 0;
-    int gi = 0;
-    uchar4 out;
-    if ((y > radius) && (y < (height - radius))) {
-        for (int r = -radius; r <= radius; r ++) {
-            float4 i = rsGetElementAt_float4(ScratchPixel2, x, y + r);
-            blurredPixel += i.xyz * gaussian[gi++];
-        }
-    } else {
-        for (int r = -radius; r <= radius; r ++) {
-            int validH = rsClamp((int)y + r, (int)0, (int)(height - 1));
-            float4 i = rsGetElementAt_float4(ScratchPixel2, x, validH);
-            blurredPixel += i.xyz * gaussian[gi++];
-        }
-    }
-
-    out.xyz = convert_uchar3(clamp(blurredPixel, 0.f, 255.f));
-    out.w = 0xff;
-    return out;
-}
-
-float4 __attribute__((kernel)) horz(uint32_t x, uint32_t y) {
-    float4 blurredPixel = 0;
-    int gi = 0;
-    if ((x > radius) && (x < (width - radius))) {
-        for (int r = -radius; r <= radius; r ++) {
-            float4 i = rsGetElementAt_float4(ScratchPixel1, x + r, y);
-            blurredPixel += i * gaussian[gi++];
-        }
-    } else {
-        for (int r = -radius; r <= radius; r ++) {
-            // Stepping left and right away from the pixel
-            int validX = rsClamp((int)x + r, (int)0, (int)(width - 1));
-            float4 i = rsGetElementAt_float4(ScratchPixel1, validX, y);
-            blurredPixel += i * gaussian[gi++];
-        }
-    }
-
-    return blurredPixel;
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs
deleted file mode 100644
index 8db113c..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-float vibrance = 0.f;
-
-static const float Rf = 0.2999f;
-static const float Gf = 0.587f;
-static const float Bf = 0.114f;
-
-static float S  = 0.f;
-static float MS = 0.f;
-static float Rt = 0.f;
-static float Gt = 0.f;
-static float Bt = 0.f;
-static float Vib = 0.f;
-
-void vibranceKernel(const uchar4 *in, uchar4 *out) {
-
-    float R, G, B;
-
-    int r = in->r;
-    int g = in->g;
-    int b = in->b;
-    float red = (r-max(g, b))/256.f;
-    float sx = (float)(Vib/(1+exp(-red*3)));
-    S = sx+1;
-    MS = 1.0f - S;
-    Rt = Rf * MS;
-    Gt = Gf * MS;
-    Bt = Bf * MS;
-    int t = (r + g) / 2;
-    R = r;
-    G = g;
-    B = b;
-
-    float Rc = R * (Rt + S) + G * Gt + B * Bt;
-    float Gc = R * Rt + G * (Gt + S) + B * Bt;
-    float Bc = R * Rt + G * Gt + B * (Bt + S);
-
-    out->r = rsClamp(Rc, 0, 255);
-    out->g = rsClamp(Gc, 0, 255);
-    out->b = rsClamp(Bc, 0, 255);
-
-}
-
-void prepareVibrance() {
-
-    Vib = vibrance/100.f;
-    S  = Vib + 1;
-    MS = 1.0f - S;
-    Rt = Rf * MS;
-    Gt = Gf * MS;
-    Bt = Bf * MS;
-
-}
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette.rsh b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette.rsh
deleted file mode 100644
index 04ca1f1..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette.rsh
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-static float2 neg_center, axis_scale, inv_dimensions;
-static float sloped_neg_range, sloped_inv_max_dist, shade, opp_shade;
-
-void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
-        float desired_scale, float desired_shade, float desired_slope) {
-
-    neg_center.x = -center_x;
-    neg_center.y = -center_y;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float max_dist = 0.5f * length(axis_scale);
-    sloped_inv_max_dist = desired_slope * 1.f/max_dist;
-
-    // Range needs to be between 1.3 to 0.6. When scale is zero then range is
-    // 1.3 which means no vignette at all because the luminousity difference is
-    // less than 1/256.  Expect input scale to be between 0.0 and 1.0.
-    const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
-    sloped_neg_range = exp(neg_range * desired_slope);
-
-    shade = desired_shade;
-    opp_shade = 1.f - desired_shade;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float4 fin = convert_float4(in);
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float sloped_dist_ratio = length(axis_scale * coord)  * sloped_inv_max_dist;
-    const float lumen = opp_shade + shade / ( 1.0f + sloped_neg_range * exp(sloped_dist_ratio) );
-    float4 fout;
-    fout.rgb = fin.rgb * lumen;
-    fout.w = fin.w;
-    return convert_uchar4(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx.rsh b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx.rsh
deleted file mode 100644
index 0eacdc8..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx.rsh
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-static float2 neg_center, axis_scale, inv_dimensions;
-static float sloped_neg_range, sloped_inv_max_dist, shade, opp_shade;
-
-void init_vignette(uint32_t dim_x, uint32_t dim_y, float center_x, float center_y,
-        float desired_scale, float desired_shade, float desired_slope) {
-
-    neg_center.x = -center_x;
-    neg_center.y = -center_y;
-    inv_dimensions.x = 1.f / (float)dim_x;
-    inv_dimensions.y = 1.f / (float)dim_y;
-
-    axis_scale = (float2)1.f;
-    if (dim_x > dim_y)
-        axis_scale.y = (float)dim_y / (float)dim_x;
-    else
-        axis_scale.x = (float)dim_x / (float)dim_y;
-
-    const float max_dist = 0.5f * length(axis_scale);
-    sloped_inv_max_dist = desired_slope * 1.f/max_dist;
-
-    // Range needs to be between 1.3 to 0.6. When scale is zero then range is
-    // 1.3 which means no vignette at all because the luminousity difference is
-    // less than 1/256.  Expect input scale to be between 0.0 and 1.0.
-    const float neg_range = 0.7f*sqrt(desired_scale) - 1.3f;
-    sloped_neg_range = exp(neg_range * desired_slope);
-
-    shade = desired_shade;
-    opp_shade = 1.f - desired_shade;
-}
-
-uchar4 __attribute__((kernel)) root(uchar4 in, uint32_t x, uint32_t y) {
-    // Convert x and y to floating point coordinates with center as origin
-    const float4 fin = convert_float4(in);
-    const float2 inCoord = {(float)x, (float)y};
-    const float2 coord = mad(inCoord, inv_dimensions, neg_center);
-    const float sloped_dist_ratio = fast_length(axis_scale * coord)  * sloped_inv_max_dist;
-    const float lumen = opp_shade + shade * half_recip(1.f + sloped_neg_range * exp(sloped_dist_ratio));
-    float4 fout;
-    fout.rgb = fin.rgb * lumen;
-    fout.w = fin.w;
-    return convert_uchar4(fout);
-}
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx_full.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx_full.rs
deleted file mode 100644
index 00cbbc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx_relaxed.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx_relaxed.fs
deleted file mode 100644
index 00cbbc4..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_approx_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette_approx.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_full.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_full.rs
deleted file mode 100644
index 8202c5c..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_full.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_relaxed.fs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_relaxed.fs
deleted file mode 100644
index 8202c5c..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/vignette_relaxed.fs
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-
-#include "vignette.rsh"
-
diff --git a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/wbalance.rs b/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/wbalance.rs
deleted file mode 100644
index 6650671..0000000
--- a/tests/RenderScriptTests/ImageProcessing_jb/src/com/android/rs/image/wbalance.rs
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "ip.rsh"
-//#pragma rs_fp_relaxed
-
-static int histR[256] = {0}, histG[256] = {0}, histB[256] = {0};
-
-rs_allocation histogramSource;
-uint32_t histogramHeight;
-uint32_t histogramWidth;
-
-static float scaleR;
-static float scaleG;
-static float scaleB;
-
-static uchar4 estimateWhite() {
-
-    for (int i = 0; i < 256; i++) {
-        histR[i] = 0; histG[i] = 0; histB[i] = 0;
-    }
-
-    for (uint32_t i = 0; i < histogramHeight; i++) {
-        for (uint32_t j = 0; j < histogramWidth; j++) {
-            uchar4 in = rsGetElementAt_uchar4(histogramSource, j, i);
-            histR[in.r]++;
-            histG[in.g]++;
-            histB[in.b]++;
-        }
-    }
-
-    int min_r = -1, min_g = -1, min_b = -1;
-    int max_r =  0, max_g =  0, max_b =  0;
-    int sum_r =  0, sum_g =  0, sum_b =  0;
-
-    for (int i = 1; i < 255; i++) {
-        int r = histR[i];
-        int g = histG[i];
-        int b = histB[i];
-        sum_r += r;
-        sum_g += g;
-        sum_b += b;
-
-        if (r>0){
-            if (min_r < 0) min_r = i;
-            max_r = i;
-        }
-        if (g>0){
-            if (min_g < 0) min_g = i;
-            max_g = i;
-        }
-        if (b>0){
-            if (min_b < 0) min_b = i;
-            max_b = i;
-        }
-    }
-
-    int sum15r = 0, sum15g = 0, sum15b = 0;
-    int count15r = 0, count15g = 0, count15b = 0;
-    int tmp_r = 0, tmp_g = 0, tmp_b = 0;
-
-    for (int i = 254; i >0; i--) {
-        int r = histR[i];
-        int g = histG[i];
-        int b = histB[i];
-        tmp_r += r;
-        tmp_g += g;
-        tmp_b += b;
-
-        if ((tmp_r > sum_r/20) && (tmp_r < sum_r/5)) {
-            sum15r += r*i;
-            count15r += r;
-        }
-        if ((tmp_g > sum_g/20) && (tmp_g < sum_g/5)) {
-            sum15g += g*i;
-            count15g += g;
-        }
-        if ((tmp_b > sum_b/20) && (tmp_b < sum_b/5)) {
-            sum15b += b*i;
-            count15b += b;
-        }
-
-    }
-
-    uchar4 out;
-
-    if ((count15r>0) && (count15g>0) && (count15b>0) ){
-        out.r = sum15r/count15r;
-        out.g = sum15g/count15g;
-        out.b = sum15b/count15b;
-    }else {
-        out.r = out.g = out.b = 255;
-    }
-
-    return out;
-
-}
-
-void prepareWhiteBalance() {
-    uchar4 estimation = estimateWhite();
-    int minimum = min(estimation.r, min(estimation.g, estimation.b));
-    int maximum = max(estimation.r, max(estimation.g, estimation.b));
-    float avg = (minimum + maximum) / 2.f;
-
-    scaleR =  avg/estimation.r;
-    scaleG =  avg/estimation.g;
-    scaleB =  avg/estimation.b;
-
-}
-
-static unsigned char contrastClamp(int c)
-{
-    int N = 255;
-    c &= ~(c >> 31);
-    c -= N;
-    c &= (c >> 31);
-    c += N;
-    return  (unsigned char) c;
-}
-
-void whiteBalanceKernel(const uchar4 *in, uchar4 *out) {
-    float Rc =  in->r*scaleR;
-    float Gc =  in->g*scaleG;
-    float Bc =  in->b*scaleB;
-
-    out->r = contrastClamp(Rc);
-    out->g = contrastClamp(Gc);
-    out->b = contrastClamp(Bc);
-}
diff --git a/tests/RenderScriptTests/LatencyBenchmark/Android.mk b/tests/RenderScriptTests/LatencyBenchmark/Android.mk
deleted file mode 100644
index ef2164d..0000000
--- a/tests/RenderScriptTests/LatencyBenchmark/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RsLatencyBenchmark
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/LatencyBenchmark/AndroidManifest.xml b/tests/RenderScriptTests/LatencyBenchmark/AndroidManifest.xml
deleted file mode 100644
index 923bb88..0000000
--- a/tests/RenderScriptTests/LatencyBenchmark/AndroidManifest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.example.android.rs.latencybench">
-
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-sdk android:minSdkVersion="17" />
-    <application android:label="_RS_Latency_Bench">
-        <activity android:name="LatencyBench">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/LatencyBenchmark/res/layout/main.xml b/tests/RenderScriptTests/LatencyBenchmark/res/layout/main.xml
deleted file mode 100644
index 9e9dab8..0000000
--- a/tests/RenderScriptTests/LatencyBenchmark/res/layout/main.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-    <ImageView
-        android:id="@+id/displayin"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-    <ImageView
-        android:id="@+id/displayout"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-</LinearLayout>
diff --git a/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/Benchmark.java b/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/Benchmark.java
deleted file mode 100644
index ee14fb9..0000000
--- a/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/Benchmark.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2012 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.example.android.rs.latencybench;
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class Benchmark implements Runnable {
-    private final RenderScript mRS;
-    private ScriptC_compute_benchmark mScript;
-    private Allocation ain;
-    private Allocation aout;
-
-    public Benchmark(RenderScript rs, Resources res) {
-        mRS = rs;
-        mScript = new ScriptC_compute_benchmark(mRS, res, R.raw.compute_benchmark);
-        ain = Allocation.createSized(rs, Element.U32(mRS), 10000);
-        aout = Allocation.createSized(rs, Element.U32(mRS), 10000);
-    }
-
-    public void run() {
-        int[] temp;
-        temp = new int[1];
-
-        long t = java.lang.System.currentTimeMillis();
-
-        for (int i = 0; i < 1000000; i++)
-            mScript.forEach_root(ain, aout);
-        aout.copy1DRangeFrom(0, 1, temp);
-
-        t = java.lang.System.currentTimeMillis() - t;
-        android.util.Log.v("LatencyBench", "Iterated Java forEach took " + t + " ms");
-
-        mScript.set_empty_kern(mScript);
-        mScript.set_in(ain);
-        mScript.set_out(aout);
-
-        t = java.lang.System.currentTimeMillis();
-        mScript.invoke_emptyKernelLauncher();
-        aout.copy1DRangeFrom(0, 1, temp);
-
-        t = java.lang.System.currentTimeMillis() - t;
-        android.util.Log.v("LatencyBench", "Invoked forEach took " + t + " ms");
-
-
-
-    }
-
-}
diff --git a/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/LatencyBench.java b/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/LatencyBench.java
deleted file mode 100644
index fdce9a7..0000000
--- a/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/LatencyBench.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 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.example.android.rs.latencybench;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.renderscript.RenderScript;
-
-public class LatencyBench extends Activity {
-    private RenderScript mRS;
-    private Benchmark mBenchmark;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        mRS = RenderScript.create(this);
-
-        mBenchmark = new Benchmark(mRS, getResources());
-        mBenchmark.run();
-    }
-}
diff --git a/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs b/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
deleted file mode 100644
index c6d1ea9..0000000
--- a/tests/RenderScriptTests/LatencyBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2012 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.
-
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.latencybench)
-
-rs_script empty_kern;
-rs_allocation in, out;
-int iters = 1000000;
-
-void root(const uint32_t *ain, uint32_t *aout) {
-
-}
-
-void emptyKernelLauncher() {
-    for (int i = 0; i < iters; i++)
-        rsForEach(empty_kern, in, out);
-}
diff --git a/tests/RenderScriptTests/LivePreview/Android.mk b/tests/RenderScriptTests/LivePreview/Android.mk
deleted file mode 100644
index 1b45573..0000000
--- a/tests/RenderScriptTests/LivePreview/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := PreviewRS
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/LivePreview/AndroidManifest.xml b/tests/RenderScriptTests/LivePreview/AndroidManifest.xml
deleted file mode 100644
index 1b91464..0000000
--- a/tests/RenderScriptTests/LivePreview/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2012 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.rs.livepreview">
-    <uses-sdk android:minSdkVersion="14" />
-    <uses-permission android:name="android.permission.CAMERA" />
-    <application android:label="Preview FS"
-                 android:hardwareAccelerated="true">
-
-        <activity android:name="CameraPreviewActivity"
-                  android:label="Preview FS"
-                  android:screenOrientation="landscape">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/LivePreview/res/drawable-nodpi/city.png b/tests/RenderScriptTests/LivePreview/res/drawable-nodpi/city.png
deleted file mode 100644
index 856eeff..0000000
--- a/tests/RenderScriptTests/LivePreview/res/drawable-nodpi/city.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/LivePreview/res/layout/cf_format_list_item.xml b/tests/RenderScriptTests/LivePreview/res/layout/cf_format_list_item.xml
deleted file mode 100644
index 8196bbf..0000000
--- a/tests/RenderScriptTests/LivePreview/res/layout/cf_format_list_item.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2012 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.
--->
-
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:padding="10dp"
-    android:textSize="16sp"
-/>
diff --git a/tests/RenderScriptTests/LivePreview/res/layout/cf_main.xml b/tests/RenderScriptTests/LivePreview/res/layout/cf_main.xml
deleted file mode 100644
index ecb736b..0000000
--- a/tests/RenderScriptTests/LivePreview/res/layout/cf_main.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2012 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="fill_parent"
-    android:layout_height="fill_parent">
-
-    <LinearLayout
-        android:orientation="horizontal"
-        android:layout_width="fill_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1" >
-
-        <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="0dp"
-            android:layout_height="fill_parent"
-            android:layout_weight="3" >
-
-            <TextureView
-                android:id="@+id/preview_view"
-                android:layout_height="0dp"
-                android:layout_width="fill_parent"
-                android:layout_weight="3" />
-            <TextView
-                android:id="@+id/preview_label"
-                android:layout_height="wrap_content"
-                android:layout_width="fill_parent"
-                android:text="@string/cf_preview_label"
-                android:padding="2dp"
-                android:textSize="16sp"
-                android:gravity="center" />
-
-        </LinearLayout>
-        <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="0dp"
-            android:layout_height="fill_parent"
-            android:layout_weight="3" >
-
-            <TextureView
-                android:id="@+id/format_view"
-                android:layout_height="0dp"
-                android:layout_width="fill_parent"
-                android:layout_weight="3" />
-            <TextView
-                android:id="@+id/format_label"
-                android:layout_height="wrap_content"
-                android:layout_width="fill_parent"
-                android:text="@string/cf_format_label"
-                android:padding="2dp"
-                android:textSize="16sp"
-                android:gravity="center" />
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:orientation="vertical"
-            android:layout_width="0dp"
-            android:layout_height="fill_parent"
-            android:layout_weight="2" >
-
-            <Spinner
-                android:id="@+id/cameras_selection"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <Spinner
-                android:id="@+id/resolution_selection"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-            <Spinner
-                android:id="@+id/format_selection"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"/>
-
-        </LinearLayout>
-
-    </LinearLayout>
-
-
-</LinearLayout>
diff --git a/tests/RenderScriptTests/LivePreview/res/layout/main.xml b/tests/RenderScriptTests/LivePreview/res/layout/main.xml
deleted file mode 100644
index a6a075c..0000000
--- a/tests/RenderScriptTests/LivePreview/res/layout/main.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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="fill_parent"
-            android:layout_height="fill_parent"
-            android:id="@+id/toplevel">
-    <SurfaceView
-        android:id="@+id/surface"
-        android:layout_width="1dip"
-        android:layout_height="1dip" />
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-            <ImageView
-                android:id="@+id/display"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content">
-                    <Button
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/benchmark"
-                        android:onClick="benchmark"/>
-                    <TextView
-                        android:id="@+id/benchmarkText"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/saturation"/>
-            </LinearLayout>
-            <TextView
-                android:id="@+id/inSaturationText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/saturation"/>
-             <SeekBar
-                android:id="@+id/inSaturation"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/outWhiteText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:textSize="8pt"
-                android:text="@string/out_white"/>
-            <SeekBar
-                android:id="@+id/outWhite"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/inWhiteText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/inWhite"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/outBlackText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/out_black"/>
-            <SeekBar
-                android:id="@+id/outBlack"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/inBlackText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_black"/>
-            <SeekBar
-                android:id="@+id/inBlack"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/inGammaText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/gamma"/>
-            <SeekBar
-                android:id="@+id/inGamma"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            </LinearLayout>
-    </ScrollView>
-</LinearLayout>
-
diff --git a/tests/RenderScriptTests/LivePreview/res/layout/rs.xml b/tests/RenderScriptTests/LivePreview/res/layout/rs.xml
deleted file mode 100644
index 6fde1b9..0000000
--- a/tests/RenderScriptTests/LivePreview/res/layout/rs.xml
+++ /dev/null
@@ -1,140 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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="fill_parent"
-            android:layout_height="fill_parent"
-            android:id="@+id/toplevel">
-    <SurfaceView
-        android:id="@+id/surface"
-        android:layout_width="1dip"
-        android:layout_height="1dip" />
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-            <TextureView
-                android:id="@+id/display"
-                android:layout_width="800sp"
-                android:layout_height="423sp" />
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content">
-                    <Button
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/benchmark"
-                        android:onClick="benchmark"/>
-                    <TextView
-                        android:id="@+id/benchmarkText"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/saturation"/>
-            </LinearLayout>
-            <TextView
-                android:id="@+id/inSaturationText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/saturation"/>
-             <SeekBar
-                android:id="@+id/inSaturation"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/outWhiteText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:textSize="8pt"
-                android:text="@string/out_white"/>
-            <SeekBar
-                android:id="@+id/outWhite"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/inWhiteText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_white"/>
-            <SeekBar
-                android:id="@+id/inWhite"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/outBlackText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/out_black"/>
-            <SeekBar
-                android:id="@+id/outBlack"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/inBlackText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/in_black"/>
-            <SeekBar
-                android:id="@+id/inBlack"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            <TextView
-                android:id="@+id/inGammaText"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:textSize="8pt"
-                android:layout_marginLeft="10sp"
-                android:layout_marginTop="15sp"
-                android:text="@string/gamma"/>
-            <SeekBar
-                android:id="@+id/inGamma"
-                android:layout_marginLeft="10sp"
-                android:layout_marginRight="10sp"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"/>
-            </LinearLayout>
-    </ScrollView>
-</LinearLayout>
-
diff --git a/tests/RenderScriptTests/LivePreview/res/values/strings.xml b/tests/RenderScriptTests/LivePreview/res/values/strings.xml
deleted file mode 100644
index d651bfb..0000000
--- a/tests/RenderScriptTests/LivePreview/res/values/strings.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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="in_white">In White</string>
-    <string name="out_white">Out White</string>
-    <string name="in_black">In Black</string>
-    <string name="out_black">Out Black</string>
-    <string name="gamma">Gamma</string>
-    <string name="saturation">Saturation</string>
-    <string name="benchmark">Benchmark</string>
-
-    <string name="app_name">CTS Verifier</string>
-    <string name="welcome_text">Welcome to the CTS Verifier!</string>
-    <string name="version_text">%1$s</string>
-    <string name="continue_button_text">Continue</string>
-
-    <string name="cf_preview_label">Normal preview</string>
-    <string name="cf_format_label">Processed callback data</string>
-    <string name="camera_format">Camera Formats</string>
-
-
-</resources>
diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java
deleted file mode 100644
index 62dcaa8..0000000
--- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/CameraPreviewActivity.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.livepreview;
-
-//import com.android.cts.verifier.PassFailButtons;
-//import com.android.cts.verifier.R;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.graphics.Bitmap;
-import android.graphics.Color;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.graphics.ImageFormat;
-import android.graphics.Matrix;
-import android.graphics.SurfaceTexture;
-import android.hardware.Camera;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.Handler;
-import android.util.Log;
-import android.util.SparseArray;
-import android.view.View;
-import android.view.TextureView;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.Spinner;
-
-import java.io.IOException;
-import java.lang.InterruptedException;
-import java.lang.Math;
-import java.lang.Thread;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.TreeSet;
-
-import android.renderscript.*;
-
-/**
- * Tests for manual verification of the CDD-required camera output formats
- * for preview callbacks
- */
-public class CameraPreviewActivity extends Activity
-        implements TextureView.SurfaceTextureListener, Camera.PreviewCallback {
-
-    private static final String TAG = "CameraFormats";
-
-    private TextureView mPreviewView;
-    private SurfaceTexture mPreviewTexture;
-    private int mPreviewTexWidth;
-    private int mPreviewTexHeight;
-
-    //private TextureView mFormatView;
-
-    private Spinner mCameraSpinner;
-    private Spinner mResolutionSpinner;
-
-    private int mCurrentCameraId = -1;
-    private Camera mCamera;
-
-    private List<Camera.Size> mPreviewSizes;
-    private Camera.Size mNextPreviewSize;
-    private Camera.Size mPreviewSize;
-
-    private TextureView mOutputView;
-    //private Bitmap mCallbackBitmap;
-
-    private static final int STATE_OFF = 0;
-    private static final int STATE_PREVIEW = 1;
-    private static final int STATE_NO_CALLBACKS = 2;
-    private int mState = STATE_OFF;
-    private boolean mProcessInProgress = false;
-    private boolean mProcessingFirstFrame = false;
-
-
-    private RenderScript mRS;
-    private RsYuv mFilterYuv;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.cf_main);
-
-        mPreviewView = (TextureView) findViewById(R.id.preview_view);
-        mOutputView = (TextureView) findViewById(R.id.format_view);
-
-        mPreviewView.setSurfaceTextureListener(this);
-
-        int numCameras = Camera.getNumberOfCameras();
-        String[] cameraNames = new String[numCameras];
-        for (int i = 0; i < numCameras; i++) {
-            cameraNames[i] = "Camera " + i;
-        }
-        mCameraSpinner = (Spinner) findViewById(R.id.cameras_selection);
-        mCameraSpinner.setAdapter(
-            new ArrayAdapter<String>(
-                this, R.layout.cf_format_list_item, cameraNames));
-        mCameraSpinner.setOnItemSelectedListener(mCameraSpinnerListener);
-
-        mResolutionSpinner = (Spinner) findViewById(R.id.resolution_selection);
-        mResolutionSpinner.setOnItemSelectedListener(mResolutionSelectedListener);
-
-        mRS = RenderScript.create(this);
-        mFilterYuv = new RsYuv(mRS);
-        mOutputView.setSurfaceTextureListener(mFilterYuv);
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-
-        setUpCamera(mCameraSpinner.getSelectedItemPosition());
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-
-        shutdownCamera();
-    }
-
-    public void onSurfaceTextureAvailable(SurfaceTexture surface,
-            int width, int height) {
-        mPreviewTexture = surface;
-        mPreviewTexWidth = width;
-        mPreviewTexHeight = height;
-        if (mCamera != null) {
-            startPreview();
-        }
-    }
-
-    public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
-        // Ignored, Camera does all the work for us
-    }
-
-    public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
-        return true;
-    }
-
-    public void onSurfaceTextureUpdated(SurfaceTexture surface) {
-        // Invoked every time there's a new Camera preview frame
-    }
-
-    private AdapterView.OnItemSelectedListener mCameraSpinnerListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent,
-                        View view, int pos, long id) {
-                    if (mCurrentCameraId != pos) {
-                        setUpCamera(pos);
-                    }
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-
-            };
-
-    private AdapterView.OnItemSelectedListener mResolutionSelectedListener =
-            new AdapterView.OnItemSelectedListener() {
-                public void onItemSelected(AdapterView<?> parent,
-                        View view, int position, long id) {
-                    if (mPreviewSizes.get(position) != mPreviewSize) {
-                        mNextPreviewSize = mPreviewSizes.get(position);
-                        startPreview();
-                    }
-                }
-
-                public void onNothingSelected(AdapterView parent) {
-
-                }
-
-            };
-
-
-    private void setUpCamera(int id) {
-        shutdownCamera();
-
-        mCurrentCameraId = id;
-        mCamera = Camera.open(id);
-        Camera.Parameters p = mCamera.getParameters();
-
-        // Get preview resolutions
-
-        List<Camera.Size> unsortedSizes = p.getSupportedPreviewSizes();
-
-        class SizeCompare implements Comparator<Camera.Size> {
-            public int compare(Camera.Size lhs, Camera.Size rhs) {
-                if (lhs.width < rhs.width) return -1;
-                if (lhs.width > rhs.width) return 1;
-                if (lhs.height < rhs.height) return -1;
-                if (lhs.height > rhs.height) return 1;
-                return 0;
-            }
-        };
-
-        SizeCompare s = new SizeCompare();
-        TreeSet<Camera.Size> sortedResolutions = new TreeSet<Camera.Size>(s);
-        sortedResolutions.addAll(unsortedSizes);
-
-        mPreviewSizes = new ArrayList<Camera.Size>(sortedResolutions);
-
-        String[] availableSizeNames = new String[mPreviewSizes.size()];
-        for (int i = 0; i < mPreviewSizes.size(); i++) {
-            availableSizeNames[i] =
-                    Integer.toString(mPreviewSizes.get(i).width) + " x " +
-                    Integer.toString(mPreviewSizes.get(i).height);
-        }
-        mResolutionSpinner.setAdapter(
-            new ArrayAdapter<String>(
-                this, R.layout.cf_format_list_item, availableSizeNames));
-
-
-        // Set initial values
-
-        mNextPreviewSize = mPreviewSizes.get(15);
-        mResolutionSpinner.setSelection(15);
-
-        if (mPreviewTexture != null) {
-            startPreview();
-        }
-    }
-
-    private void shutdownCamera() {
-        if (mCamera != null) {
-            mCamera.setPreviewCallbackWithBuffer(null);
-            mCamera.stopPreview();
-            mCamera.release();
-            mCamera = null;
-            mState = STATE_OFF;
-        }
-    }
-
-    private void startPreview() {
-        if (mState != STATE_OFF) {
-            // Stop for a while to drain callbacks
-            mCamera.setPreviewCallbackWithBuffer(null);
-            mCamera.stopPreview();
-            mState = STATE_OFF;
-            Handler h = new Handler();
-            Runnable mDelayedPreview = new Runnable() {
-                public void run() {
-                    startPreview();
-                }
-            };
-            h.postDelayed(mDelayedPreview, 300);
-            return;
-        }
-        mState = STATE_PREVIEW;
-
-        Matrix transform = new Matrix();
-        float widthRatio = mNextPreviewSize.width / (float)mPreviewTexWidth;
-        float heightRatio = mNextPreviewSize.height / (float)mPreviewTexHeight;
-
-        transform.setScale(1, heightRatio/widthRatio);
-        transform.postTranslate(0,
-                mPreviewTexHeight * (1 - heightRatio/widthRatio)/2);
-
-        mPreviewView.setTransform(transform);
-        mOutputView.setTransform(transform);
-
-        mPreviewSize   = mNextPreviewSize;
-
-        Camera.Parameters p = mCamera.getParameters();
-        p.setPreviewFormat(ImageFormat.NV21);
-        p.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
-        mCamera.setParameters(p);
-
-        mCamera.setPreviewCallbackWithBuffer(this);
-        int expectedBytes = mPreviewSize.width * mPreviewSize.height *
-                ImageFormat.getBitsPerPixel(ImageFormat.NV21) / 8;
-        for (int i=0; i < 4; i++) {
-            mCamera.addCallbackBuffer(new byte[expectedBytes]);
-        }
-        //mFormatView.setColorFilter(mYuv2RgbFilter);
-
-        mProcessingFirstFrame = true;
-        try {
-            mCamera.setPreviewTexture(mPreviewTexture);
-            mCamera.startPreview();
-        } catch (IOException ioe) {
-            // Something bad happened
-            Log.e(TAG, "Unable to start up preview");
-        }
-
-    }
-
-
-    private class ProcessPreviewDataTask extends AsyncTask<byte[], Void, Boolean> {
-        protected Boolean doInBackground(byte[]... datas) {
-            byte[] data = datas[0];
-
-            long t1 = java.lang.System.currentTimeMillis();
-
-            mFilterYuv.execute(data);
-
-            long t2 = java.lang.System.currentTimeMillis();
-            mTiming[mTimingSlot++] = t2 - t1;
-            if (mTimingSlot >= mTiming.length) {
-                float total = 0;
-                for (int i=0; i<mTiming.length; i++) {
-                    total += (float)mTiming[i];
-                }
-                total /= mTiming.length;
-                Log.e(TAG, "time + " + total);
-                mTimingSlot = 0;
-            }
-
-            mCamera.addCallbackBuffer(data);
-            mProcessInProgress = false;
-            return true;
-        }
-
-        protected void onPostExecute(Boolean result) {
-            mOutputView.invalidate();
-        }
-
-    }
-
-    private long mTiming[] = new long[50];
-    private int mTimingSlot = 0;
-
-    public void onPreviewFrame(byte[] data, Camera camera) {
-        if (mProcessInProgress || mState != STATE_PREVIEW) {
-            mCamera.addCallbackBuffer(data);
-            return;
-        }
-        if (data == null) {
-            return;
-        }
-
-        int expectedBytes = mPreviewSize.width * mPreviewSize.height *
-                ImageFormat.getBitsPerPixel(ImageFormat.NV21) / 8;
-
-        if (expectedBytes != data.length) {
-            Log.e(TAG, "Mismatched size of buffer! Expected ");
-
-            mState = STATE_NO_CALLBACKS;
-            mCamera.setPreviewCallbackWithBuffer(null);
-            return;
-        }
-
-        mProcessInProgress = true;
-
-        if ((mFilterYuv == null) ||
-            (mPreviewSize.width != mFilterYuv.getWidth()) ||
-            (mPreviewSize.height != mFilterYuv.getHeight()) ) {
-
-            mFilterYuv.reset(mPreviewSize.width, mPreviewSize.height);
-        }
-
-        mProcessInProgress = true;
-        new ProcessPreviewDataTask().execute(data);
-    }
-
-
-
-}
\ No newline at end of file
diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
deleted file mode 100644
index 12d3185..0000000
--- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/RsYuv.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.livepreview;
-
-import android.app.Activity;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.os.Bundle;
-import android.graphics.SurfaceTexture;
-import android.renderscript.Allocation;
-import android.renderscript.Matrix3f;
-import android.renderscript.RenderScript;
-import android.util.Log;
-import android.view.TextureView;
-import android.view.View;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-
-import android.graphics.Bitmap;
-
-public class RsYuv implements TextureView.SurfaceTextureListener
-{
-    private int mHeight;
-    private int mWidth;
-    private RenderScript mRS;
-    private Allocation mAllocationOut;
-    private Allocation mAllocationIn;
-    private ScriptC_yuv mScript;
-    private ScriptIntrinsicYuvToRGB mYuv;
-    private boolean mHaveSurface;
-    private SurfaceTexture mSurface;
-    private ScriptGroup mGroup;
-
-    RsYuv(RenderScript rs) {
-        mRS = rs;
-        mScript = new ScriptC_yuv(mRS);
-        mYuv = ScriptIntrinsicYuvToRGB.create(rs, Element.RGBA_8888(mRS));
-    }
-
-    void setupSurface() {
-        if (mAllocationOut != null) {
-            mAllocationOut.setSurfaceTexture(mSurface);
-        }
-        if (mSurface != null) {
-            mHaveSurface = true;
-        } else {
-            mHaveSurface = false;
-        }
-    }
-
-    void reset(int width, int height) {
-        if (mAllocationOut != null) {
-            mAllocationOut.destroy();
-        }
-
-        android.util.Log.v("cpa", "reset " + width + ", " + height);
-        mHeight = height;
-        mWidth = width;
-        mScript.invoke_setSize(mWidth, mHeight);
-
-        Type.Builder tb = new Type.Builder(mRS, Element.RGBA_8888(mRS));
-        tb.setX(mWidth);
-        tb.setY(mHeight);
-        Type t = tb.create();
-        mAllocationOut = Allocation.createTyped(mRS, t, Allocation.USAGE_SCRIPT |
-                                                        Allocation.USAGE_IO_OUTPUT);
-
-
-        tb = new Type.Builder(mRS, Element.createPixel(mRS, Element.DataType.UNSIGNED_8, Element.DataKind.PIXEL_YUV));
-        tb.setX(mWidth);
-        tb.setY(mHeight);
-        tb.setYuvFormat(android.graphics.ImageFormat.NV21);
-        mAllocationIn = Allocation.createTyped(mRS, tb.create(), Allocation.USAGE_SCRIPT);
-        mYuv.setInput(mAllocationIn);
-        setupSurface();
-
-
-        ScriptGroup.Builder b = new ScriptGroup.Builder(mRS);
-        b.addKernel(mScript.getKernelID_root());
-        b.addKernel(mYuv.getKernelID());
-        b.addConnection(t, mYuv.getKernelID(), mScript.getKernelID_root());
-        mGroup = b.create();
-    }
-
-    public int getWidth() {
-        return mWidth;
-    }
-    public int getHeight() {
-        return mHeight;
-    }
-
-    private long mTiming[] = new long[50];
-    private int mTimingSlot = 0;
-
-    void execute(byte[] yuv) {
-        mAllocationIn.copyFrom(yuv);
-        if (mHaveSurface) {
-            mGroup.setOutput(mScript.getKernelID_root(), mAllocationOut);
-            mGroup.execute();
-
-            //mYuv.forEach(mAllocationOut);
-            //mScript.forEach_root(mAllocationOut, mAllocationOut);
-            mAllocationOut.ioSendOutput();
-        }
-    }
-
-
-
-    @Override
-    public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
-        android.util.Log.v("cpa", "onSurfaceTextureAvailable " + surface);
-        mSurface = surface;
-        setupSurface();
-    }
-
-    @Override
-    public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
-        android.util.Log.v("cpa", "onSurfaceTextureSizeChanged " + surface);
-        mSurface = surface;
-        setupSurface();
-    }
-
-    @Override
-    public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
-        android.util.Log.v("cpa", "onSurfaceTextureDestroyed " + surface);
-        mSurface = surface;
-        setupSurface();
-        return true;
-    }
-
-    @Override
-    public void onSurfaceTextureUpdated(SurfaceTexture surface) {
-    }
-}
-
diff --git a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs b/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs
deleted file mode 100644
index c4f698f..0000000
--- a/tests/RenderScriptTests/LivePreview/src/com/android/rs/livepreview/yuv.rs
+++ /dev/null
@@ -1,126 +0,0 @@
-
-#pragma version(1)
-#pragma rs java_package_name(com.android.rs.livepreview)
-//#pragma rs_fp_relaxed
-
-static int gWidth;
-static int gHeight;
-static uchar crossProcess_tableR[256];
-static uchar crossProcess_tableG[256];
-static uchar crossProcess_tableB[256];
-static uchar vignette_table[512];
-
-
-static float4 crossProcess(float4 color) {
-    float4 ncolor = 0.f;
-    float v;
-
-    if (color.r < 0.5f) {
-        v = color.r;
-        ncolor.r = 4.0f * v * v * v;
-    } else {
-        v = 1.0f - color.r;
-        ncolor.r = 1.0f - (4.0f * v * v * v);
-    }
-
-    if (color.g < 0.5f) {
-        v = color.g;
-        ncolor.g = 2.0f * v * v;
-    } else {
-        v = 1.0f - color.g;
-        ncolor.g = 1.0f - (2.0f * v * v);
-    }
-
-    ncolor.b = color.b * 0.5f + 0.25f;
-    ncolor.a = color.a;
-    return ncolor;
-}
-
-static uchar4 crossProcess_i(uchar4 color) {
-    uchar4 ncolor = color;
-    ncolor.r = crossProcess_tableR[color.r];
-    ncolor.g = crossProcess_tableG[color.g];
-    ncolor.b = crossProcess_tableB[color.b];
-    return ncolor;
-}
-
-
-float temp = 0.2f;
-static float4 colortemp(float4 color) {
-    float4 new_color = color;
-    float4 t = color * ((float4)1.0f - color) * temp;
-
-    new_color.r = color.r + t.r;
-    new_color.b = color.b - t.b;
-    if (temp > 0.0f) {
-        color.g = color.g + t.g * 0.25f;
-    }
-    float max_value = max(new_color.r, max(new_color.g, new_color.b));
-    if (max_value > 1.0f) {
-        new_color /= max_value;
-    }
-
-    return new_color;
-}
-
-
-static float vignette_dist_mod;
-int2 vignette_half_dims;
-static uchar4 vignette(uchar4 color, uint32_t x, uint32_t y) {
-    int2 xy = {x, y};
-    xy -= vignette_half_dims;
-    xy *= xy;
-
-    float d = vignette_dist_mod * (xy.x + xy.y);
-    ushort4 c = convert_ushort4(color);
-    c *= vignette_table[(int)d];
-    c >>= (ushort4)8;
-    return convert_uchar4(c);
-}
-
-void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y) {
-    uchar4 p;
-    p = crossProcess_i(*in);
-    p = vignette(p, x, y);
-
-    out->rgba = p;
-    out->a = 0xff;
-}
-
-float vignetteScale = 0.5f;
-float vignetteShade = 0.85f;
-
-static void precompute() {
-    for(int i=0; i <256; i++) {
-        float4 f = ((float)i) / 255.f;
-        float4 res = crossProcess(f);
-        res = colortemp(res);
-        crossProcess_tableR[i] = (uchar)(res.r * 255.f);
-        crossProcess_tableG[i] = (uchar)(res.g * 255.f);
-        crossProcess_tableB[i] = (uchar)(res.b * 255.f);
-    }
-
-    for(int i=0; i <512; i++) {
-        const float slope = 20.0f;
-        float f = ((float)i) / 511.f;
-
-        float range = 1.30f - sqrt(vignetteScale) * 0.7f;
-        float lumen = vignetteShade / (1.0f + exp((sqrt(f) - range) * slope)) + (1.0f - vignetteShade);
-        lumen = clamp(lumen, 0.f, 1.f);
-
-        vignette_table[i] = (uchar)(lumen * 255.f + 0.5f);
-    }
-}
-
-void init() {
-    precompute();
-}
-
-void setSize(int w, int h) {
-    gWidth = w;
-    gHeight = h;
-    vignette_half_dims = (int2){w / 2, h / 2};
-    vignette_dist_mod = 512.f;
-    vignette_dist_mod /= (float)(w*w + h*h) / 4.f;
-
-}
diff --git a/tests/RenderScriptTests/MathErr/Android.mk b/tests/RenderScriptTests/MathErr/Android.mk
deleted file mode 100644
index b3edd02..0000000
--- a/tests/RenderScriptTests/MathErr/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2013 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-                   $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RsMathErr
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/MathErr/AndroidManifest.xml b/tests/RenderScriptTests/MathErr/AndroidManifest.xml
deleted file mode 100644
index 6a3db2c..0000000
--- a/tests/RenderScriptTests/MathErr/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.example.android.rs.matherr">
-
-    <uses-sdk android:minSdkVersion="17" />
-    <application android:label="RS Math Err">
-        <activity android:name="MathErrActivity">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/MathErr/res/layout/main.xml b/tests/RenderScriptTests/MathErr/res/layout/main.xml
deleted file mode 100644
index 7b2c76a..0000000
--- a/tests/RenderScriptTests/MathErr/res/layout/main.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-    <ImageView
-        android:id="@+id/displayin"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-    <ImageView
-        android:id="@+id/displayout"
-        android:layout_width="320dip"
-        android:layout_height="266dip" />
-
-</LinearLayout>
diff --git a/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/MathErr.java b/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/MathErr.java
deleted file mode 100644
index 4561267..0000000
--- a/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/MathErr.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2013 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.example.android.rs.matherr;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import java.lang.Float;
-import java.lang.Math;
-
-public class MathErr {
-    private RenderScript mRS;
-    private Allocation mAllocationSrc;
-    private Allocation mAllocationRes;
-    private ScriptC_math_err mScript;
-    private java.util.Random mRand = new java.util.Random();
-
-    private final int BUF_SIZE = 4096;
-    float mSrc[] = new float[BUF_SIZE];
-    float mRef[] = new float[BUF_SIZE];
-    float mRes[] = new float[BUF_SIZE];
-
-    MathErr(RenderScript rs) {
-        mRS = rs;
-        mScript = new ScriptC_math_err(mRS);
-
-        mAllocationSrc = Allocation.createSized(rs, Element.F32(rs), BUF_SIZE);
-        mAllocationRes = Allocation.createSized(rs, Element.F32(rs), BUF_SIZE);
-
-        testExp2();
-        testLog2();
-    }
-
-    void buildRand() {
-        for (int i=0; i < BUF_SIZE; i++) {
-            mSrc[i] = (((float)i) / 9) - 200;
-            //mSrc[i] = Float.intBitsToFloat(mRand.nextInt());
-        }
-        mAllocationSrc.copyFrom(mSrc);
-    }
-
-    void logErr() {
-        mAllocationRes.copyTo(mRes);
-        for (int i=0; i < BUF_SIZE; i++) {
-            int err = Float.floatToRawIntBits(mRef[i]) - Float.floatToRawIntBits(mRes[i]);
-            err = Math.abs(err);
-            if (err > 8096) {
-                android.util.Log.v("err", "error " + err + " src " + mSrc[i] + " ref " + mRef[i] + " res " + mRes[i]);
-            }
-        }
-    }
-
-    void testExp2() {
-        android.util.Log.v("err", "testing exp2");
-        buildRand();
-        mScript.forEach_testExp2(mAllocationSrc, mAllocationRes);
-        for (int i=0; i < BUF_SIZE; i++) {
-            mRef[i] = (float)Math.pow(2.f, mSrc[i]);
-        }
-        logErr();
-    }
-
-    void testLog2() {
-        android.util.Log.v("err", "testing log2");
-        buildRand();
-        mScript.forEach_testLog2(mAllocationSrc, mAllocationRes);
-        for (int i=0; i < BUF_SIZE; i++) {
-            mRef[i] = (float)Math.log(mSrc[i]) * 1.442695041f;
-        }
-        logErr();
-    }
-
-}
diff --git a/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/MathErrActivity.java b/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/MathErrActivity.java
deleted file mode 100644
index 74d7b71..0000000
--- a/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/MathErrActivity.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.example.android.rs.matherr;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.renderscript.RenderScript;
-import android.renderscript.Allocation;
-import android.util.Log;
-
-public class MathErrActivity extends Activity {
-    private MathErr mME;
-    private RenderScript mRS;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.main);
-
-        mRS = RenderScript.create(this);
-        mME = new MathErr(mRS);
-    }
-}
diff --git a/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/math_err.rs b/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/math_err.rs
deleted file mode 100644
index a26770b..0000000
--- a/tests/RenderScriptTests/MathErr/src/com/example/android/rs/matherr/math_err.rs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.example.android.rs.matherr)
-
-typedef union
-{
-  float fv;
-  int32_t iv;
-} ieee_float_shape_type;
-
-/* Get a 32 bit int from a float.  */
-
-#define GET_FLOAT_WORD(i,d)         \
-do {                                \
-  ieee_float_shape_type gf_u;       \
-  gf_u.fv = (d);                    \
-  (i) = gf_u.iv;                    \
-} while (0)
-
-/* Set a float from a 32 bit int.  */
-
-#define SET_FLOAT_WORD(d,i)         \
-do {                                \
-  ieee_float_shape_type sf_u;       \
-  sf_u.iv = (i);                    \
-  (d) = sf_u.fv;                    \
-} while (0)
-
-
-static float fast_log2(float v) {
-    int32_t ibits;
-    GET_FLOAT_WORD(ibits, v);
-
-    int32_t e = (ibits >> 23) & 0xff;
-
-    ibits &= 0x7fffff;
-    ibits |= 127 << 23;
-
-    float ir;
-    SET_FLOAT_WORD(ir, ibits);
-
-    ir -= 1.5f;
-    float ir2 = ir*ir;
-    float adj2 = 0.405465108f + // -0.00009f +
-                 (0.666666667f * ir) -
-                 (0.222222222f * ir2) +
-                 (0.098765432f * ir*ir2) -
-                 (0.049382716f * ir2*ir2) +
-                 (0.026337449f * ir*ir2*ir2) -
-                 (0.014631916f * ir2*ir2*ir2);
-    adj2 *= (1.f / 0.693147181f);
-
-    return (float)(e - 127) + adj2;
-}
-
-void testExp2(const float *in, float *out) {
-    float i = *in;
-    if (i > (-125.f) && i < 125.f) {
-        *out = native_exp2(i);
-    } else {
-        *out = exp2(i);
-    }
-    *out = native_exp2(i);
-}
-
-void testLog2(const float *in, float *out) {
-    *out = fast_log2(*in);
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/Android.mk b/tests/RenderScriptTests/RSTest_CompatLib/Android.mk
deleted file mode 100644
index 0fd0d96..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright (C) 2013 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RSTest_Compat
-
-LOCAL_STATIC_JAVA_LIBRARIES := android.support.v8.renderscript
-
-LOCAL_SDK_VERSION := 8
-LOCAL_RENDERSCRIPT_TARGET_API := 18
-LOCAL_RENDERSCRIPT_COMPATIBILITY := 18
-
-LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
-LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := \
-    $(TOPDIR)external/clang/lib/Headers \
-    $(TOPDIR)frameworks/rs/scriptc
-
-LOCAL_RENDERSCRIPT_FLAGS := -rs-package-name=android.support.v8.renderscript
-LOCAL_REQUIRED_MODULES := librsjni
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/AndroidManifest.xml b/tests/RenderScriptTests/RSTest_CompatLib/AndroidManifest.xml
deleted file mode 100644
index 53219e7..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.test_compat">
-  <uses-sdk android:minSdkVersion="8" />
-  <uses-sdk android:targetSdkVersion="8" />
-    <application
-        android:label="_RS_Test_Compat"
-        android:icon="@drawable/test_pattern">
-        <activity android:name="RSTest"
-                  android:screenOrientation="portrait">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/res/drawable-nodpi/test_pattern.png b/tests/RenderScriptTests/RSTest_CompatLib/res/drawable-nodpi/test_pattern.png
deleted file mode 100644
index e7d1455..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/res/drawable-nodpi/test_pattern.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/RSTest.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/RSTest.java
deleted file mode 100644
index b76f21e..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/RSTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.support.v8.renderscript.RenderScript;
-
-import android.app.ListActivity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-import android.widget.ArrayAdapter;
-
-import java.lang.Runtime;
-
-public class RSTest extends ListActivity {
-
-    private static final String LOG_TAG = "RSTest_Compat";
-    private static final boolean DEBUG  = false;
-    private static final boolean LOG_ENABLED = false;
-
-    private RenderScript mRS;
-    private RSTestCore RSTC;
-
-    String mTestNames[];
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        mRS = RenderScript.create(this);
-
-        RSTC = new RSTestCore(this);
-        RSTC.init(mRS, getResources());
-
-
-
-
-    }
-
-    static void log(String message) {
-        if (LOG_ENABLED) {
-            Log.v(LOG_TAG, message);
-        }
-    }
-
-
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/RSTestCore.java
deleted file mode 100644
index 51f8a4d..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/RSTestCore.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2008-2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import java.util.ArrayList;
-import java.util.ListIterator;
-import java.util.Timer;
-import java.util.TimerTask;
-import android.app.ListActivity;
-import android.widget.ArrayAdapter;
-
-public class RSTestCore {
-    ListActivity mCtx;
-
-    public RSTestCore(ListActivity ctx) {
-        mCtx = ctx;
-    }
-
-    private Resources mRes;
-    private RenderScript mRS;
-
-    private ArrayList<UnitTest> unitTests;
-    private ListIterator<UnitTest> test_iter;
-    private UnitTest activeTest;
-    private boolean stopTesting;
-
-    private ScriptField_ListAllocs_s mListAllocs;
-
-    private ArrayAdapter<UnitTest> testAdapter;
-
-    /* Periodic timer for ensuring future tests get scheduled */
-    private Timer mTimer;
-    public static final int RS_TIMER_PERIOD = 100;
-
-    public void init(RenderScript rs, Resources res) {
-        mRS = rs;
-        mRes = res;
-        stopTesting = false;
-
-        unitTests = new ArrayList<UnitTest>();
-
-        unitTests.add(new UT_primitives(this, mRes, mCtx));
-        unitTests.add(new UT_constant(this, mRes, mCtx));
-        unitTests.add(new UT_vector(this, mRes, mCtx));
-        unitTests.add(new UT_unsigned(this, mRes, mCtx));
-        unitTests.add(new UT_array_init(this, mRes, mCtx));
-        unitTests.add(new UT_array_alloc(this, mRes, mCtx));
-        unitTests.add(new UT_kernel(this, mRes, mCtx));
-        unitTests.add(new UT_kernel_struct(this, mRes, mCtx));
-        unitTests.add(new UT_bug_char(this, mRes, mCtx));
-        unitTests.add(new UT_clamp(this, mRes, mCtx));
-        unitTests.add(new UT_clamp_relaxed(this, mRes, mCtx));
-        unitTests.add(new UT_convert(this, mRes, mCtx));
-        unitTests.add(new UT_convert_relaxed(this, mRes, mCtx));
-        unitTests.add(new UT_copy_test(this, mRes, mCtx));
-        unitTests.add(new UT_rsdebug(this, mRes, mCtx));
-        unitTests.add(new UT_rstime(this, mRes, mCtx));
-        unitTests.add(new UT_rstypes(this, mRes, mCtx));
-        unitTests.add(new UT_alloc(this, mRes, mCtx));
-        unitTests.add(new UT_refcount(this, mRes, mCtx));
-        unitTests.add(new UT_foreach(this, mRes, mCtx));
-        unitTests.add(new UT_foreach_bounds(this, mRes, mCtx));
-        unitTests.add(new UT_noroot(this, mRes, mCtx));
-        unitTests.add(new UT_atomic(this, mRes, mCtx));
-        unitTests.add(new UT_struct(this, mRes, mCtx));
-        unitTests.add(new UT_math(this, mRes, mCtx));
-        unitTests.add(new UT_math_conformance(this, mRes, mCtx));
-        unitTests.add(new UT_math_agree(this, mRes, mCtx));
-        unitTests.add(new UT_min(this, mRes, mCtx));
-        unitTests.add(new UT_int4(this, mRes, mCtx));
-        unitTests.add(new UT_element(this, mRes, mCtx));
-        unitTests.add(new UT_sampler(this, mRes, mCtx));
-        unitTests.add(new UT_fp_mad(this, mRes, mCtx));
-
-        /*
-        unitTests.add(new UnitTest(null, "<Pass>", 1));
-        unitTests.add(new UnitTest());
-        unitTests.add(new UnitTest(null, "<Fail>", -1));
-
-        for (int i = 0; i < 20; i++) {
-            unitTests.add(new UnitTest(null, "<Pass>", 1));
-        }
-        */
-
-        UnitTest [] uta = new UnitTest[unitTests.size()];
-        uta = unitTests.toArray(uta);
-
-        mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
-        for (int i = 0; i < uta.length; i++) {
-
-            ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
-            listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
-            listElem.result = uta[i].getResult();
-            mListAllocs.set(listElem, i, false);
-            uta[i].setItem(listElem);
-        }
-
-        mListAllocs.copyAll();
-
-        testAdapter = new ArrayAdapter<UnitTest>(mCtx, android.R.layout.simple_list_item_1, unitTests);
-        mCtx.setListAdapter(testAdapter);
-
-        test_iter = unitTests.listIterator();
-        refreshTestResults(); /* Kick off the first test */
-
-        TimerTask pTask = new TimerTask() {
-            public void run() {
-                refreshTestResults();
-            }
-        };
-
-        mTimer = new Timer();
-        mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
-    }
-
-    public void checkAndRunNextTest() {
-        mCtx.runOnUiThread(new Runnable() {
-                public void run() {
-                    if (testAdapter != null)
-                        testAdapter.notifyDataSetChanged();
-                }
-            });
-
-        if (activeTest != null) {
-            if (!activeTest.isAlive()) {
-                /* Properly clean up on our last test */
-                try {
-                    activeTest.join();
-                }
-                catch (InterruptedException e) {
-                }
-                activeTest = null;
-            }
-        }
-
-        if (!stopTesting && activeTest == null) {
-            if (test_iter.hasNext()) {
-                activeTest = test_iter.next();
-                activeTest.start();
-                /* This routine will only get called once when a new test
-                 * should start running. The message handler in UnitTest.java
-                 * ensures this. */
-            }
-            else {
-                if (mTimer != null) {
-                    mTimer.cancel();
-                    mTimer.purge();
-                    mTimer = null;
-                }
-            }
-        }
-    }
-
-    public void refreshTestResults() {
-        checkAndRunNextTest();
-    }
-
-    public void cleanup() {
-        stopTesting = true;
-        UnitTest t = activeTest;
-
-        /* Stop periodic refresh of testing */
-        if (mTimer != null) {
-            mTimer.cancel();
-            mTimer.purge();
-            mTimer = null;
-        }
-
-        /* Wait to exit until we finish the current test */
-        if (t != null) {
-            try {
-                t.join();
-            }
-            catch (InterruptedException e) {
-            }
-            t = null;
-        }
-
-    }
-
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_alloc.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_alloc.java
deleted file mode 100644
index 3af3745..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_alloc.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_alloc extends UnitTest {
-    private Resources mRes;
-
-    protected UT_alloc(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Alloc", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_alloc s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        int Z = 0;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        s.set_dimZ(Z);
-        typeBuilder.setX(X).setY(Y);
-        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_a(A);
-        s.set_aRaw(A);
-
-        typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        typeBuilder.setX(X).setY(Y).setFaces(true);
-        Allocation AFaces = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aFaces(AFaces);
-        typeBuilder.setFaces(false).setMipmaps(true);
-        Allocation ALOD = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aLOD(ALOD);
-        typeBuilder.setFaces(true).setMipmaps(true);
-        Allocation AFacesLOD = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aFacesLOD(AFacesLOD);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_alloc s = new ScriptC_alloc(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_root(s.get_aRaw());
-        s.invoke_alloc_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_array_alloc.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_array_alloc.java
deleted file mode 100644
index 751187b..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_array_alloc.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_array_alloc extends UnitTest {
-    private Resources mRes;
-
-    protected UT_array_alloc(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Array Allocation", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_array_alloc s = new ScriptC_array_alloc(pRS);
-        pRS.setMessageHandler(mRsMessage);
-
-        int dimX = s.get_dimX();
-        Allocation[] Arr = new Allocation[dimX];
-        Type.Builder typeBuilder = new Type.Builder(pRS, Element.I32(pRS));
-        Type T = typeBuilder.setX(1).create();
-        for (int i = 0; i < dimX; i++) {
-            Allocation A = Allocation.createTyped(pRS, T);
-            Arr[i] = A;
-        }
-        s.set_a(Arr);
-
-        s.invoke_array_alloc_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_array_init.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_array_init.java
deleted file mode 100644
index f8b2fd3..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_array_init.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_array_init extends UnitTest {
-    private Resources mRes;
-
-    protected UT_array_init(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Array Init", ctx);
-        mRes = res;
-    }
-
-    private void checkInit(ScriptC_array_init s) {
-        float[] fa = s.get_fa();
-        _RS_ASSERT("fa[0] == 1.0", fa[0] == 1.0);
-        _RS_ASSERT("fa[1] == 9.9999f", fa[1] == 9.9999f);
-        _RS_ASSERT("fa[2] == 0", fa[2] == 0);
-        _RS_ASSERT("fa[3] == 0", fa[3] == 0);
-        _RS_ASSERT("fa.length == 4", fa.length == 4);
-
-        double[] da = s.get_da();
-        _RS_ASSERT("da[0] == 7.0", da[0] == 7.0);
-        _RS_ASSERT("da[1] == 8.88888", da[1] == 8.88888);
-        _RS_ASSERT("da.length == 2", da.length == 2);
-
-        byte[] ca = s.get_ca();
-        _RS_ASSERT("ca[0] == 'a'", ca[0] == 'a');
-        _RS_ASSERT("ca[1] == 7", ca[1] == 7);
-        _RS_ASSERT("ca[2] == 'b'", ca[2] == 'b');
-        _RS_ASSERT("ca[3] == 'c'", ca[3] == 'c');
-        _RS_ASSERT("ca.length == 4", ca.length == 4);
-
-        short[] sa = s.get_sa();
-        _RS_ASSERT("sa[0] == 1", sa[0] == 1);
-        _RS_ASSERT("sa[1] == 1", sa[1] == 1);
-        _RS_ASSERT("sa[2] == 2", sa[2] == 2);
-        _RS_ASSERT("sa[3] == 3", sa[3] == 3);
-        _RS_ASSERT("sa.length == 4", sa.length == 4);
-
-        int[] ia = s.get_ia();
-        _RS_ASSERT("ia[0] == 5", ia[0] == 5);
-        _RS_ASSERT("ia[1] == 8", ia[1] == 8);
-        _RS_ASSERT("ia[2] == 0", ia[2] == 0);
-        _RS_ASSERT("ia[3] == 0", ia[3] == 0);
-        _RS_ASSERT("ia.length == 4", ia.length == 4);
-
-        long[] la = s.get_la();
-        _RS_ASSERT("la[0] == 13", la[0] == 13);
-        _RS_ASSERT("la[1] == 21", la[1] == 21);
-        _RS_ASSERT("la.length == 4", la.length == 2);
-
-        long[] lla = s.get_lla();
-        _RS_ASSERT("lla[0] == 34", lla[0] == 34);
-        _RS_ASSERT("lla[1] == 0", lla[1] == 0);
-        _RS_ASSERT("lla[2] == 0", lla[2] == 0);
-        _RS_ASSERT("lla[3] == 0", lla[3] == 0);
-        _RS_ASSERT("lla.length == 4", lla.length == 4);
-
-        boolean[] ba = s.get_ba();
-        _RS_ASSERT("ba[0] == true", ba[0] == true);
-        _RS_ASSERT("ba[1] == false", ba[1] == false);
-        _RS_ASSERT("ba[2] == false", ba[2] == false);
-        _RS_ASSERT("ba.length == 3", ba.length == 3);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_array_init s = new ScriptC_array_init(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        checkInit(s);
-        s.invoke_array_init_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_atomic.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_atomic.java
deleted file mode 100644
index 7fe4b36..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_atomic.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_atomic extends UnitTest {
-    private Resources mRes;
-
-    protected UT_atomic(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Atomics", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_atomic s = new ScriptC_atomic(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_atomic_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_bug_char.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_bug_char.java
deleted file mode 100644
index 5da5288..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_bug_char.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import java.util.Arrays;
-
-public class UT_bug_char extends UnitTest {
-    private Resources mRes;
-
-    protected UT_bug_char(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Bug Char", ctx);
-        mRes = res;
-    }
-
-    // packing functions
-    private Byte2 pack_b2(byte[] val) {
-        assert val.length == 2;
-        Log.i("bug_char", "pack_b2 " + val[0] + " " + val[1]);
-        return new Byte2(val[0], val[1]);
-    }
-
-    private byte min(byte v1, byte v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private byte[] min(byte[] v1, byte[] v2) {
-        assert v1.length == v2.length;
-        byte[] rv = new byte[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-
-    private void initializeValues(ScriptC_bug_char s) {
-        byte rand_sc1_0 = (byte)7;
-        byte[] rand_sc2_0 = new byte[2];
-        rand_sc2_0[0] = 11;
-        rand_sc2_0[1] = 21;
-        Log.i("bug_char", "Generated sc2_0 to " + Arrays.toString(rand_sc2_0));
-        byte rand_sc1_1 = (byte)10;
-        byte[] rand_sc2_1 = new byte[2];
-        rand_sc2_1[0] = 13;
-        rand_sc2_1[1] = 15;
-        Log.i("bug_char", "Generated sc2_1 to " + Arrays.toString(rand_sc2_1));
-
-        s.set_rand_sc1_0(rand_sc1_0);
-        s.set_rand_sc2_0(pack_b2(rand_sc2_0));
-        s.set_rand_sc1_1(rand_sc1_1);
-        s.set_rand_sc2_1(pack_b2(rand_sc2_1));
-        // Set results for min
-        s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
-        byte[] min_rand_sc2_raw = min(rand_sc2_0, rand_sc2_1);
-        Log.i("bug_char", "Generating min_rand_sc2_sc2 to " +
-              Arrays.toString(min_rand_sc2_raw));
-        Byte2 min_rand_sc2 = pack_b2(min_rand_sc2_raw);
-        Log.i("bug_char", "Setting min_rand_sc2_sc2 to [" + min_rand_sc2.x +
-              ", " + min_rand_sc2.y + "]");
-        s.set_min_rand_sc2_sc2(min_rand_sc2);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_bug_char s = new ScriptC_bug_char(pRS, mRes,
-                R.raw.bug_char);
-        pRS.setMessageHandler(mRsMessage);
-        initializeValues(s);
-        s.invoke_bug_char_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_clamp.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_clamp.java
deleted file mode 100644
index 1f28abc..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_clamp.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_clamp extends UnitTest {
-    private Resources mRes;
-
-    protected UT_clamp(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Clamp (Full)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_clamp s = new ScriptC_clamp(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_clamp_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_clamp_relaxed.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_clamp_relaxed.java
deleted file mode 100644
index d880e68..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_clamp_relaxed.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_clamp_relaxed extends UnitTest {
-    private Resources mRes;
-
-    protected UT_clamp_relaxed(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Clamp (Relaxed)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_clamp_relaxed s =
-                new ScriptC_clamp_relaxed(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_clamp_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_constant.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_constant.java
deleted file mode 100644
index 3085032..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_constant.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_constant extends UnitTest {
-    private Resources mRes;
-
-    protected UT_constant(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Const", ctx);
-        mRes = res;
-    }
-
-    private void Assert(boolean b) {
-        if (!b) {
-            failTest();
-        }
-    }
-
-    public void run() {
-        Assert(ScriptC_constant.const_floatTest == 1.99f);
-        Assert(ScriptC_constant.const_doubleTest == 2.05);
-        Assert(ScriptC_constant.const_charTest == -8);
-        Assert(ScriptC_constant.const_shortTest == -16);
-        Assert(ScriptC_constant.const_intTest == -32);
-        Assert(ScriptC_constant.const_longTest == 17179869184l);
-        Assert(ScriptC_constant.const_longlongTest == 68719476736l);
-
-        Assert(ScriptC_constant.const_ucharTest == 8);
-        Assert(ScriptC_constant.const_ushortTest == 16);
-        Assert(ScriptC_constant.const_uintTest == 32);
-        Assert(ScriptC_constant.const_ulongTest == 4611686018427387904L);
-        Assert(ScriptC_constant.const_int64_tTest == -17179869184l);
-        Assert(ScriptC_constant.const_uint64_tTest == 117179869184l);
-
-        Assert(ScriptC_constant.const_boolTest == true);
-
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_convert.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_convert.java
deleted file mode 100644
index a7cb226..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_convert.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_convert extends UnitTest {
-    private Resources mRes;
-
-    protected UT_convert(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Convert", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_convert s = new ScriptC_convert(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_convert_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_convert_relaxed.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_convert_relaxed.java
deleted file mode 100644
index 269bcef..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_convert_relaxed.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_convert_relaxed extends UnitTest {
-    private Resources mRes;
-
-    protected UT_convert_relaxed(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Convert (Relaxed)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_convert_relaxed s =
-                new ScriptC_convert_relaxed(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_convert_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_copy_test.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_copy_test.java
deleted file mode 100644
index f435dde..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_copy_test.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class UT_copy_test extends UnitTest {
-    private Resources mRes;
-    boolean pass = true;
-
-    protected UT_copy_test(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Copy", ctx);
-        mRes = res;
-    }
-
-    void testFloat2(RenderScript rs, ScriptC_copy_test s) {
-        Allocation a1 = Allocation.createSized(rs, Element.F32_2(rs), 1024);
-        Allocation a2 = Allocation.createSized(rs, Element.F32_2(rs), 1024);
-
-        float[] f1 = new float[1024 * 2];
-        float[] f2 = new float[1024 * 2];
-        for (int ct=0; ct < f1.length; ct++) {
-            f1[ct] = (float)ct;
-        }
-        a1.copyFrom(f1);
-
-        s.forEach_copyFloat2(a1, a2);
-
-        a2.copyTo(f2);
-        for (int ct=0; ct < f1.length; ct++) {
-            if (f1[ct] != f2[ct]) {
-                failTest();
-                Log.v("RS Test", "Compare failed at " + ct + ", " + f1[ct] + ", " + f2[ct]);
-            }
-        }
-        a1.destroy();
-        a2.destroy();
-    }
-
-    void testFloat3(RenderScript rs, ScriptC_copy_test s) {
-        Allocation a1 = Allocation.createSized(rs, Element.F32_3(rs), 1024);
-        Allocation a2 = Allocation.createSized(rs, Element.F32_3(rs), 1024);
-
-        float[] f1 = new float[1024 * 4];
-        float[] f2 = new float[1024 * 4];
-        for (int ct=0; ct < f1.length; ct++) {
-            f1[ct] = (float)ct;
-        }
-        a1.copyFrom(f1);
-
-        s.forEach_copyFloat3(a1, a2);
-
-        a2.copyTo(f2);
-        for (int ct=0; ct < f1.length; ct++) {
-            if ((f1[ct] != f2[ct]) && ((ct&3) != 3)) {
-                failTest();
-                Log.v("RS Test", "Compare failed at " + ct + ", " + f1[ct] + ", " + f2[ct]);
-            }
-        }
-        a1.destroy();
-        a2.destroy();
-    }
-
-    void testFloat4(RenderScript rs, ScriptC_copy_test s) {
-        Allocation a1 = Allocation.createSized(rs, Element.F32_4(rs), 1024);
-        Allocation a2 = Allocation.createSized(rs, Element.F32_4(rs), 1024);
-
-        float[] f1 = new float[1024 * 4];
-        float[] f2 = new float[1024 * 4];
-        for (int ct=0; ct < f1.length; ct++) {
-            f1[ct] = (float)ct;
-        }
-        a1.copyFrom(f1);
-
-        s.forEach_copyFloat4(a1, a2);
-
-        a2.copyTo(f2);
-        for (int ct=0; ct < f1.length; ct++) {
-            if (f1[ct] != f2[ct]) {
-                failTest();
-                Log.v("RS Test", "Compare failed at " + ct + ", " + f1[ct] + ", " + f2[ct]);
-            }
-        }
-        a1.destroy();
-        a2.destroy();
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_copy_test s = new ScriptC_copy_test(pRS);
-        pRS.setMessageHandler(mRsMessage);
-
-        testFloat2(pRS, s);
-        testFloat3(pRS, s);
-        testFloat4(pRS, s);
-        s.invoke_sendResult(true);
-
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_element.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_element.java
deleted file mode 100644
index abfa44c..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_element.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_element extends UnitTest {
-    private Resources mRes;
-
-    Element simpleElem;
-    Element complexElem;
-
-    final String subElemNames[] = {
-        "subElem0",
-        "subElem1",
-        "subElem2",
-        "arrayElem0",
-        "arrayElem1",
-        "subElem3",
-        "subElem4",
-        "subElem5",
-        "subElem6",
-        "subElem_7",
-    };
-
-    final int subElemArraySizes[] = {
-        1,
-        1,
-        1,
-        2,
-        5,
-        1,
-        1,
-        1,
-        1,
-        1,
-    };
-
-    final int subElemOffsets[] = {
-        0,
-        4,
-        8,
-        12,
-        20,
-        40,
-        44,
-        48,
-        64,
-        80,
-    };
-
-    protected UT_element(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Element", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_element s) {
-        simpleElem = Element.F32_3(RS);
-        complexElem = ScriptField_ComplexStruct.createElement(RS);
-        s.set_simpleElem(simpleElem);
-        s.set_complexElem(complexElem);
-
-        ScriptField_ComplexStruct data = new ScriptField_ComplexStruct(RS, 1);
-        s.bind_complexStruct(data);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_element s = new ScriptC_element(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_element_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    private void testJavaSide(RenderScript RS) {
-
-        int subElemCount = simpleElem.getSubElementCount();
-        _RS_ASSERT("subElemCount == 0", subElemCount == 0);
-
-        subElemCount = complexElem.getSubElementCount();
-        _RS_ASSERT("subElemCount == 10", subElemCount == 10);
-        _RS_ASSERT("complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof",
-                   complexElem.getBytesSize() == ScriptField_ComplexStruct.Item.sizeof);
-
-        for (int i = 0; i < subElemCount; i ++) {
-            _RS_ASSERT("complexElem.getSubElement(i) != null",
-                       complexElem.getSubElement(i) != null);
-            _RS_ASSERT("complexElem.getSubElementName(i).equals(subElemNames[i])",
-                       complexElem.getSubElementName(i).equals(subElemNames[i]));
-            _RS_ASSERT("complexElem.getSubElementArraySize(i) == subElemArraySizes[i]",
-                       complexElem.getSubElementArraySize(i) == subElemArraySizes[i]);
-            _RS_ASSERT("complexElem.getSubElementOffsetBytes(i) == subElemOffsets[i]",
-                       complexElem.getSubElementOffsetBytes(i) == subElemOffsets[i]);
-        }
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testScriptSide(pRS);
-        testJavaSide(pRS);
-        passTest();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_foreach.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_foreach.java
deleted file mode 100644
index fd18f93..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_foreach.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2011-2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_foreach extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_foreach(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_foreach s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_foreach s = new ScriptC_foreach(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_root(A);
-        s.invoke_verify_root();
-        s.forEach_foo(A, A);
-        s.invoke_verify_foo();
-        s.invoke_foreach_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_foreach_bounds.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_foreach_bounds.java
deleted file mode 100644
index 13fefe7..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_foreach_bounds.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_foreach_bounds extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_foreach_bounds(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach (bounds)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_foreach_bounds s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-        s.set_s(s);
-        s.set_ain(A);
-        s.set_aout(A);
-        s.set_xStart(2);
-        s.set_xEnd(5);
-        s.set_yStart(3);
-        s.set_yEnd(6);
-        s.forEach_zero(A);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_foreach_bounds s = new ScriptC_foreach_bounds(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_foreach_bounds_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_fp_mad.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_fp_mad.java
deleted file mode 100644
index 960df24..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_fp_mad.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_fp_mad extends UnitTest {
-    private Resources mRes;
-
-    protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Fp_Mad", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_fp_mad s = new ScriptC_fp_mad(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_fp_mad_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_int4.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_int4.java
deleted file mode 100644
index 9592798..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_int4.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_int4 extends UnitTest {
-    private Resources mRes;
-
-    protected UT_int4(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "int4", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_int4 s = new ScriptC_int4(pRS, mRes, R.raw.int4);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_int4_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_kernel.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_kernel.java
deleted file mode 100644
index ec67665..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_kernel.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class UT_kernel extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-    private Allocation B;
-
-    protected UT_kernel(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Kernels (pass-by-value)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_kernel s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        s.set_dimX(X);
-        typeBuilder.setX(X);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_ain(A);
-        B = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_aout(B);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_kernel s = new ScriptC_kernel(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_init_vars(A);
-        s.forEach_root(A, B);
-        s.invoke_verify_root();
-        s.invoke_kernel_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_kernel_struct.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_kernel_struct.java
deleted file mode 100644
index 07538ec..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_kernel_struct.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-
-public class UT_kernel_struct extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-    private Allocation B;
-
-    protected UT_kernel_struct(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Kernels (struct pass-by-value)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_kernel_struct s) {
-        int X = 5;
-        s.set_dimX(X);
-        ScriptField_simpleStruct t;
-        t = new ScriptField_simpleStruct(RS, X);
-        s.bind_ain(t);
-        A = t.getAllocation();
-        t = new ScriptField_simpleStruct(RS, X);
-        s.bind_aout(t);
-        B = t.getAllocation();
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_kernel_struct s = new ScriptC_kernel_struct(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_init_vars(A);
-        s.forEach_root(A, B);
-        s.invoke_verify_root();
-        s.invoke_kernel_struct_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math.java
deleted file mode 100644
index 055c454..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_math extends UnitTest {
-    private Resources mRes;
-
-    protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math s = new ScriptC_math(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_math_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math_agree.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math_agree.java
deleted file mode 100644
index a7e7429..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math_agree.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-import android.util.Log;
-import java.util.Arrays;
-import java.util.Random;
-
-public class UT_math_agree extends UnitTest {
-    private Resources mRes;
-    private Random rand;
-
-    protected UT_math_agree(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math Agreement", ctx);
-        mRes = res;
-        rand = new Random();
-    }
-
-    // packing functions
-    private Float2 pack_f2(float[] val) {
-        assert val.length == 2;
-        return new Float2(val[0], val[1]);
-    }
-    private Float3 pack_f3(float[] val) {
-        assert val.length == 3;
-        return new Float3(val[0], val[1], val[2]);
-    }
-    private Float4 pack_f4(float[] val) {
-        assert val.length == 4;
-        return new Float4(val[0], val[1], val[2], val[3]);
-    }
-    private Byte2 pack_b2(byte[] val) {
-        assert val.length == 2;
-        return new Byte2(val[0], val[1]);
-    }
-    private Byte3 pack_b3(byte[] val) {
-        assert val.length == 3;
-        return new Byte3(val[0], val[1], val[2]);
-    }
-    private Byte4 pack_b4(byte[] val) {
-        assert val.length == 4;
-        return new Byte4(val[0], val[1], val[2], val[3]);
-    }
-    private Short2 pack_s2(short[] val) {
-        assert val.length == 2;
-        return new Short2(val[0], val[1]);
-    }
-    private Short3 pack_s3(short[] val) {
-        assert val.length == 3;
-        return new Short3(val[0], val[1], val[2]);
-    }
-    private Short4 pack_s4(short[] val) {
-        assert val.length == 4;
-        return new Short4(val[0], val[1], val[2], val[3]);
-    }
-    private Int2 pack_i2(int[] val) {
-        assert val.length == 2;
-        return new Int2(val[0], val[1]);
-    }
-    private Int3 pack_i3(int[] val) {
-        assert val.length == 3;
-        return new Int3(val[0], val[1], val[2]);
-    }
-    private Int4 pack_i4(int[] val) {
-        assert val.length == 4;
-        return new Int4(val[0], val[1], val[2], val[3]);
-    }
-    private Long2 pack_l2(long[] val) {
-        assert val.length == 2;
-        return new Long2(val[0], val[1]);
-    }
-    private Long3 pack_l3(long[] val) {
-        assert val.length == 3;
-        return new Long3(val[0], val[1], val[2]);
-    }
-    private Long4 pack_l4(long[] val) {
-        assert val.length == 4;
-        return new Long4(val[0], val[1], val[2], val[3]);
-    }
-
-    // random vector generation functions
-    private float[] randvec_float(int dim) {
-        float[] fv = new float[dim];
-        for (int i = 0; i < dim; ++i)
-            fv[i] = rand.nextFloat();
-        return fv;
-    }
-    private byte[] randvec_char(int dim) {
-        byte[] cv = new byte[dim];
-        rand.nextBytes(cv);
-        return cv;
-    }
-    private short[] randvec_uchar(int dim) {
-       short[] ucv = new short[dim];
-       for (int i = 0; i < dim; ++i)
-           ucv[i] = (short)rand.nextInt(0x1 << 8);
-       return ucv;
-    }
-    private short[] randvec_short(int dim) {
-        short[] sv = new short[dim];
-        for (int i = 0; i < dim; ++i)
-            sv[i] = (short)rand.nextInt(0x1 << 16);
-        return sv;
-    }
-    private int[] randvec_ushort(int dim) {
-        int[] usv = new int[dim];
-        for (int i = 0; i < dim; ++i)
-            usv[i] = rand.nextInt(0x1 << 16);
-        return usv;
-    }
-    private int[] randvec_int(int dim) {
-        int[] iv = new int[dim];
-        for (int i = 0; i < dim; ++i)
-            iv[i] = rand.nextInt();
-        return iv;
-    }
-    private long[] randvec_uint(int dim) {
-        long[] uiv = new long[dim];
-        for (int i = 0; i < dim; ++i)
-            uiv[i] = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
-        return uiv;
-    }
-    private long[] randvec_long(int dim) {
-        long[] lv = new long[dim];
-        for (int i = 0; i < dim; ++i)
-            lv[i] = rand.nextLong();
-        return lv;
-    }
-    // TODO:  unsigned long generator
-
-    // min reference functions
-    private float min(float v1, float v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private float[] min(float[] v1, float[] v2) {
-        assert v1.length == v2.length;
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private byte min(byte v1, byte v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private byte[] min(byte[] v1, byte[] v2) {
-        assert v1.length == v2.length;
-        byte[] rv = new byte[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private short min(short v1, short v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private short[] min(short[] v1, short[] v2) {
-        assert v1.length == v2.length;
-        short[] rv = new short[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private int min(int v1, int v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private int[] min(int[] v1, int[] v2) {
-        assert v1.length == v2.length;
-        int[] rv = new int[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private long min(long v1, long v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private long[] min(long[] v1, long[] v2) {
-        assert v1.length == v2.length;
-        long[] rv = new long[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    // TODO:  unsigned long version of min
-
-    // max reference functions
-    private float max(float v1, float v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private float[] max(float[] v1, float[] v2) {
-        assert v1.length == v2.length;
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private byte max(byte v1, byte v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private byte[] max(byte[] v1, byte[] v2) {
-        assert v1.length == v2.length;
-        byte[] rv = new byte[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private short max(short v1, short v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private short[] max(short[] v1, short[] v2) {
-        assert v1.length == v2.length;
-        short[] rv = new short[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private int max(int v1, int v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private int[] max(int[] v1, int[] v2) {
-        assert v1.length == v2.length;
-        int[] rv = new int[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private long max(long v1, long v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private long[] max(long[] v1, long[] v2) {
-        assert v1.length == v2.length;
-        long[] rv = new long[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    // TODO:  unsigned long version of max
-
-    // fmin reference functions
-    private float fmin(float v1, float v2) {
-        return min(v1, v2);
-    }
-    private float[] fmin(float[] v1, float[] v2) {
-        return min(v1, v2);
-    }
-    private float[] fmin(float[] v1, float v2) {
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2);
-        return rv;
-    }
-
-    // fmax reference functions
-    private float fmax(float v1, float v2) {
-        return max(v1, v2);
-    }
-    private float[] fmax(float[] v1, float[] v2) {
-        return max(v1, v2);
-    }
-    private float[] fmax(float[] v1, float v2) {
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2);
-        return rv;
-    }
-
-    private void initializeValues(ScriptC_math_agree s) {
-        float x = rand.nextFloat();
-        float y = rand.nextFloat();
-
-        s.set_x(x);
-        s.set_y(y);
-        s.set_result_add(x + y);
-        s.set_result_sub(x - y);
-        s.set_result_mul(x * y);
-        s.set_result_div(x / y);
-
-        // Generate random vectors of all types
-        float rand_f1_0 = rand.nextFloat();
-        float[] rand_f2_0 = randvec_float(2);
-        float[] rand_f3_0 = randvec_float(3);
-        float[] rand_f4_0 = randvec_float(4);
-        float rand_f1_1 = rand.nextFloat();
-        float[] rand_f2_1 = randvec_float(2);
-        float[] rand_f3_1 = randvec_float(3);
-        float[] rand_f4_1 = randvec_float(4);
-        short rand_uc1_0 = (short)rand.nextInt(0x1 << 8);
-        short[] rand_uc2_0 = randvec_uchar(2);
-        short[] rand_uc3_0 = randvec_uchar(3);
-        short[] rand_uc4_0 = randvec_uchar(4);
-        short rand_uc1_1 = (short)rand.nextInt(0x1 << 8);
-        short[] rand_uc2_1 = randvec_uchar(2);
-        short[] rand_uc3_1 = randvec_uchar(3);
-        short[] rand_uc4_1 = randvec_uchar(4);
-        short rand_ss1_0 = (short)rand.nextInt(0x1 << 16);
-        short[] rand_ss2_0 = randvec_short(2);
-        short[] rand_ss3_0 = randvec_short(3);
-        short[] rand_ss4_0 = randvec_short(4);
-        short rand_ss1_1 = (short)rand.nextInt(0x1 << 16);
-        short[] rand_ss2_1 = randvec_short(2);
-        short[] rand_ss3_1 = randvec_short(3);
-        short[] rand_ss4_1 = randvec_short(4);
-        int rand_us1_0 = rand.nextInt(0x1 << 16);
-        int[] rand_us2_0 = randvec_ushort(2);
-        int[] rand_us3_0 = randvec_ushort(3);
-        int[] rand_us4_0 = randvec_ushort(4);
-        int rand_us1_1 = rand.nextInt(0x1 << 16);
-        int[] rand_us2_1 = randvec_ushort(2);
-        int[] rand_us3_1 = randvec_ushort(3);
-        int[] rand_us4_1 = randvec_ushort(4);
-        int rand_si1_0 = rand.nextInt();
-        int[] rand_si2_0 = randvec_int(2);
-        int[] rand_si3_0 = randvec_int(3);
-        int[] rand_si4_0 = randvec_int(4);
-        int rand_si1_1 = rand.nextInt();
-        int[] rand_si2_1 = randvec_int(2);
-        int[] rand_si3_1 = randvec_int(3);
-        int[] rand_si4_1 = randvec_int(4);
-        long rand_ui1_0 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
-        long[] rand_ui2_0 = randvec_uint(2);
-        long[] rand_ui3_0 = randvec_uint(3);
-        long[] rand_ui4_0 = randvec_uint(4);
-        long rand_ui1_1 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
-        long[] rand_ui2_1 = randvec_uint(2);
-        long[] rand_ui3_1 = randvec_uint(3);
-        long[] rand_ui4_1 = randvec_uint(4);
-        long rand_sl1_0 = rand.nextLong();
-        long[] rand_sl2_0 = randvec_long(2);
-        long[] rand_sl3_0 = randvec_long(3);
-        long[] rand_sl4_0 = randvec_long(4);
-        long rand_sl1_1 = rand.nextLong();
-        long[] rand_sl2_1 = randvec_long(2);
-        long[] rand_sl3_1 = randvec_long(3);
-        long[] rand_sl4_1 = randvec_long(4);
-        byte rand_sc1_0 = (byte)rand.nextInt(0x1 << 8);
-        byte[] rand_sc2_0 = randvec_char(2);
-        byte[] rand_sc3_0 = randvec_char(3);
-        byte[] rand_sc4_0 = randvec_char(4);
-        byte rand_sc1_1 = (byte)rand.nextInt(0x1 << 8);
-        byte[] rand_sc2_1 = randvec_char(2);
-        byte[] rand_sc3_1 = randvec_char(3);
-        byte[] rand_sc4_1 = randvec_char(4);
-        // TODO:  generate unsigned long vectors
-
-        // Set random vectors in renderscript code
-        s.set_rand_f1_0(rand_f1_0);
-        s.set_rand_f2_0(pack_f2(rand_f2_0));
-        s.set_rand_f3_0(pack_f3(rand_f3_0));
-        s.set_rand_f4_0(pack_f4(rand_f4_0));
-        s.set_rand_f1_1(rand_f1_1);
-        s.set_rand_f2_1(pack_f2(rand_f2_1));
-        s.set_rand_f3_1(pack_f3(rand_f3_1));
-        s.set_rand_f4_1(pack_f4(rand_f4_1));
-        s.set_rand_uc1_1(rand_uc1_1);
-        s.set_rand_uc2_1(pack_s2(rand_uc2_1));
-        s.set_rand_uc3_1(pack_s3(rand_uc3_1));
-        s.set_rand_uc4_1(pack_s4(rand_uc4_1));
-        s.set_rand_ss1_0(rand_ss1_0);
-        s.set_rand_ss2_0(pack_s2(rand_ss2_0));
-        s.set_rand_ss3_0(pack_s3(rand_ss3_0));
-        s.set_rand_ss4_0(pack_s4(rand_ss4_0));
-        s.set_rand_ss1_1(rand_ss1_1);
-        s.set_rand_ss2_1(pack_s2(rand_ss2_1));
-        s.set_rand_ss3_1(pack_s3(rand_ss3_1));
-        s.set_rand_ss4_1(pack_s4(rand_ss4_1));
-        s.set_rand_us1_0(rand_us1_0);
-        s.set_rand_us2_0(pack_i2(rand_us2_0));
-        s.set_rand_us3_0(pack_i3(rand_us3_0));
-        s.set_rand_us4_0(pack_i4(rand_us4_0));
-        s.set_rand_us1_1(rand_us1_1);
-        s.set_rand_us2_1(pack_i2(rand_us2_1));
-        s.set_rand_us3_1(pack_i3(rand_us3_1));
-        s.set_rand_us4_1(pack_i4(rand_us4_1));
-        s.set_rand_si1_0(rand_si1_0);
-        s.set_rand_si2_0(pack_i2(rand_si2_0));
-        s.set_rand_si3_0(pack_i3(rand_si3_0));
-        s.set_rand_si4_0(pack_i4(rand_si4_0));
-        s.set_rand_si1_1(rand_si1_1);
-        s.set_rand_si2_1(pack_i2(rand_si2_1));
-        s.set_rand_si3_1(pack_i3(rand_si3_1));
-        s.set_rand_si4_1(pack_i4(rand_si4_1));
-        s.set_rand_ui1_0(rand_ui1_0);
-        s.set_rand_ui2_0(pack_l2(rand_ui2_0));
-        s.set_rand_ui3_0(pack_l3(rand_ui3_0));
-        s.set_rand_ui4_0(pack_l4(rand_ui4_0));
-        s.set_rand_ui1_1(rand_ui1_1);
-        s.set_rand_ui2_1(pack_l2(rand_ui2_1));
-        s.set_rand_ui3_1(pack_l3(rand_ui3_1));
-        s.set_rand_ui4_1(pack_l4(rand_ui4_1));
-        s.set_rand_sl1_0(rand_sl1_0);
-        s.set_rand_sl2_0(pack_l2(rand_sl2_0));
-        s.set_rand_sl3_0(pack_l3(rand_sl3_0));
-        s.set_rand_sl4_0(pack_l4(rand_sl4_0));
-        s.set_rand_sl1_1(rand_sl1_1);
-        s.set_rand_sl2_1(pack_l2(rand_sl2_1));
-        s.set_rand_sl3_1(pack_l3(rand_sl3_1));
-        s.set_rand_sl4_1(pack_l4(rand_sl4_1));
-        s.set_rand_uc1_0(rand_uc1_0);
-        s.set_rand_uc2_0(pack_s2(rand_uc2_0));
-        s.set_rand_uc3_0(pack_s3(rand_uc3_0));
-        s.set_rand_uc4_0(pack_s4(rand_uc4_0));
-        s.set_rand_sc1_0(rand_sc1_0);
-        s.set_rand_sc2_0(pack_b2(rand_sc2_0));
-        s.set_rand_sc3_0(pack_b3(rand_sc3_0));
-        s.set_rand_sc4_0(pack_b4(rand_sc4_0));
-        s.set_rand_sc1_1(rand_sc1_1);
-        s.set_rand_sc2_1(pack_b2(rand_sc2_1));
-        s.set_rand_sc3_1(pack_b3(rand_sc3_1));
-        s.set_rand_sc4_1(pack_b4(rand_sc4_1));
-        // TODO:  set unsigned long vectors
-
-        // Set results for min
-        s.set_min_rand_f1_f1(min(rand_f1_0, rand_f1_1));
-        s.set_min_rand_f2_f2(pack_f2(min(rand_f2_0, rand_f2_1)));
-        s.set_min_rand_f3_f3(pack_f3(min(rand_f3_0, rand_f3_1)));
-        s.set_min_rand_f4_f4(pack_f4(min(rand_f4_0, rand_f4_1)));
-        s.set_min_rand_uc1_uc1(min(rand_uc1_0, rand_uc1_1));
-        s.set_min_rand_uc2_uc2(pack_s2(min(rand_uc2_0, rand_uc2_1)));
-        s.set_min_rand_uc3_uc3(pack_s3(min(rand_uc3_0, rand_uc3_1)));
-        s.set_min_rand_uc4_uc4(pack_s4(min(rand_uc4_0, rand_uc4_1)));
-        s.set_min_rand_ss1_ss1(min(rand_ss1_0, rand_ss1_1));
-        s.set_min_rand_ss2_ss2(pack_s2(min(rand_ss2_0, rand_ss2_1)));
-        s.set_min_rand_ss3_ss3(pack_s3(min(rand_ss3_0, rand_ss3_1)));
-        s.set_min_rand_ss4_ss4(pack_s4(min(rand_ss4_0, rand_ss4_1)));
-        s.set_min_rand_us1_us1(min(rand_us1_0, rand_us1_1));
-        s.set_min_rand_us2_us2(pack_i2(min(rand_us2_0, rand_us2_1)));
-        s.set_min_rand_us3_us3(pack_i3(min(rand_us3_0, rand_us3_1)));
-        s.set_min_rand_us4_us4(pack_i4(min(rand_us4_0, rand_us4_1)));
-        s.set_min_rand_si1_si1(min(rand_si1_0, rand_si1_1));
-        s.set_min_rand_si2_si2(pack_i2(min(rand_si2_0, rand_si2_1)));
-        s.set_min_rand_si3_si3(pack_i3(min(rand_si3_0, rand_si3_1)));
-        s.set_min_rand_si4_si4(pack_i4(min(rand_si4_0, rand_si4_1)));
-        s.set_min_rand_ui1_ui1(min(rand_ui1_0, rand_ui1_1));
-        s.set_min_rand_ui2_ui2(pack_l2(min(rand_ui2_0, rand_ui2_1)));
-        s.set_min_rand_ui3_ui3(pack_l3(min(rand_ui3_0, rand_ui3_1)));
-        s.set_min_rand_ui4_ui4(pack_l4(min(rand_ui4_0, rand_ui4_1)));
-        s.set_min_rand_sl1_sl1(min(rand_sl1_0, rand_sl1_1));
-        s.set_min_rand_sl2_sl2(pack_l2(min(rand_sl2_0, rand_sl2_1)));
-        s.set_min_rand_sl3_sl3(pack_l3(min(rand_sl3_0, rand_sl3_1)));
-        s.set_min_rand_sl4_sl4(pack_l4(min(rand_sl4_0, rand_sl4_1)));
-        s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
-        s.set_min_rand_sc2_sc2(pack_b2(min(rand_sc2_0, rand_sc2_1)));
-        s.set_min_rand_sc3_sc3(pack_b3(min(rand_sc3_0, rand_sc3_1)));
-        s.set_min_rand_sc4_sc4(pack_b4(min(rand_sc4_0, rand_sc4_1)));
-        // TODO:  set results for unsigned long min
-
-        // Set results for max
-        s.set_max_rand_f1_f1(max(rand_f1_0, rand_f1_1));
-        s.set_max_rand_f2_f2(pack_f2(max(rand_f2_0, rand_f2_1)));
-        s.set_max_rand_f3_f3(pack_f3(max(rand_f3_0, rand_f3_1)));
-        s.set_max_rand_f4_f4(pack_f4(max(rand_f4_0, rand_f4_1)));
-        s.set_max_rand_uc1_uc1(max(rand_uc1_0, rand_uc1_1));
-        s.set_max_rand_uc2_uc2(pack_s2(max(rand_uc2_0, rand_uc2_1)));
-        s.set_max_rand_uc3_uc3(pack_s3(max(rand_uc3_0, rand_uc3_1)));
-        s.set_max_rand_uc4_uc4(pack_s4(max(rand_uc4_0, rand_uc4_1)));
-        s.set_max_rand_ss1_ss1(max(rand_ss1_0, rand_ss1_1));
-        s.set_max_rand_ss2_ss2(pack_s2(max(rand_ss2_0, rand_ss2_1)));
-        s.set_max_rand_ss3_ss3(pack_s3(max(rand_ss3_0, rand_ss3_1)));
-        s.set_max_rand_ss4_ss4(pack_s4(max(rand_ss4_0, rand_ss4_1)));
-        s.set_max_rand_us1_us1(max(rand_us1_0, rand_us1_1));
-        s.set_max_rand_us2_us2(pack_i2(max(rand_us2_0, rand_us2_1)));
-        s.set_max_rand_us3_us3(pack_i3(max(rand_us3_0, rand_us3_1)));
-        s.set_max_rand_us4_us4(pack_i4(max(rand_us4_0, rand_us4_1)));
-        s.set_max_rand_si1_si1(max(rand_si1_0, rand_si1_1));
-        s.set_max_rand_si2_si2(pack_i2(max(rand_si2_0, rand_si2_1)));
-        s.set_max_rand_si3_si3(pack_i3(max(rand_si3_0, rand_si3_1)));
-        s.set_max_rand_si4_si4(pack_i4(max(rand_si4_0, rand_si4_1)));
-        s.set_max_rand_ui1_ui1(max(rand_ui1_0, rand_ui1_1));
-        s.set_max_rand_ui2_ui2(pack_l2(max(rand_ui2_0, rand_ui2_1)));
-        s.set_max_rand_ui3_ui3(pack_l3(max(rand_ui3_0, rand_ui3_1)));
-        s.set_max_rand_ui4_ui4(pack_l4(max(rand_ui4_0, rand_ui4_1)));
-        s.set_max_rand_sl1_sl1(max(rand_sl1_0, rand_sl1_1));
-        s.set_max_rand_sl2_sl2(pack_l2(max(rand_sl2_0, rand_sl2_1)));
-        s.set_max_rand_sl3_sl3(pack_l3(max(rand_sl3_0, rand_sl3_1)));
-        s.set_max_rand_sl4_sl4(pack_l4(max(rand_sl4_0, rand_sl4_1)));
-        s.set_max_rand_sc1_sc1(max(rand_sc1_0, rand_sc1_1));
-        s.set_max_rand_sc2_sc2(pack_b2(max(rand_sc2_0, rand_sc2_1)));
-        s.set_max_rand_sc3_sc3(pack_b3(max(rand_sc3_0, rand_sc3_1)));
-        s.set_max_rand_sc4_sc4(pack_b4(max(rand_sc4_0, rand_sc4_1)));
-
-        // TODO:  set results for unsigned long max
-
-        // Set results for fmin
-        s.set_fmin_rand_f1_f1(fmin(rand_f1_0, rand_f1_1));
-        s.set_fmin_rand_f2_f2(pack_f2(fmin(rand_f2_0, rand_f2_1)));
-        s.set_fmin_rand_f3_f3(pack_f3(fmin(rand_f3_0, rand_f3_1)));
-        s.set_fmin_rand_f4_f4(pack_f4(fmin(rand_f4_0, rand_f4_1)));
-        s.set_fmin_rand_f2_f1(pack_f2(fmin(rand_f2_0, rand_f1_1)));
-        s.set_fmin_rand_f3_f1(pack_f3(fmin(rand_f3_0, rand_f1_1)));
-        s.set_fmin_rand_f4_f1(pack_f4(fmin(rand_f4_0, rand_f1_1)));
-
-        // Set results for fmax
-        s.set_fmax_rand_f1_f1(fmax(rand_f1_0, rand_f1_1));
-        s.set_fmax_rand_f2_f2(pack_f2(fmax(rand_f2_0, rand_f2_1)));
-        s.set_fmax_rand_f3_f3(pack_f3(fmax(rand_f3_0, rand_f3_1)));
-        s.set_fmax_rand_f4_f4(pack_f4(fmax(rand_f4_0, rand_f4_1)));
-        s.set_fmax_rand_f2_f1(pack_f2(fmax(rand_f2_0, rand_f1_1)));
-        s.set_fmax_rand_f3_f1(pack_f3(fmax(rand_f3_0, rand_f1_1)));
-        s.set_fmax_rand_f4_f1(pack_f4(fmax(rand_f4_0, rand_f1_1)));
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math_agree s = new ScriptC_math_agree(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeValues(s);
-        s.invoke_math_agree_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math_conformance.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math_conformance.java
deleted file mode 100644
index 384cd13..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_math_conformance.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_math_conformance extends UnitTest {
-    private Resources mRes;
-
-    protected UT_math_conformance(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math Conformance", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math_conformance s =
-                new ScriptC_math_conformance(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_math_conformance_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_min.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_min.java
deleted file mode 100644
index cea9fe5..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_min.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_min extends UnitTest {
-    private Resources mRes;
-
-    protected UT_min(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Min (relaxed)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_min s = new ScriptC_min(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_min_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_noroot.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_noroot.java
deleted file mode 100644
index 606af4d..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_noroot.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011-2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_noroot extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_noroot(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach (no root)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_noroot s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_noroot s = new ScriptC_noroot(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_foo(A, A);
-        s.invoke_verify_foo();
-        s.invoke_noroot_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_primitives.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_primitives.java
deleted file mode 100644
index 3c663a8..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_primitives.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_primitives extends UnitTest {
-    private Resources mRes;
-
-    protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Primitives", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_primitives s) {
-        float pF = s.get_floatTest();
-        if (pF != 1.99f) {
-            return false;
-        }
-        s.set_floatTest(2.99f);
-
-        double pD = s.get_doubleTest();
-        if (pD != 2.05) {
-            return false;
-        }
-        s.set_doubleTest(3.05);
-
-        byte pC = s.get_charTest();
-        if (pC != -8) {
-            return false;
-        }
-        s.set_charTest((byte)-16);
-
-        short pS = s.get_shortTest();
-        if (pS != -16) {
-            return false;
-        }
-        s.set_shortTest((short)-32);
-
-        int pI = s.get_intTest();
-        if (pI != -32) {
-            return false;
-        }
-        s.set_intTest(-64);
-
-        long pL = s.get_longTest();
-        if (pL != 17179869184l) {
-            return false;
-        }
-        s.set_longTest(17179869185l);
-
-        long puL = s.get_ulongTest();
-        if (puL != 4611686018427387904L) {
-            return false;
-        }
-        s.set_ulongTest(4611686018427387903L);
-
-
-        long pLL = s.get_longlongTest();
-        if (pLL != 68719476736L) {
-            return false;
-        }
-        s.set_longlongTest(68719476735L);
-
-        long pu64 = s.get_uint64_tTest();
-        if (pu64 != 117179869184l) {
-            return false;
-        }
-        s.set_uint64_tTest(117179869185l);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_primitives s = new ScriptC_primitives(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            failTest();
-        } else {
-            s.invoke_primitives_test(0, 0);
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_refcount.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_refcount.java
deleted file mode 100644
index e6317d5..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_refcount.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_refcount extends UnitTest {
-    private Resources mRes;
-
-    protected UT_refcount(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Refcount", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_refcount s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 500;
-        int Y = 700;
-        typeBuilder.setX(X).setY(Y);
-        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_globalA(A);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        pRS.setMessageHandler(mRsMessage);
-        ScriptC_refcount s = new ScriptC_refcount(pRS);
-        initializeGlobals(pRS, s);
-        s.invoke_refcount_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rsdebug.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rsdebug.java
deleted file mode 100644
index 740180e..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rsdebug.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_rsdebug extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsDebug", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rsdebug s = new ScriptC_rsdebug(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rsdebug(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rstime.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rstime.java
deleted file mode 100644
index 86e35a8..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rstime.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_rstime extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTime", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstime s = new ScriptC_rstime(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.setTimeZone("America/Los_Angeles");
-        s.invoke_test_rstime(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rstypes.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rstypes.java
deleted file mode 100644
index 3245eca..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_rstypes.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_rstypes extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTypes", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstypes s = new ScriptC_rstypes(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rstypes(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_sampler.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_sampler.java
deleted file mode 100644
index d8d5a78..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_sampler.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_sampler extends UnitTest {
-    private Resources mRes;
-
-    Sampler minification;
-    Sampler magnification;
-    Sampler wrapS;
-    Sampler wrapT;
-    Sampler anisotropy;
-
-    protected UT_sampler(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Sampler", ctx);
-        mRes = res;
-    }
-
-    private Sampler.Builder getDefaultBuilder(RenderScript RS) {
-        Sampler.Builder b = new Sampler.Builder(RS);
-        b.setMinification(Sampler.Value.NEAREST);
-        b.setMagnification(Sampler.Value.NEAREST);
-        b.setWrapS(Sampler.Value.CLAMP);
-        b.setWrapT(Sampler.Value.CLAMP);
-        b.setAnisotropy(1.0f);
-        return b;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_sampler s) {
-        Sampler.Builder b = getDefaultBuilder(RS);
-        b.setMinification(Sampler.Value.LINEAR_MIP_LINEAR);
-        minification = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setMagnification(Sampler.Value.LINEAR);
-        magnification = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setWrapS(Sampler.Value.WRAP);
-        wrapS = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setWrapT(Sampler.Value.WRAP);
-        wrapT = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setAnisotropy(8.0f);
-        anisotropy = b.create();
-
-        s.set_minification(minification);
-        s.set_magnification(magnification);
-        s.set_wrapS(wrapS);
-        s.set_wrapT(wrapT);
-        s.set_anisotropy(anisotropy);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_sampler s = new ScriptC_sampler(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_sampler_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    private void testJavaSide(RenderScript RS) {
-        _RS_ASSERT("minification.getMagnification() == Sampler.Value.NEAREST",
-                    minification.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR",
-                    minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR);
-        _RS_ASSERT("minification.getWrapS() == Sampler.Value.CLAMP",
-                    minification.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("minification.getWrapT() == Sampler.Value.CLAMP",
-                    minification.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("minification.getAnisotropy() == 1.0f",
-                    minification.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("magnification.getMagnification() == Sampler.Value.LINEAR",
-                    magnification.getMagnification() == Sampler.Value.LINEAR);
-        _RS_ASSERT("magnification.getMinification() == Sampler.Value.NEAREST",
-                    magnification.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("magnification.getWrapS() == Sampler.Value.CLAMP",
-                    magnification.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("magnification.getWrapT() == Sampler.Value.CLAMP",
-                    magnification.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("magnification.getAnisotropy() == 1.0f",
-                    magnification.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("wrapS.getMagnification() == Sampler.Value.NEAREST",
-                    wrapS.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapS.getMinification() == Sampler.Value.NEAREST",
-                    wrapS.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapS.getWrapS() == Sampler.Value.WRAP",
-                    wrapS.getWrapS() == Sampler.Value.WRAP);
-        _RS_ASSERT("wrapS.getWrapT() == Sampler.Value.CLAMP",
-                    wrapS.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("wrapS.getAnisotropy() == 1.0f",
-                    wrapS.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("wrapT.getMagnification() == Sampler.Value.NEAREST",
-                    wrapT.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapT.getMinification() == Sampler.Value.NEAREST",
-                    wrapT.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapT.getWrapS() == Sampler.Value.CLAMP",
-                    wrapT.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("wrapT.getWrapT() == Sampler.Value.WRAP",
-                    wrapT.getWrapT() == Sampler.Value.WRAP);
-        _RS_ASSERT("wrapT.getAnisotropy() == 1.0f",
-                    wrapT.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("anisotropy.getMagnification() == Sampler.Value.NEAREST",
-                    anisotropy.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("anisotropy.getMinification() == Sampler.Value.NEAREST",
-                    anisotropy.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("anisotropy.getWrapS() == Sampler.Value.CLAMP",
-                    anisotropy.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("anisotropy.getWrapT() == Sampler.Value.CLAMP",
-                    anisotropy.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("anisotropy.getAnisotropy() == 1.0f",
-                    anisotropy.getAnisotropy() == 8.0f);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testScriptSide(pRS);
-        testJavaSide(pRS);
-        passTest();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_struct.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_struct.java
deleted file mode 100644
index 43bbaf7..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_struct.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_struct extends UnitTest {
-    private Resources mRes;
-
-    protected UT_struct(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Struct", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_struct s = new ScriptC_struct(pRS);
-        pRS.setMessageHandler(mRsMessage);
-
-        ScriptField_Point2 p = new ScriptField_Point2(pRS, 1);
-        ScriptField_Point2.Item i = new ScriptField_Point2.Item();
-        int val = 100;
-        i.x = val;
-        i.y = val;
-        p.set(i, 0, true);
-        s.bind_point2(p);
-        s.invoke_struct_test(val);
-        pRS.finish();
-        waitForMessage();
-
-        val = 200;
-        p.set_x(0, val, true);
-        p.set_y(0, val, true);
-        s.invoke_struct_test(val);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_unsigned.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_unsigned.java
deleted file mode 100644
index 0e16240..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_unsigned.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_unsigned extends UnitTest {
-    private Resources mRes;
-
-    protected UT_unsigned(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Unsigned", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_unsigned s) {
-        short pUC = s.get_uc();
-        if (pUC != 5) {
-            return false;
-        }
-        s.set_uc((short)129);
-
-        long pUI = s.get_ui();
-        if (pUI != 37) {
-            return false;
-        }
-        s.set_ui(0x7fffffff);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_unsigned s = new ScriptC_unsigned(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            failTest();
-        } else {
-            s.invoke_unsigned_test();
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_vector.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_vector.java
deleted file mode 100644
index 6ba822e..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UT_vector.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.support.v8.renderscript.*;
-
-public class UT_vector extends UnitTest {
-    private Resources mRes;
-
-    protected UT_vector(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Vector", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_vector s) {
-        Float2 F2 = s.get_f2();
-        if (F2.x != 1.0f || F2.y != 2.0f) {
-            return false;
-        }
-        F2.x = 2.99f;
-        F2.y = 3.99f;
-        s.set_f2(F2);
-
-        Float3 F3 = s.get_f3();
-        if (F3.x != 1.0f || F3.y != 2.0f || F3.z != 3.0f) {
-            return false;
-        }
-        F3.x = 2.99f;
-        F3.y = 3.99f;
-        F3.z = 4.99f;
-        s.set_f3(F3);
-
-        Float4 F4 = s.get_f4();
-        if (F4.x != 1.0f || F4.y != 2.0f || F4.z != 3.0f || F4.w != 4.0f) {
-            return false;
-        }
-        F4.x = 2.99f;
-        F4.y = 3.99f;
-        F4.z = 4.99f;
-        F4.w = 5.99f;
-        s.set_f4(F4);
-
-        Double2 D2 = s.get_d2();
-        if (D2.x != 1.0 || D2.y != 2.0) {
-            return false;
-        }
-        D2.x = 2.99;
-        D2.y = 3.99;
-        s.set_d2(D2);
-
-        Double3 D3 = s.get_d3();
-        if (D3.x != 1.0 || D3.y != 2.0 || D3.z != 3.0) {
-            return false;
-        }
-        D3.x = 2.99;
-        D3.y = 3.99;
-        D3.z = 4.99;
-        s.set_d3(D3);
-
-        Double4 D4 = s.get_d4();
-        if (D4.x != 1.0 || D4.y != 2.0 || D4.z != 3.0 || D4.w != 4.0) {
-            return false;
-        }
-        D4.x = 2.99;
-        D4.y = 3.99;
-        D4.z = 4.99;
-        D4.w = 5.99;
-        s.set_d4(D4);
-
-        Byte2 B2 = s.get_i8_2();
-        if (B2.x != 1 || B2.y != 2) {
-            return false;
-        }
-        B2.x = 2;
-        B2.y = 3;
-        s.set_i8_2(B2);
-
-        Byte3 B3 = s.get_i8_3();
-        if (B3.x != 1 || B3.y != 2 || B3.z != 3) {
-            return false;
-        }
-        B3.x = 2;
-        B3.y = 3;
-        B3.z = 4;
-        s.set_i8_3(B3);
-
-        Byte4 B4 = s.get_i8_4();
-        if (B4.x != 1 || B4.y != 2 || B4.z != 3 || B4.w != 4) {
-            return false;
-        }
-        B4.x = 2;
-        B4.y = 3;
-        B4.z = 4;
-        B4.w = 5;
-        s.set_i8_4(B4);
-
-        Short2 S2 = s.get_u8_2();
-        if (S2.x != 1 || S2.y != 2) {
-            return false;
-        }
-        S2.x = 2;
-        S2.y = 3;
-        s.set_u8_2(S2);
-
-        Short3 S3 = s.get_u8_3();
-        if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
-            return false;
-        }
-        S3.x = 2;
-        S3.y = 3;
-        S3.z = 4;
-        s.set_u8_3(S3);
-
-        Short4 S4 = s.get_u8_4();
-        if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
-            return false;
-        }
-        S4.x = 2;
-        S4.y = 3;
-        S4.z = 4;
-        S4.w = 5;
-        s.set_u8_4(S4);
-
-        S2 = s.get_i16_2();
-        if (S2.x != 1 || S2.y != 2) {
-            return false;
-        }
-        S2.x = 2;
-        S2.y = 3;
-        s.set_i16_2(S2);
-
-        S3 = s.get_i16_3();
-        if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
-            return false;
-        }
-        S3.x = 2;
-        S3.y = 3;
-        S3.z = 4;
-        s.set_i16_3(S3);
-
-        S4 = s.get_i16_4();
-        if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
-            return false;
-        }
-        S4.x = 2;
-        S4.y = 3;
-        S4.z = 4;
-        S4.w = 5;
-        s.set_i16_4(S4);
-
-        Int2 I2 = s.get_u16_2();
-        if (I2.x != 1 || I2.y != 2) {
-            return false;
-        }
-        I2.x = 2;
-        I2.y = 3;
-        s.set_u16_2(I2);
-
-        Int3 I3 = s.get_u16_3();
-        if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
-            return false;
-        }
-        I3.x = 2;
-        I3.y = 3;
-        I3.z = 4;
-        s.set_u16_3(I3);
-
-        Int4 I4 = s.get_u16_4();
-        if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
-            return false;
-        }
-        I4.x = 2;
-        I4.y = 3;
-        I4.z = 4;
-        I4.w = 5;
-        s.set_u16_4(I4);
-
-        I2 = s.get_i32_2();
-        if (I2.x != 1 || I2.y != 2) {
-            return false;
-        }
-        I2.x = 2;
-        I2.y = 3;
-        s.set_i32_2(I2);
-
-        I3 = s.get_i32_3();
-        if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
-            return false;
-        }
-        I3.x = 2;
-        I3.y = 3;
-        I3.z = 4;
-        s.set_i32_3(I3);
-
-        I4 = s.get_i32_4();
-        if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
-            return false;
-        }
-        I4.x = 2;
-        I4.y = 3;
-        I4.z = 4;
-        I4.w = 5;
-        s.set_i32_4(I4);
-
-        Long2 L2 = s.get_u32_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_u32_2(L2);
-
-        Long3 L3 = s.get_u32_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_u32_3(L3);
-
-        Long4 L4 = s.get_u32_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_u32_4(L4);
-
-        L2 = s.get_i64_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_i64_2(L2);
-
-        L3 = s.get_i64_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_i64_3(L3);
-
-        L4 = s.get_i64_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_i64_4(L4);
-
-        L2 = s.get_u64_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_u64_2(L2);
-
-        L3 = s.get_u64_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_u64_3(L3);
-
-        L4 = s.get_u64_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_u64_4(L4);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_vector s = new ScriptC_vector(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            failTest();
-        } else {
-            s.invoke_vector_test();
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UnitTest.java b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UnitTest.java
deleted file mode 100644
index 01abf2f..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/UnitTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2013 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.rs.test_compat;
-import android.content.Context;
-import android.util.Log;
-import android.support.v8.renderscript.RenderScript.RSMessageHandler;
-
-public class UnitTest extends Thread {
-    public String name;
-    private int result;
-    private ScriptField_ListAllocs_s.Item mItem;
-    private RSTestCore mRSTC;
-    private boolean msgHandled;
-    protected Context mCtx;
-
-    /* These constants must match those in shared.rsh */
-    public static final int RS_MSG_TEST_PASSED = 100;
-    public static final int RS_MSG_TEST_FAILED = 101;
-
-    private static int numTests = 0;
-    public int testID;
-
-    protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
-        super();
-        mRSTC = rstc;
-        name = n;
-        msgHandled = false;
-        mCtx = ctx;
-        result = initResult;
-        testID = numTests++;
-    }
-
-    protected UnitTest(RSTestCore rstc, String n, Context ctx) {
-        this(rstc, n, 0, ctx);
-    }
-
-    protected UnitTest(RSTestCore rstc, Context ctx) {
-        this (rstc, "<Unknown>", ctx);
-    }
-
-    protected UnitTest(Context ctx) {
-        this (null, ctx);
-    }
-
-    protected void _RS_ASSERT(String message, boolean b) {
-        if(b == false) {
-            Log.e(name, message + " FAILED");
-            failTest();
-        }
-    }
-
-    private void updateUI() {
-        if (mItem != null) {
-            mItem.result = result;
-            msgHandled = true;
-            try {
-                mRSTC.refreshTestResults();
-            }
-            catch (IllegalStateException e) {
-                /* Ignore the case where our message receiver has been
-                   disconnected. This happens when we leave the application
-                   before it finishes running all of the unit tests. */
-            }
-        }
-    }
-
-    protected RSMessageHandler mRsMessage = new RSMessageHandler() {
-        public void run() {
-            if (result == 0) {
-                switch (mID) {
-                    case RS_MSG_TEST_PASSED:
-                        result = 1;
-                        break;
-                    case RS_MSG_TEST_FAILED:
-                        result = -1;
-                        break;
-                    default:
-                        RSTest.log("Unit test got unexpected message");
-                        return;
-                }
-            }
-
-            updateUI();
-        }
-    };
-
-    public void waitForMessage() {
-        while (!msgHandled) {
-            yield();
-        }
-    }
-
-    public int getResult() {
-        return result;
-    }
-
-    public void failTest() {
-        result = -1;
-        updateUI();
-    }
-
-    public void passTest() {
-        if (result != -1) {
-            result = 1;
-        }
-        updateUI();
-    }
-
-    public String toString() {
-        String out = name;
-        if (result == 1) {
-            out += " - PASSED";
-        }
-        else if (result == -1) {
-            out += " - FAILED";
-        }
-        return out;
-    }
-
-    public void setItem(ScriptField_ListAllocs_s.Item item) {
-        mItem = item;
-    }
-
-    public void run() {
-        /* This method needs to be implemented for each subclass */
-        if (mRSTC != null) {
-            mRSTC.refreshTestResults();
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/alloc.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/alloc.rs
deleted file mode 100644
index 1b5e2ac..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/alloc.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "shared.rsh"
-
-int *a;
-int dimX;
-int dimY;
-int dimZ;
-
-rs_allocation aRaw;
-rs_allocation aFaces;
-rs_allocation aLOD;
-rs_allocation aFacesLOD;
-
-void root(int *o, uint32_t x, uint32_t y) {
-    *o = x + y * dimX;
-}
-
-static bool test_alloc_dims() {
-    bool failed = false;
-    int i, j;
-
-    _RS_ASSERT(rsAllocationGetDimX(aRaw) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aRaw) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aRaw) == dimZ);
-
-    // Test 2D addressing
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            rsDebug("Verifying ", i + j * dimX);
-            const void *p = rsGetElementAt(aRaw, i, j);
-            int val = *(const int *)p;
-            _RS_ASSERT(val == (i + j * dimX));
-        }
-    }
-
-    // Test 1D addressing
-    for (i = 0; i < dimX; i++) {
-        rsDebug("Verifying ", i);
-        const void *p = rsGetElementAt(aRaw, i);
-        int val = *(const int *)p;
-        _RS_ASSERT(val == i);
-    }
-
-    // Test 3D addressing
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            rsDebug("Verifying ", i + j * dimX);
-            const void *p = rsGetElementAt(aRaw, i, j, 0);
-            int val = *(const int *)p;
-            _RS_ASSERT(val == (i + j * dimX));
-        }
-    }
-
-    _RS_ASSERT(rsAllocationGetDimX(aFaces) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aFaces) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aFaces) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aFaces) != 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aFaces) == 0);
-
-    _RS_ASSERT(rsAllocationGetDimX(aLOD) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aLOD) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aLOD) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aLOD) == 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aLOD) != 0);
-
-    _RS_ASSERT(rsAllocationGetDimX(aFacesLOD) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aFacesLOD) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aFacesLOD) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aFacesLOD) != 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aFacesLOD) != 0);
-
-    if (failed) {
-        rsDebug("test_alloc_dims FAILED", 0);
-    }
-    else {
-        rsDebug("test_alloc_dims PASSED", 0);
-    }
-
-    return failed;
-}
-
-void alloc_test() {
-    bool failed = false;
-    failed |= test_alloc_dims();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/array_alloc.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/array_alloc.rs
deleted file mode 100644
index 74ffdb1..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/array_alloc.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "shared.rsh"
-
-const int dimX = 20;
-rs_allocation a[dimX];
-
-void array_alloc_test() {
-    bool failed = false;
-
-    for (int i = 0; i < dimX; i++) {
-        rsDebug("i: ", i);
-        _RS_ASSERT(rsAllocationGetDimX(a[i]) == 1);
-    }
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/array_init.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/array_init.rs
deleted file mode 100644
index 842249a..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/array_init.rs
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "shared.rsh"
-
-// Testing constant array initialization
-float fa[4] = {1.0, 9.9999f};
-double da[2] = {7.0, 8.88888};
-char ca[4] = {'a', 7, 'b', 'c'};
-short sa[4] = {1, 1, 2, 3};
-int ia[4] = {5, 8};
-long la[2] = {13, 21};
-long long lla[4] = {34};
-bool ba[3] = {true, false};
-
-void array_init_test() {
-    bool failed = false;
-
-    _RS_ASSERT(fa[0] == 1.0);
-    _RS_ASSERT(fa[1] == 9.9999f);
-    _RS_ASSERT(fa[2] == 0);
-    _RS_ASSERT(fa[3] == 0);
-
-    _RS_ASSERT(da[0] == 7.0);
-    _RS_ASSERT(da[1] == 8.88888);
-
-    _RS_ASSERT(ca[0] == 'a');
-    _RS_ASSERT(ca[1] == 7);
-    _RS_ASSERT(ca[2] == 'b');
-    _RS_ASSERT(ca[3] == 'c');
-
-    _RS_ASSERT(sa[0] == 1);
-    _RS_ASSERT(sa[1] == 1);
-    _RS_ASSERT(sa[2] == 2);
-    _RS_ASSERT(sa[3] == 3);
-
-    _RS_ASSERT(ia[0] == 5);
-    _RS_ASSERT(ia[1] == 8);
-    _RS_ASSERT(ia[2] == 0);
-    _RS_ASSERT(ia[3] == 0);
-
-    _RS_ASSERT(la[0] == 13);
-    _RS_ASSERT(la[1] == 21);
-
-    _RS_ASSERT(lla[0] == 34);
-    _RS_ASSERT(lla[1] == 0);
-    _RS_ASSERT(lla[2] == 0);
-    _RS_ASSERT(lla[3] == 0);
-
-    _RS_ASSERT(ba[0] == true);
-    _RS_ASSERT(ba[1] == false);
-    _RS_ASSERT(ba[2] == false);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/atomic.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/atomic.rs
deleted file mode 100644
index f0a5041..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/atomic.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "shared.rsh"
-
-// Testing atomic operations
-static bool testUMax(uint32_t dst, uint32_t src) {
-    bool failed = false;
-    uint32_t old = dst;
-    uint32_t expect = (dst > src ? dst : src);
-    uint32_t ret = rsAtomicMax(&dst, src);
-    _RS_ASSERT(old == ret);
-    _RS_ASSERT(dst == expect);
-    return failed;
-}
-
-static bool testUMin(uint32_t dst, uint32_t src) {
-    bool failed = false;
-    uint32_t old = dst;
-    uint32_t expect = (dst < src ? dst : src);
-    uint32_t ret = rsAtomicMin(&dst, src);
-    _RS_ASSERT(old == ret);
-    _RS_ASSERT(dst == expect);
-    return failed;
-}
-
-static bool testUCas(uint32_t dst, uint32_t cmp, uint32_t swp) {
-    bool failed = false;
-    uint32_t old = dst;
-    uint32_t expect = (dst == cmp ? swp : dst);
-    uint32_t ret = rsAtomicCas(&dst, cmp, swp);
-    _RS_ASSERT(old == ret);
-    _RS_ASSERT(dst == expect);
-    return failed;
-}
-
-static bool test_atomics() {
-    bool failed = false;
-
-    failed |= testUMax(5, 6);
-    failed |= testUMax(6, 5);
-    failed |= testUMax(5, 0xf0000006);
-    failed |= testUMax(0xf0000006, 5);
-
-    failed |= testUMin(5, 6);
-    failed |= testUMin(6, 5);
-    failed |= testUMin(5, 0xf0000006);
-    failed |= testUMin(0xf0000006, 5);
-
-    failed |= testUCas(4, 4, 5);
-    failed |= testUCas(4, 5, 5);
-    failed |= testUCas(5, 5, 4);
-    failed |= testUCas(5, 4, 4);
-    failed |= testUCas(0xf0000004, 0xf0000004, 0xf0000005);
-    failed |= testUCas(0xf0000004, 0xf0000005, 0xf0000005);
-    failed |= testUCas(0xf0000005, 0xf0000005, 0xf0000004);
-    failed |= testUCas(0xf0000005, 0xf0000004, 0xf0000004);
-
-    if (failed) {
-        rsDebug("test_atomics FAILED", 0);
-    }
-    else {
-        rsDebug("test_atomics PASSED", 0);
-    }
-
-    return failed;
-}
-
-void atomic_test() {
-    bool failed = false;
-    failed |= test_atomics();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/bug_char.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/bug_char.rs
deleted file mode 100644
index dcd7b72..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/bug_char.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "shared.rsh"
-
-char rand_sc1_0, rand_sc1_1;
-char2 rand_sc2_0, rand_sc2_1;
-
-char min_rand_sc1_sc1;
-char2 min_rand_sc2_sc2;
-
-static bool test_bug_char() {
-    bool failed = false;
-
-    rsDebug("rand_sc2_0.x: ", rand_sc2_0.x);
-    rsDebug("rand_sc2_0.y: ", rand_sc2_0.y);
-    rsDebug("rand_sc2_1.x: ", rand_sc2_1.x);
-    rsDebug("rand_sc2_1.y: ", rand_sc2_1.y);
-    char temp_sc1;
-    char2 temp_sc2;
-
-    temp_sc1 = min( rand_sc1_0, rand_sc1_1 );
-    if (temp_sc1 != min_rand_sc1_sc1) {
-        rsDebug("temp_sc1", temp_sc1);
-        failed = true;
-    }
-    rsDebug("broken", 'y');
-
-    temp_sc2 = min( rand_sc2_0, rand_sc2_1 );
-    if (temp_sc2.x != min_rand_sc2_sc2.x
-            || temp_sc2.y != min_rand_sc2_sc2.y) {
-        failed = true;
-    }
-
-
-    return failed;
-}
-
-void bug_char_test() {
-    bool failed = false;
-    failed |= test_bug_char();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/clamp.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/clamp.rs
deleted file mode 100644
index 28b00bd..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/clamp.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "shared.rsh"
-
-static bool test_clamp_vector() {
-    bool failed = false;
-
-    float2 src2 = { 2.0f, 2.0f};
-    float2 min2 = { 0.5f, -3.0f};
-    float2 max2 = { 1.0f, 9.0f};
-
-    float2 res2 = clamp(src2, min2, max2);
-    _RS_ASSERT(res2.x == 1.0f);
-    _RS_ASSERT(res2.y == 2.0f);
-
-
-    float3 src3 = { 2.0f, 2.0f, 1.0f};
-    float3 min3 = { 0.5f, -3.0f, 3.0f};
-    float3 max3 = { 1.0f, 9.0f, 4.0f};
-
-    float3 res3 = clamp(src3, min3, max3);
-    _RS_ASSERT(res3.x == 1.0f);
-    _RS_ASSERT(res3.y == 2.0f);
-    _RS_ASSERT(res3.z == 3.0f);
-
-
-    float4 src4 = { 2.0f, 2.0f, 1.0f, 4.0f };
-    float4 min4 = { 0.5f, -3.0f, 3.0f, 4.0f };
-    float4 max4 = { 1.0f, 9.0f, 4.0f, 4.0f };
-
-    float4 res4 = clamp(src4, min4, max4);
-    _RS_ASSERT(res4.x == 1.0f);
-    _RS_ASSERT(res4.y == 2.0f);
-    _RS_ASSERT(res4.z == 3.0f);
-    _RS_ASSERT(res4.w == 4.0f);
-
-    if (failed) {
-        rsDebug("test_clamp_vector FAILED", 0);
-    }
-    else {
-        rsDebug("test_clamp_vector PASSED", 0);
-    }
-
-    return failed;
-}
-
-void clamp_test() {
-    bool failed = false;
-    failed |= test_clamp_vector();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/clamp_relaxed.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/clamp_relaxed.rs
deleted file mode 100644
index 71c65ae..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/clamp_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "clamp.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/constant.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/constant.rs
deleted file mode 100644
index 732eaef..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/constant.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "shared.rsh"
-
-const float floatTest = 1.99f;
-const double doubleTest = 2.05;
-const char charTest = -8;
-const short shortTest = -16;
-const int intTest = -32;
-const long longTest = 17179869184l; // 1 << 34
-const long long longlongTest = 68719476736l; // 1 << 36
-
-const uchar ucharTest = 8;
-const ushort ushortTest = 16;
-const uint uintTest = 32;
-const ulong ulongTest = 4611686018427387904L;
-const int64_t int64_tTest = -17179869184l; // - 1 << 34
-const uint64_t uint64_tTest = 117179869184l;
-
-const bool boolTest = true;
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/convert.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/convert.rs
deleted file mode 100644
index e314f2b..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/convert.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "shared.rsh"
-
-float4 f4 = { 2.0f, 4.0f, 6.0f, 8.0f };
-
-char4 i8_4 = { -1, -2, -3, 4 };
-
-static bool test_convert() {
-    bool failed = false;
-
-    f4 = convert_float4(i8_4);
-    _RS_ASSERT(f4.x == -1.0f);
-    _RS_ASSERT(f4.y == -2.0f);
-    _RS_ASSERT(f4.z == -3.0f);
-    _RS_ASSERT(f4.w == 4.0f);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-void convert_test() {
-    bool failed = false;
-    failed |= test_convert();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/convert_relaxed.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/convert_relaxed.rs
deleted file mode 100644
index 81abb9b..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/convert_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "convert.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/copy_test.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/copy_test.rs
deleted file mode 100644
index f4243eb..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/copy_test.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "shared.rsh"
-
-void sendResult(bool pass) {
-    if (pass) {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-}
-
-
-float2 __attribute((kernel)) copyFloat2(float2 i) {
-    return i;
-}
-
-float3 __attribute((kernel)) copyFloat3(float3 i) {
-    return i;
-}
-
-float4 __attribute((kernel)) copyFloat4(float4 i) {
-    return i;
-}
-
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/element.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/element.rs
deleted file mode 100644
index 1f24775..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/element.rs
+++ /dev/null
@@ -1,156 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element simpleElem;
-rs_element complexElem;
-typedef struct ComplexStruct {
-    float subElem0;
-    float subElem1;
-    int subElem2;
-    float arrayElem0[2];
-    int arrayElem1[5];
-    char subElem3;
-    float subElem4;
-    float2 subElem5;
-    float3 subElem6;
-    float4 subElem_7;
-} ComplexStruct_t;
-
-ComplexStruct_t *complexStruct;
-
-static const char *subElemNames[] = {
-    "subElem0",
-    "subElem1",
-    "subElem2",
-    "arrayElem0",
-    "arrayElem1",
-    "subElem3",
-    "subElem4",
-    "subElem5",
-    "subElem6",
-    "subElem_7",
-};
-
-static uint32_t subElemNamesSizes[] = {
-    8,
-    8,
-    8,
-    10,
-    10,
-    8,
-    8,
-    8,
-    8,
-    9,
-};
-
-static uint32_t subElemArraySizes[] = {
-    1,
-    1,
-    1,
-    2,
-    5,
-    1,
-    1,
-    1,
-    1,
-    1,
-};
-
-static void resetStruct() {
-    uint8_t *bytePtr = (uint8_t*)complexStruct;
-    uint32_t sizeOfStruct = sizeof(*complexStruct);
-    for(uint32_t i = 0; i < sizeOfStruct; i ++) {
-        bytePtr[i] = 0;
-    }
-}
-
-static bool equals(const char *name0, const char * name1, uint32_t len) {
-    for (uint32_t i = 0; i < len; i ++) {
-        if (name0[i] != name1[i]) {
-            return false;
-        }
-    }
-    return true;
-}
-
-static bool test_element_getters() {
-    bool failed = false;
-
-    uint32_t subElemOffsets[10];
-    uint32_t index = 0;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem0   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem1   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem2   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->arrayElem0 - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->arrayElem1 - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem3   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem4   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem5   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem6   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem_7  - (uint32_t)complexStruct;
-
-    uint32_t subElemCount = rsElementGetSubElementCount(simpleElem);
-    _RS_ASSERT(subElemCount == 0);
-    _RS_ASSERT(rsElementGetDataType(simpleElem) == RS_TYPE_FLOAT_32);
-    _RS_ASSERT(rsElementGetVectorSize(simpleElem) == 3);
-
-    subElemCount = rsElementGetSubElementCount(complexElem);
-    _RS_ASSERT(subElemCount == 10);
-    _RS_ASSERT(rsElementGetDataType(complexElem) == RS_TYPE_NONE);
-    _RS_ASSERT(rsElementGetVectorSize(complexElem) == 1);
-    _RS_ASSERT(rsElementGetBytesSize(complexElem) == sizeof(*complexStruct));
-
-    char buffer[64];
-    for (uint32_t i = 0; i < subElemCount; i ++) {
-        rs_element subElem = rsElementGetSubElement(complexElem, i);
-        _RS_ASSERT(rsIsObject(subElem));
-
-        _RS_ASSERT(rsElementGetSubElementNameLength(complexElem, i) == subElemNamesSizes[i] + 1);
-
-        uint32_t written = rsElementGetSubElementName(complexElem, i, buffer, 64);
-        _RS_ASSERT(written == subElemNamesSizes[i]);
-        _RS_ASSERT(equals(buffer, subElemNames[i], written));
-
-        _RS_ASSERT(rsElementGetSubElementArraySize(complexElem, i) == subElemArraySizes[i]);
-        _RS_ASSERT(rsElementGetSubElementOffsetBytes(complexElem, i) == subElemOffsets[i]);
-    }
-
-    // Tests error checking
-    rs_element subElem = rsElementGetSubElement(complexElem, subElemCount);
-    _RS_ASSERT(!rsIsObject(subElem));
-
-    _RS_ASSERT(rsElementGetSubElementNameLength(complexElem, subElemCount) == 0);
-
-    _RS_ASSERT(rsElementGetSubElementName(complexElem, subElemCount, buffer, 64) == 0);
-    _RS_ASSERT(rsElementGetSubElementName(complexElem, 0, NULL, 64) == 0);
-    _RS_ASSERT(rsElementGetSubElementName(complexElem, 0, buffer, 0) == 0);
-    uint32_t written = rsElementGetSubElementName(complexElem, 0, buffer, 5);
-    _RS_ASSERT(written == 4);
-    _RS_ASSERT(buffer[4] == '\0');
-
-    _RS_ASSERT(rsElementGetSubElementArraySize(complexElem, subElemCount) == 0);
-    _RS_ASSERT(rsElementGetSubElementOffsetBytes(complexElem, subElemCount) == 0);
-
-    if (failed) {
-        rsDebug("test_element_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_element_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void element_test() {
-    bool failed = false;
-    failed |= test_element_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/foreach.rs
deleted file mode 100644
index 08e6bed..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/foreach.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "shared.rsh"
-
-rs_allocation aRaw;
-int dimX;
-int dimY;
-static bool failed = false;
-
-void root(int *out, uint32_t x, uint32_t y) {
-    *out = x + y * dimX;
-}
-
-void foo(const int *in, int *out, uint32_t x, uint32_t y) {
-    _RS_ASSERT(*in == (x + y * dimX));
-    *out = 99 + x + y * dimX;
-    _RS_ASSERT(*out == (99 + x + y * dimX));
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-static bool test_foo_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (99 + i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_foo_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_foo_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void verify_foo() {
-    failed |= test_foo_output();
-}
-
-void foreach_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/foreach_bounds.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/foreach_bounds.rs
deleted file mode 100644
index 89df090..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/foreach_bounds.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "shared.rsh"
-
-int dimX;
-int dimY;
-int xStart = 0;
-int xEnd = 0;
-int yStart = 0;
-int yEnd = 0;
-
-rs_script s;
-rs_allocation aRaw;
-rs_allocation ain;
-rs_allocation aout;
-
-void root(int *out, uint32_t x, uint32_t y) {
-    *out = x + y * dimX;
-}
-
-int __attribute__((kernel)) zero() {
-    return 0;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            rsDebug("i: ", i);
-            rsDebug("j: ", j);
-            rsDebug("a[j][i]: ", v);
-            if (i < xStart || i >= xEnd || j < yStart || j >= yEnd) {
-                _RS_ASSERT(v == 0);
-            } else {
-                _RS_ASSERT(v == (i + j * dimX));
-            }
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void foreach_bounds_test() {
-    static bool failed = false;
-
-    rs_script_call_t rssc = {0};
-    rssc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
-    rssc.xStart = xStart;
-    rssc.xEnd = xEnd;
-    rssc.yStart = yStart;
-    rssc.yEnd = yEnd;
-
-    rsForEach(s, ain, aout, NULL, 0, &rssc);
-
-    failed |= test_root_output();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs
deleted file mode 100644
index b6f2b2a6..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "shared.rsh"
-
-const int TEST_COUNT = 1;
-
-static float data_f1[1025];
-static float4 data_f4[1025];
-
-static void test_mad4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = (data_f4[i] * 0.02f +
-                          data_f4[i+1] * 0.04f +
-                          data_f4[i+2] * 0.05f +
-                          data_f4[i+3] * 0.1f +
-                          data_f4[i+4] * 0.2f +
-                          data_f4[i+5] * 0.2f +
-                          data_f4[i+6] * 0.1f +
-                          data_f4[i+7] * 0.05f +
-                          data_f4[i+8] * 0.04f +
-                          data_f4[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad4 M ops", 1000.f / time);
-}
-
-static void test_mad(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = (data_f1[i] * 0.02f +
-                          data_f1[i+1] * 0.04f +
-                          data_f1[i+2] * 0.05f +
-                          data_f1[i+3] * 0.1f +
-                          data_f1[i+4] * 0.2f +
-                          data_f1[i+5] * 0.2f +
-                          data_f1[i+6] * 0.1f +
-                          data_f1[i+7] * 0.05f +
-                          data_f1[i+8] * 0.04f +
-                          data_f1[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad M ops", 1000.f / time);
-}
-
-static void test_norm(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = normalize(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_norm M ops", 10.f / time);
-}
-
-static void test_sincos4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10 / 4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos4 M ops", 10.f / time);
-}
-
-static void test_sincos(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos M ops", 10.f / time);
-}
-
-static void test_clamp(uint32_t index) {
-    start();
-
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp M ops", 100.f / time);
-
-    start();
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            if (data_f1[i] < -1.f) data_f1[i] = -1.f;
-            if (data_f1[i] > -1.f) data_f1[i] = 1.f;
-        }
-    }
-
-    time = end(index);
-    rsDebug("fp_clamp ref M ops", 100.f / time);
-}
-
-static void test_clamp4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100 /4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp4 M ops", 100.f / time);
-}
-
-void fp_mad_test(uint32_t index, int test_num) {
-    int x;
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f;
-        data_f4[x].x = (x & 0xf) * 0.1f;
-        data_f4[x].y = (x & 0xf0) * 0.1f;
-        data_f4[x].z = (x & 0x33) * 0.1f;
-        data_f4[x].w = (x & 0x77) * 0.1f;
-    }
-
-    test_mad4(index);
-    test_mad(index);
-
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
-        data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
-        data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
-    }
-
-    test_norm(index);
-    test_sincos4(index);
-    test_sincos(index);
-    test_clamp4(index);
-    test_clamp(index);
-
-    // TODO Actually verify test result accuracy
-    rsDebug("fp_mad_test PASSED", 0);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/int4.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/int4.rs
deleted file mode 100644
index c791cab..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/int4.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "shared.rsh"
-#pragma rs_fp_relaxed
-
-uchar4 u4 = 4;
-int4 gi4 = {2, 2, 2, 2};
-
-void int4_test() {
-    bool failed = false;
-    int4 i4 = {u4.x, u4.y, u4.z, u4.w};
-    i4 *= gi4;
-
-    rsDebug("i4.x", i4.x);
-    rsDebug("i4.y", i4.y);
-    rsDebug("i4.z", i4.z);
-    rsDebug("i4.w", i4.w);
-
-    _RS_ASSERT(i4.x == 8);
-    _RS_ASSERT(i4.y == 8);
-    _RS_ASSERT(i4.z == 8);
-    _RS_ASSERT(i4.w == 8);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel.rs
deleted file mode 100644
index d6c9df3..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "shared.rsh"
-
-int *ain;
-int *aout;
-int dimX;
-static bool failed = false;
-
-void init_vars(int *out) {
-    *out = 7;
-}
-
-
-int __attribute__((kernel)) root(int ain, uint32_t x) {
-    _RS_ASSERT(ain == 7);
-    return ain + x;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i;
-
-    for (i = 0; i < dimX; i++) {
-        _RS_ASSERT(aout[i] == (i + ain[i]));
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void kernel_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel_struct.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel_struct.rs
deleted file mode 100644
index 62c30ae..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/kernel_struct.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "shared.rsh"
-
-struct simpleStruct {
-    int i1;
-    char ignored1;
-    float f1;
-    int i2;
-    char ignored2;
-    float f2;
-};
-
-struct simpleStruct *ain;
-struct simpleStruct *aout;
-int dimX;
-static bool failed = false;
-
-void init_vars(struct simpleStruct *out, uint32_t x) {
-    out->i1 = 0;
-    out->f1 = 0.f;
-    out->i2 = 1;
-    out->f2 = 1.0f;
-}
-
-struct simpleStruct __attribute__((kernel))
-        root(struct simpleStruct in, uint32_t x) {
-    struct simpleStruct s;
-    s.i1 = in.i1 + x;
-    s.f1 = in.f1 + x;
-    s.i2 = in.i2 + x;
-    s.f2 = in.f2 + x;
-    return s;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i;
-
-    for (i = 0; i < dimX; i++) {
-        _RS_ASSERT(aout[i].i1 == (i + ain[i].i1));
-        _RS_ASSERT(aout[i].f1 == (i + ain[i].f1));
-        _RS_ASSERT(aout[i].i2 == (i + ain[i].i2));
-        _RS_ASSERT(aout[i].f2 == (i + ain[i].f2));
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void kernel_struct_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math.rs
deleted file mode 100644
index aae29a4..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math.rs
+++ /dev/null
@@ -1,436 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define DECL_INT(prefix)            \
-volatile char prefix##_c_1 = 1;     \
-volatile char2 prefix##_c_2 = 1;    \
-volatile char3 prefix##_c_3 = 1;    \
-volatile char4 prefix##_c_4 = 1;    \
-volatile uchar prefix##_uc_1 = 1;   \
-volatile uchar2 prefix##_uc_2 = 1;  \
-volatile uchar3 prefix##_uc_3 = 1;  \
-volatile uchar4 prefix##_uc_4 = 1;  \
-volatile short prefix##_s_1 = 1;    \
-volatile short2 prefix##_s_2 = 1;   \
-volatile short3 prefix##_s_3 = 1;   \
-volatile short4 prefix##_s_4 = 1;   \
-volatile ushort prefix##_us_1 = 1;  \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1;      \
-volatile int2 prefix##_i_2 = 1;     \
-volatile int3 prefix##_i_3 = 1;     \
-volatile int4 prefix##_i_4 = 1;     \
-volatile uint prefix##_ui_1 = 1;    \
-volatile uint2 prefix##_ui_2 = 1;   \
-volatile uint3 prefix##_ui_3 = 1;   \
-volatile uint4 prefix##_ui_4 = 1;   \
-volatile long prefix##_l_1 = 1;     \
-volatile ulong prefix##_ul_1 = 1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-#define TEST_INT_OP_TYPE(op, type)                      \
-rsDebug("Testing " #op " for " #type "1", i++);         \
-res_##type##_1 = src1_##type##_1 op src2_##type##_1;    \
-rsDebug("Testing " #op " for " #type "2", i++);         \
-res_##type##_2 = src1_##type##_2 op src2_##type##_2;    \
-rsDebug("Testing " #op " for " #type "3", i++);         \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3;    \
-rsDebug("Testing " #op " for " #type "4", i++);         \
-res_##type##_4 = src1_##type##_4 op src2_##type##_4;
-
-#define TEST_INT_OP(op)                     \
-TEST_INT_OP_TYPE(op, c)                     \
-TEST_INT_OP_TYPE(op, uc)                    \
-TEST_INT_OP_TYPE(op, s)                     \
-TEST_INT_OP_TYPE(op, us)                    \
-TEST_INT_OP_TYPE(op, i)                     \
-TEST_INT_OP_TYPE(op, ui)                    \
-rsDebug("Testing " #op " for l1", i++);     \
-res_l_1 = src1_l_1 op src2_l_1;             \
-rsDebug("Testing " #op " for ul1", i++);    \
-res_ul_1 = src1_ul_1 op src2_ul_1;
-
-#define TEST_XN_FUNC_YN(typeout, fnc, typein)   \
-    res_##typeout##_1 = fnc(src1_##typein##_1); \
-    res_##typeout##_2 = fnc(src1_##typein##_2); \
-    res_##typeout##_3 = fnc(src1_##typein##_3); \
-    res_##typeout##_4 = fnc(src1_##typein##_4);
-
-#define TEST_XN_FUNC_XN_XN(type, fnc)                       \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
-    res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
-    res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
-    res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
-
-#define TEST_X_FUNC_X_X_X(type, fnc)    \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
-
-#define TEST_IN_FUNC_IN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, uc)    \
-    TEST_XN_FUNC_YN(c, fnc, c)      \
-    TEST_XN_FUNC_YN(us, fnc, us)    \
-    TEST_XN_FUNC_YN(s, fnc, s)      \
-    TEST_XN_FUNC_YN(ui, fnc, ui)    \
-    TEST_XN_FUNC_YN(i, fnc, i)
-
-#define TEST_UIN_FUNC_IN(fnc)       \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, c)     \
-    TEST_XN_FUNC_YN(us, fnc, s)     \
-    TEST_XN_FUNC_YN(ui, fnc, i)     \
-
-#define TEST_IN_FUNC_IN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_XN_XN(uc, fnc)     \
-    TEST_XN_FUNC_XN_XN(c, fnc)      \
-    TEST_XN_FUNC_XN_XN(us, fnc)     \
-    TEST_XN_FUNC_XN_XN(s, fnc)      \
-    TEST_XN_FUNC_XN_XN(ui, fnc)     \
-    TEST_XN_FUNC_XN_XN(i, fnc)
-
-#define TEST_I_FUNC_I_I_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_X_FUNC_X_X_X(uc, fnc)      \
-    TEST_X_FUNC_X_X_X(c, fnc)       \
-    TEST_X_FUNC_X_X_X(us, fnc)      \
-    TEST_X_FUNC_X_X_X(s, fnc)       \
-    TEST_X_FUNC_X_X_X(ui, fnc)      \
-    TEST_X_FUNC_X_X_X(i, fnc)
-
-#define TEST_FN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f2 = fnc(f2);                   \
-    f3 = fnc(f3);                   \
-    f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (float*) &f1);     \
-    f2 = fnc(f2, (float2*) &f2);    \
-    f3 = fnc(f3, (float3*) &f3);    \
-    f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f2);               \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_F34_FUNC_F34_F34(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f1);               \
-    f3 = fnc(f3, f1);               \
-    f4 = fnc(f4, f1);
-
-#define TEST_F_FUNC_FN(fnc)         \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f1 = fnc(f2);                   \
-    f1 = fnc(f3);                   \
-    f1 = fnc(f4);
-
-#define TEST_F_FUNC_FN_FN(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f1 = fnc(f2, f2);               \
-    f1 = fnc(f3, f3);               \
-    f1 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i2);               \
-    f3 = fnc(f3, i3);               \
-    f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i1);               \
-    f3 = fnc(f3, i1);               \
-    f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f2, f2);           \
-    f3 = fnc(f3, f3, f3);           \
-    f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_FN_F(fnc)   \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f1, f1);           \
-    f3 = fnc(f3, f1, f1);           \
-    f4 = fnc(f4, f1, f1);
-
-#define TEST_FN_FUNC_FN_PIN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (int*) &i1);       \
-    f2 = fnc(f2, (int2*) &i2);      \
-    f3 = fnc(f3, (int3*) &i3);      \
-    f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, (int*) &i1);   \
-    f2 = fnc(f2, f2, (int2*) &i2);  \
-    f3 = fnc(f3, f3, (int3*) &i3);  \
-    f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    i1 = fnc(f1);                   \
-    i2 = fnc(f2);                   \
-    i3 = fnc(f3);                   \
-    i4 = fnc(f4);
-
-static bool test_fp_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_FN_FUNC_FN(acos);
-    TEST_FN_FUNC_FN(acosh);
-    TEST_FN_FUNC_FN(acospi);
-    TEST_FN_FUNC_FN(asin);
-    TEST_FN_FUNC_FN(asinh);
-    TEST_FN_FUNC_FN(asinpi);
-    TEST_FN_FUNC_FN(atan);
-    TEST_FN_FUNC_FN_FN(atan2);
-    TEST_FN_FUNC_FN(atanh);
-    TEST_FN_FUNC_FN(atanpi);
-    TEST_FN_FUNC_FN_FN(atan2pi);
-    TEST_FN_FUNC_FN(cbrt);
-    TEST_FN_FUNC_FN(ceil);
-    TEST_FN_FUNC_FN_FN_FN(clamp);
-    TEST_FN_FUNC_FN_FN_F(clamp);
-    TEST_FN_FUNC_FN_FN(copysign);
-    TEST_FN_FUNC_FN(cos);
-    TEST_FN_FUNC_FN(cosh);
-    TEST_FN_FUNC_FN(cospi);
-    TEST_F34_FUNC_F34_F34(cross);
-    TEST_FN_FUNC_FN(degrees);
-    TEST_F_FUNC_FN_FN(distance);
-    TEST_F_FUNC_FN_FN(dot);
-    TEST_FN_FUNC_FN(erfc);
-    TEST_FN_FUNC_FN(erf);
-    TEST_FN_FUNC_FN(exp);
-    TEST_FN_FUNC_FN(exp2);
-    TEST_FN_FUNC_FN(exp10);
-    TEST_FN_FUNC_FN(expm1);
-    TEST_FN_FUNC_FN(fabs);
-    TEST_FN_FUNC_FN_FN(fdim);
-    TEST_FN_FUNC_FN(floor);
-    TEST_FN_FUNC_FN_FN_FN(fma);
-    TEST_FN_FUNC_FN_FN(fmax);
-    TEST_FN_FUNC_FN_F(fmax);
-    TEST_FN_FUNC_FN_FN(fmin);
-    TEST_FN_FUNC_FN_F(fmin);
-    TEST_FN_FUNC_FN_FN(fmod);
-    TEST_FN_FUNC_FN_PFN(fract);
-    TEST_FN_FUNC_FN_PIN(frexp);
-    TEST_FN_FUNC_FN_FN(hypot);
-    TEST_IN_FUNC_FN(ilogb);
-    TEST_FN_FUNC_FN_IN(ldexp);
-    TEST_FN_FUNC_FN_I(ldexp);
-    TEST_F_FUNC_FN(length);
-    TEST_FN_FUNC_FN(lgamma);
-    TEST_FN_FUNC_FN_PIN(lgamma);
-    TEST_FN_FUNC_FN(log);
-    TEST_FN_FUNC_FN(log2);
-    TEST_FN_FUNC_FN(log10);
-    TEST_FN_FUNC_FN(log1p);
-    TEST_FN_FUNC_FN(logb);
-    TEST_FN_FUNC_FN_FN_FN(mad);
-    TEST_FN_FUNC_FN_FN(max);
-    TEST_FN_FUNC_FN_F(max);
-    TEST_FN_FUNC_FN_FN(min);
-    TEST_FN_FUNC_FN_F(min);
-    TEST_FN_FUNC_FN_FN_FN(mix);
-    TEST_FN_FUNC_FN_FN_F(mix);
-    TEST_FN_FUNC_FN_PFN(modf);
-    // nan
-    TEST_FN_FUNC_FN_FN(nextafter);
-    TEST_FN_FUNC_FN(normalize);
-    TEST_FN_FUNC_FN_FN(pow);
-    TEST_FN_FUNC_FN_IN(pown);
-    TEST_FN_FUNC_FN_FN(powr);
-    TEST_FN_FUNC_FN(radians);
-    TEST_FN_FUNC_FN_FN(remainder);
-    TEST_FN_FUNC_FN_FN_PIN(remquo);
-    TEST_FN_FUNC_FN(rint);
-    TEST_FN_FUNC_FN_IN(rootn);
-    TEST_FN_FUNC_FN(round);
-    TEST_FN_FUNC_FN(rsqrt);
-    TEST_FN_FUNC_FN(sign);
-    TEST_FN_FUNC_FN(sin);
-    TEST_FN_FUNC_FN_PFN(sincos);
-    TEST_FN_FUNC_FN(sinh);
-    TEST_FN_FUNC_FN(sinpi);
-    TEST_FN_FUNC_FN(sqrt);
-    TEST_FN_FUNC_FN_FN(step);
-    TEST_FN_FUNC_FN_F(step);
-    TEST_FN_FUNC_FN(tan);
-    TEST_FN_FUNC_FN(tanh);
-    TEST_FN_FUNC_FN(tanpi);
-    TEST_FN_FUNC_FN(tgamma);
-    TEST_FN_FUNC_FN(trunc);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_fp_math FAILED", time);
-    }
-    else {
-        rsDebug("test_fp_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_int_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_UIN_FUNC_IN(abs);
-    TEST_IN_FUNC_IN(clz);
-    TEST_IN_FUNC_IN_IN(min);
-    TEST_IN_FUNC_IN_IN(max);
-    TEST_I_FUNC_I_I_I(rsClamp);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_int_math FAILED", time);
-    }
-    else {
-        rsDebug("test_int_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_basic_operators() {
-    bool failed = false;
-    int i = 0;
-
-    TEST_INT_OP(+);
-    TEST_INT_OP(-);
-    TEST_INT_OP(*);
-    TEST_INT_OP(/);
-    TEST_INT_OP(%);
-    TEST_INT_OP(<<);
-    TEST_INT_OP(>>);
-
-    if (failed) {
-        rsDebug("test_basic_operators FAILED", 0);
-    }
-    else {
-        rsDebug("test_basic_operators PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define TEST_CVT(to, from, type)                        \
-rsDebug("Testing convert from " #from " to " #to, 0);   \
-to##1 = from##1;                                        \
-to##2 = convert_##type##2(from##2);                     \
-to##3 = convert_##type##3(from##3);                     \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type)   \
-TEST_CVT(to, c, type);              \
-TEST_CVT(to, uc, type);             \
-TEST_CVT(to, s, type);              \
-TEST_CVT(to, us, type);             \
-TEST_CVT(to, i, type);              \
-TEST_CVT(to, ui, type);             \
-TEST_CVT(to, f, type);              \
-
-static bool test_convert() {
-    bool failed = false;
-
-    TEST_CVT_MATRIX(c, char);
-    TEST_CVT_MATRIX(uc, uchar);
-    TEST_CVT_MATRIX(s, short);
-    TEST_CVT_MATRIX(us, ushort);
-    TEST_CVT_MATRIX(i, int);
-    TEST_CVT_MATRIX(ui, uint);
-    TEST_CVT_MATRIX(f, float);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_convert();
-    failed |= test_fp_math(index);
-    failed |= test_int_math(index);
-    failed |= test_basic_operators();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs
deleted file mode 100644
index 5bfbb2b..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs
+++ /dev/null
@@ -1,409 +0,0 @@
-#include "shared.rsh"
-//#pragma rs_fp_relaxed
-
-volatile float x = 0.0f;
-volatile float y = 0.0f;
-volatile float result_add = 0.0f;
-volatile float result_sub = 0.0f;
-volatile float result_mul = 0.0f;
-volatile float result_div = 0.0f;
-
-#define DECLARE_INPUT_SET(type, abbrev)         \
-volatile type    rand_##abbrev##1_0, rand_##abbrev##1_1; \
-volatile type##2 rand_##abbrev##2_0, rand_##abbrev##2_1; \
-volatile type##3 rand_##abbrev##3_0, rand_##abbrev##3_1; \
-volatile type##4 rand_##abbrev##4_0, rand_##abbrev##4_1;
-
-#define DECLARE_ALL_INPUT_SETS()    \
-DECLARE_INPUT_SET(float, f);        \
-DECLARE_INPUT_SET(char, sc);        \
-DECLARE_INPUT_SET(uchar, uc);       \
-DECLARE_INPUT_SET(short, ss);       \
-DECLARE_INPUT_SET(ushort, us);      \
-DECLARE_INPUT_SET(int, si);         \
-DECLARE_INPUT_SET(uint, ui);        \
-DECLARE_INPUT_SET(long, sl);        \
-DECLARE_INPUT_SET(ulong, ul);
-
-DECLARE_ALL_INPUT_SETS();
-
-#define DECLARE_REFERENCE_SET_VEC_VEC(type, abbrev, func)   \
-volatile type    func##_rand_##abbrev##1_##abbrev##1;                \
-volatile type##2 func##_rand_##abbrev##2_##abbrev##2;                \
-volatile type##3 func##_rand_##abbrev##3_##abbrev##3;                \
-volatile type##4 func##_rand_##abbrev##4_##abbrev##4;
-#define DECLARE_REFERENCE_SET_VEC_SCL(type, abbrev, func)   \
-volatile type##2 func##_rand_##abbrev##2_##abbrev##1;                \
-volatile type##3 func##_rand_##abbrev##3_##abbrev##1;                \
-volatile type##4 func##_rand_##abbrev##4_##abbrev##1;
-
-#define DECLARE_ALL_REFERENCE_SETS_VEC_VEC(func)    \
-DECLARE_REFERENCE_SET_VEC_VEC(float, f, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(char, sc, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(uchar, uc, func);     \
-DECLARE_REFERENCE_SET_VEC_VEC(short, ss, func);     \
-DECLARE_REFERENCE_SET_VEC_VEC(ushort, us, func);    \
-DECLARE_REFERENCE_SET_VEC_VEC(int, si, func);       \
-DECLARE_REFERENCE_SET_VEC_VEC(uint, ui, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(long, sl, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(ulong, ul, func);
-
-DECLARE_ALL_REFERENCE_SETS_VEC_VEC(min);
-DECLARE_ALL_REFERENCE_SETS_VEC_VEC(max);
-DECLARE_REFERENCE_SET_VEC_VEC(float, f, fmin);
-DECLARE_REFERENCE_SET_VEC_SCL(float, f, fmin);
-DECLARE_REFERENCE_SET_VEC_VEC(float, f, fmax);
-DECLARE_REFERENCE_SET_VEC_SCL(float, f, fmax);
-
-static void fail_f1(float v1, float v2, float actual, float expected, char *op_name) {
-    int dist = float_dist(actual, expected);
-    rsDebug("float operation did not match!", op_name);
-    rsDebug("v1", v1);
-    rsDebug("v2", v2);
-    rsDebug("Dalvik result", expected);
-    rsDebug("Renderscript result", actual);
-    rsDebug("ULP difference", dist);
-}
-
-static void fail_f2(float2 v1, float2 v2, float2 actual, float2 expected, char *op_name) {
-    int2 dist;
-    dist.x = float_dist(actual.x, expected.x);
-    dist.y = float_dist(actual.y, expected.y);
-    rsDebug("float2 operation did not match!", op_name);
-    rsDebug("v1.x", v1.x);
-    rsDebug("v1.y", v1.y);
-    rsDebug("v2.x", v2.x);
-    rsDebug("v2.y", v2.y);
-    rsDebug("Dalvik result .x", expected.x);
-    rsDebug("Dalvik result .y", expected.y);
-    rsDebug("Renderscript result .x", actual.x);
-    rsDebug("Renderscript result .y", actual.y);
-    rsDebug("ULP difference .x", dist.x);
-    rsDebug("ULP difference .y", dist.y);
-}
-
-static void fail_f3(float3 v1, float3 v2, float3 actual, float3 expected, char *op_name) {
-    int3 dist;
-    dist.x = float_dist(actual.x, expected.x);
-    dist.y = float_dist(actual.y, expected.y);
-    dist.z = float_dist(actual.z, expected.z);
-    rsDebug("float3 operation did not match!", op_name);
-    rsDebug("v1.x", v1.x);
-    rsDebug("v1.y", v1.y);
-    rsDebug("v1.z", v1.z);
-    rsDebug("v2.x", v2.x);
-    rsDebug("v2.y", v2.y);
-    rsDebug("v2.z", v2.z);
-    rsDebug("Dalvik result .x", expected.x);
-    rsDebug("Dalvik result .y", expected.y);
-    rsDebug("Dalvik result .z", expected.z);
-    rsDebug("Renderscript result .x", actual.x);
-    rsDebug("Renderscript result .y", actual.y);
-    rsDebug("Renderscript result .z", actual.z);
-    rsDebug("ULP difference .x", dist.x);
-    rsDebug("ULP difference .y", dist.y);
-    rsDebug("ULP difference .z", dist.z);
-}
-
-static void fail_f4(float4 v1, float4 v2, float4 actual, float4 expected, char *op_name) {
-    int4 dist;
-    dist.x = float_dist(actual.x, expected.x);
-    dist.y = float_dist(actual.y, expected.y);
-    dist.z = float_dist(actual.z, expected.z);
-    dist.w = float_dist(actual.w, expected.w);
-    rsDebug("float4 operation did not match!", op_name);
-    rsDebug("v1.x", v1.x);
-    rsDebug("v1.y", v1.y);
-    rsDebug("v1.z", v1.z);
-    rsDebug("v1.w", v1.w);
-    rsDebug("v2.x", v2.x);
-    rsDebug("v2.y", v2.y);
-    rsDebug("v2.z", v2.z);
-    rsDebug("v2.w", v2.w);
-    rsDebug("Dalvik result .x", expected.x);
-    rsDebug("Dalvik result .y", expected.y);
-    rsDebug("Dalvik result .z", expected.z);
-    rsDebug("Dalvik result .w", expected.w);
-    rsDebug("Renderscript result .x", actual.x);
-    rsDebug("Renderscript result .y", actual.y);
-    rsDebug("Renderscript result .z", actual.z);
-    rsDebug("Renderscript result .w", actual.w);
-    rsDebug("ULP difference .x", dist.x);
-    rsDebug("ULP difference .y", dist.y);
-    rsDebug("ULP difference .z", dist.z);
-    rsDebug("ULP difference .w", dist.w);
-}
-
-static bool f1_almost_equal(float a, float b) {
-    return float_almost_equal(a, b);
-}
-
-static bool f2_almost_equal(float2 a, float2 b) {
-    return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y);
-}
-
-
-static bool f3_almost_equal(float3 a, float3 b) {
-    return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y)
-            && float_almost_equal(a.z, b.z);
-}
-
-static bool f4_almost_equal(float4 a, float4 b) {
-    return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y)
-            && float_almost_equal(a.z, b.z) && float_almost_equal(a.w, b.w);
-}
-
-#define TEST_BASIC_FLOAT_OP(op, opName)                 \
-temp_f1 = x op y;                                       \
-if (! float_almost_equal(temp_f1, result_##opName)) {   \
-    fail_f1(x, y , temp_f1, result_##opName, #opName);  \
-    failed = true;                                      \
-}
-
-#define TEST_FN_FN(func, size)                                                  \
-temp_f##size = func(rand_f##size##_0, rand_f##size##_1);                        \
-if (! f##size##_almost_equal(temp_f##size , func##_rand_f##size##_f##size)) {   \
-    fail_f##size (x, y , temp_f##size, func##_rand_f##size##_f##size, #func);   \
-    failed = true;                                                              \
-}
-#define TEST_FN_F(func, size)                                               \
-temp_f##size = func(rand_f##size##_0, rand_f1_1);                           \
-if (! f##size##_almost_equal(temp_f##size , func##_rand_f##size##_f1)) {    \
-    fail_f##size (x, y , temp_f##size, func##_rand_f##size##_f1 , #func);   \
-    failed = true;                                                          \
-}
-
-#define TEST_FN_FN_ALL(func)    \
-TEST_FN_FN(func, 1)             \
-TEST_FN_FN(func, 2)             \
-TEST_FN_FN(func, 3)             \
-TEST_FN_FN(func, 4)
-#define TEST_FN_F_ALL(func) \
-TEST_FN_F(func, 2)          \
-TEST_FN_F(func, 3)          \
-TEST_FN_F(func, 4)
-
-#define TEST_VEC1_VEC1(func, type)                              \
-temp_##type##1 = func( rand_##type##1_0, rand_##type##1_1 );    \
-if (temp_##type##1 != func##_rand_##type##1_##type##1) {        \
-    rsDebug(#func " " #type "1 operation did not match!", 0);   \
-    rsDebug("v1", rand_##type##1_0);                            \
-    rsDebug("v2", rand_##type##1_1);                            \
-    rsDebug("Dalvik result", func##_rand_##type##1_##type##1);  \
-    rsDebug("Renderscript result", temp_##type##1);             \
-    failed = true;                                              \
-}
-#define TEST_VEC2_VEC2(func, type)                                      \
-temp_##type##2 = func( rand_##type##2_0, rand_##type##2_1 );            \
-if (temp_##type##2 .x != func##_rand_##type##2_##type##2 .x             \
-        || temp_##type##2 .y != func##_rand_##type##2_##type##2 .y) {   \
-    rsDebug(#func " " #type "2 operation did not match!", 0);           \
-    rsDebug("v1.x", rand_##type##2_0 .x);                               \
-    rsDebug("v1.y", rand_##type##2_0 .y);                               \
-    rsDebug("v2.x", rand_##type##2_1 .x);                               \
-    rsDebug("v2.y", rand_##type##2_1 .y);                               \
-    rsDebug("Dalvik result .x", func##_rand_##type##2_##type##2 .x);    \
-    rsDebug("Dalvik result .y", func##_rand_##type##2_##type##2 .y);    \
-    rsDebug("Renderscript result .x", temp_##type##2 .x);               \
-    rsDebug("Renderscript result .y", temp_##type##2 .y);               \
-    failed = true;                                                      \
-}
-#define TEST_VEC3_VEC3(func, type)                                      \
-temp_##type##3 = func( rand_##type##3_0, rand_##type##3_1 );            \
-if (temp_##type##3 .x != func##_rand_##type##3_##type##3 .x             \
-        || temp_##type##3 .y != func##_rand_##type##3_##type##3 .y      \
-        || temp_##type##3 .z != func##_rand_##type##3_##type##3 .z) {   \
-    rsDebug(#func " " #type "3 operation did not match!", 0);           \
-    rsDebug("v1.x", rand_##type##3_0 .x);                               \
-    rsDebug("v1.y", rand_##type##3_0 .y);                               \
-    rsDebug("v1.z", rand_##type##3_0 .z);                               \
-    rsDebug("v2.x", rand_##type##3_1 .x);                               \
-    rsDebug("v2.y", rand_##type##3_1 .y);                               \
-    rsDebug("v2.z", rand_##type##3_1 .z);                               \
-    rsDebug("Dalvik result .x", func##_rand_##type##3_##type##3 .x);    \
-    rsDebug("Dalvik result .y", func##_rand_##type##3_##type##3 .y);    \
-    rsDebug("Dalvik result .z", func##_rand_##type##3_##type##3 .z);    \
-    rsDebug("Renderscript result .x", temp_##type##3 .x);               \
-    rsDebug("Renderscript result .y", temp_##type##3 .y);               \
-    rsDebug("Renderscript result .z", temp_##type##3 .z);               \
-    failed = true;                                                      \
-}
-#define TEST_VEC4_VEC4(func, type)                                      \
-temp_##type##4 = func( rand_##type##4_0, rand_##type##4_1 );            \
-if (temp_##type##4 .x != func##_rand_##type##4_##type##4 .x             \
-        || temp_##type##4 .y != func##_rand_##type##4_##type##4 .y      \
-        || temp_##type##4 .z != func##_rand_##type##4_##type##4 .z      \
-        || temp_##type##4 .w != func##_rand_##type##4_##type##4 .w) {   \
-    rsDebug(#func " " #type "4 operation did not match!", 0);           \
-    rsDebug("v1.x", rand_##type##4_0 .x);                               \
-    rsDebug("v1.y", rand_##type##4_0 .y);                               \
-    rsDebug("v1.z", rand_##type##4_0 .z);                               \
-    rsDebug("v1.w", rand_##type##4_0 .w);                               \
-    rsDebug("v2.x", rand_##type##4_1 .x);                               \
-    rsDebug("v2.y", rand_##type##4_1 .y);                               \
-    rsDebug("v2.z", rand_##type##4_1 .z);                               \
-    rsDebug("v2.w", rand_##type##4_1 .w);                               \
-    rsDebug("Dalvik result .x", func##_rand_##type##4_##type##4 .x);    \
-    rsDebug("Dalvik result .y", func##_rand_##type##4_##type##4 .y);    \
-    rsDebug("Dalvik result .z", func##_rand_##type##4_##type##4 .z);    \
-    rsDebug("Dalvik result .w", func##_rand_##type##4_##type##4 .w);    \
-    rsDebug("Renderscript result .x", temp_##type##4 .x);               \
-    rsDebug("Renderscript result .y", temp_##type##4 .y);               \
-    rsDebug("Renderscript result .z", temp_##type##4 .z);               \
-    rsDebug("Renderscript result .w", temp_##type##4 .w);               \
-    failed = true;                                                      \
-}
-
-#define TEST_SC1_SC1(func)  TEST_VEC1_VEC1(func, sc)
-#define TEST_SC2_SC2(func)  TEST_VEC2_VEC2(func, sc)
-#define TEST_SC3_SC3(func)  TEST_VEC3_VEC3(func, sc)
-#define TEST_SC4_SC4(func)  TEST_VEC4_VEC4(func, sc)
-
-#define TEST_UC1_UC1(func)  TEST_VEC1_VEC1(func, uc)
-#define TEST_UC2_UC2(func)  TEST_VEC2_VEC2(func, uc)
-#define TEST_UC3_UC3(func)  TEST_VEC3_VEC3(func, uc)
-#define TEST_UC4_UC4(func)  TEST_VEC4_VEC4(func, uc)
-
-#define TEST_SS1_SS1(func)  TEST_VEC1_VEC1(func, ss)
-#define TEST_SS2_SS2(func)  TEST_VEC2_VEC2(func, ss)
-#define TEST_SS3_SS3(func)  TEST_VEC3_VEC3(func, ss)
-#define TEST_SS4_SS4(func)  TEST_VEC4_VEC4(func, ss)
-
-#define TEST_US1_US1(func)  TEST_VEC1_VEC1(func, us)
-#define TEST_US2_US2(func)  TEST_VEC2_VEC2(func, us)
-#define TEST_US3_US3(func)  TEST_VEC3_VEC3(func, us)
-#define TEST_US4_US4(func)  TEST_VEC4_VEC4(func, us)
-
-#define TEST_SI1_SI1(func)  TEST_VEC1_VEC1(func, si)
-#define TEST_SI2_SI2(func)  TEST_VEC2_VEC2(func, si)
-#define TEST_SI3_SI3(func)  TEST_VEC3_VEC3(func, si)
-#define TEST_SI4_SI4(func)  TEST_VEC4_VEC4(func, si)
-
-#define TEST_UI1_UI1(func)  TEST_VEC1_VEC1(func, ui)
-#define TEST_UI2_UI2(func)  TEST_VEC2_VEC2(func, ui)
-#define TEST_UI3_UI3(func)  TEST_VEC3_VEC3(func, ui)
-#define TEST_UI4_UI4(func)  TEST_VEC4_VEC4(func, ui)
-
-#define TEST_SL1_SL1(func)  TEST_VEC1_VEC1(func, sl)
-#define TEST_SL2_SL2(func)  TEST_VEC2_VEC2(func, sl)
-#define TEST_SL3_SL3(func)  TEST_VEC3_VEC3(func, sl)
-#define TEST_SL4_SL4(func)  TEST_VEC4_VEC4(func, sl)
-
-#define TEST_UL1_UL1(func)  TEST_VEC1_VEC1(func, ul)
-#define TEST_UL2_UL2(func)  TEST_VEC2_VEC2(func, ul)
-#define TEST_UL3_UL3(func)  TEST_VEC3_VEC3(func, ul)
-#define TEST_UL4_UL4(func)  TEST_VEC4_VEC4(func, ul)
-
-#define TEST_SC_SC_ALL(func)    \
-TEST_SC1_SC1(func)              \
-TEST_SC2_SC2(func)              \
-TEST_SC3_SC3(func)              \
-TEST_SC4_SC4(func)
-#define TEST_UC_UC_ALL(func)    \
-TEST_UC1_UC1(func)              \
-TEST_UC2_UC2(func)              \
-TEST_UC3_UC3(func)              \
-TEST_UC4_UC4(func)
-
-#define TEST_SS_SS_ALL(func)    \
-TEST_SS1_SS1(func)              \
-TEST_SS2_SS2(func)              \
-TEST_SS3_SS3(func)              \
-TEST_SS4_SS4(func)
-#define TEST_US_US_ALL(func)    \
-TEST_US1_US1(func)              \
-TEST_US2_US2(func)              \
-TEST_US3_US3(func)              \
-TEST_US4_US4(func)
-#define TEST_SI_SI_ALL(func)    \
-TEST_SI1_SI1(func)              \
-TEST_SI2_SI2(func)              \
-TEST_SI3_SI3(func)              \
-TEST_SI4_SI4(func)
-#define TEST_UI_UI_ALL(func)    \
-TEST_UI1_UI1(func)              \
-TEST_UI2_UI2(func)              \
-TEST_UI3_UI3(func)              \
-TEST_UI4_UI4(func)
-#define TEST_SL_SL_ALL(func)    \
-TEST_SL1_SL1(func)              \
-TEST_SL2_SL2(func)              \
-TEST_SL3_SL3(func)              \
-TEST_SL4_SL4(func)
-#define TEST_UL_UL_ALL(func)    \
-TEST_UL1_UL1(func)              \
-TEST_UL2_UL2(func)              \
-TEST_UL3_UL3(func)              \
-TEST_UL4_UL4(func)
-
-#define TEST_VEC_VEC_ALL(func)  \
-TEST_FN_FN_ALL(func)            \
-TEST_SC_SC_ALL(func)            \
-TEST_UC_UC_ALL(func)            \
-TEST_SS_SS_ALL(func)            \
-TEST_US_US_ALL(func)            \
-TEST_SI_SI_ALL(func)            \
-TEST_UI_UI_ALL(func)
-
-// TODO:  add long types to ALL macro
-#if 0
-TEST_SL_SL_ALL(func)            \
-TEST_UL_UL_ALL(func)
-#endif
-
-#define DECLARE_TEMP_SET(type, abbrev)  \
-volatile type    temp_##abbrev##1;               \
-volatile type##2 temp_##abbrev##2;               \
-volatile type##3 temp_##abbrev##3;               \
-volatile type##4 temp_##abbrev##4;
-
-#define DECLARE_ALL_TEMP_SETS() \
-DECLARE_TEMP_SET(float, f);     \
-DECLARE_TEMP_SET(char, sc);     \
-DECLARE_TEMP_SET(uchar, uc);    \
-DECLARE_TEMP_SET(short, ss);    \
-DECLARE_TEMP_SET(ushort, us);   \
-DECLARE_TEMP_SET(int, si);      \
-DECLARE_TEMP_SET(uint, ui);     \
-DECLARE_TEMP_SET(long, sl);     \
-DECLARE_TEMP_SET(ulong, ul);
-
-static bool test_math_agree() {
-    bool failed = false;
-
-    DECLARE_ALL_TEMP_SETS();
-
-    TEST_BASIC_FLOAT_OP(+, add);
-    TEST_BASIC_FLOAT_OP(-, sub);
-    TEST_BASIC_FLOAT_OP(*, mul);
-    TEST_BASIC_FLOAT_OP(/, div);
-
-    TEST_VEC_VEC_ALL(min);
-    TEST_VEC_VEC_ALL(max);
-    TEST_FN_FN_ALL(fmin);
-    TEST_FN_F_ALL(fmin);
-    TEST_FN_FN_ALL(fmax);
-    TEST_FN_F_ALL(fmax);
-
-    if (failed) {
-        rsDebug("test_math_agree FAILED", 0);
-    }
-    else {
-        rsDebug("test_math_agree PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_agree_test() {
-    bool failed = false;
-    failed |= test_math_agree();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math_conformance.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math_conformance.rs
deleted file mode 100644
index 2d62f343..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/math_conformance.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "shared.rsh"
-
-// Testing math conformance
-
-static bool test_rootn() {
-    bool failed = false;
-
-    // rootn(x, 0) -> NaN
-    _RS_ASSERT(isnan(rootn(1.0f, 0)));
-
-    // rootn(+/-0, n) -> +/-inf for odd n < 0
-    _RS_ASSERT(isposinf(rootn(0.f, -3)));
-    _RS_ASSERT(isneginf(rootn(-0.f, -3)));
-
-    // rootn(+/-0, n) -> +inf for even n < 0
-    _RS_ASSERT(isposinf(rootn(0.f, -8)));
-    _RS_ASSERT(isposinf(rootn(-0.f, -8)));
-
-    // rootn(+/-0, n) -> +/-0 for odd n > 0
-    _RS_ASSERT(isposzero(rootn(0.f, 3)));
-    _RS_ASSERT(isnegzero(rootn(-0.f, 3)));
-
-    // rootn(+/-0, n) -> +0 for even n > 0
-    _RS_ASSERT(isposzero(rootn(0.f, 8)));
-    _RS_ASSERT(isposzero(rootn(-0.f, 8)));
-
-    // rootn(x, n) -> NaN for x < 0 and even n
-    _RS_ASSERT(isnan(rootn(-10000.f, -4)));
-    _RS_ASSERT(isnan(rootn(-10000.f, 4)));
-
-    // rootn(x, n) -> value for x < 0 and odd n
-    _RS_ASSERT(!isnan(rootn(-10000.f, -3)));
-    _RS_ASSERT(!isnan(rootn(-10000.f, 3)));
-
-    if (failed) {
-        rsDebug("test_rootn FAILED", -1);
-    }
-    else {
-        rsDebug("test_rootn PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_conformance_test() {
-    bool failed = false;
-    failed |= test_rootn();
-
-    if (failed) {
-        rsDebug("math_conformance_test FAILED", -1);
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsDebug("math_conformance_test PASSED", 0);
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/min.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/min.rs
deleted file mode 100644
index 4b92763..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/min.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "shared.rsh"
-#pragma rs_fp_relaxed
-
-volatile uchar2 res_uc_2 = 1;
-volatile uchar2 src1_uc_2 = 1;
-volatile uchar2 src2_uc_2 = 1;
-
-void min_test() {
-    bool failed = false;
-
-    res_uc_2 = min(src1_uc_2, src2_uc_2);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/noroot.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/noroot.rs
deleted file mode 100644
index 2c807bd..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/noroot.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "shared.rsh"
-
-rs_allocation aRaw;
-int dimX;
-int dimY;
-static bool failed = false;
-
-void foo(const int *in, int *out, uint32_t x, uint32_t y) {
-    *out = 99 + x + y * dimX;
-}
-
-static bool test_foo_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (99 + i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_foo_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_foo_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_foo() {
-    failed |= test_foo_output();
-}
-
-void noroot_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/primitives.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/primitives.rs
deleted file mode 100644
index ce451da..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/primitives.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool test_primitive_types(uint32_t index) {
-    bool failed = false;
-    start();
-
-    _RS_ASSERT(floatTest == 2.99f);
-    _RS_ASSERT(doubleTest == 3.05);
-    _RS_ASSERT(charTest == -16);
-    _RS_ASSERT(shortTest == -32);
-    _RS_ASSERT(intTest == -64);
-    _RS_ASSERT(longTest == 17179869185l);
-    _RS_ASSERT(longlongTest == 68719476735l);
-
-    _RS_ASSERT(ucharTest == 8);
-    _RS_ASSERT(ushortTest == 16);
-    _RS_ASSERT(uintTest == 32);
-    _RS_ASSERT(ulongTest == 4611686018427387903L);
-    _RS_ASSERT(int64_tTest == -17179869184l);
-    _RS_ASSERT(uint64_tTest == 117179869185l);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_primitives FAILED", time);
-    }
-    else {
-        rsDebug("test_primitives PASSED", time);
-    }
-
-    return failed;
-}
-
-void primitives_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_primitive_types(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/refcount.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/refcount.rs
deleted file mode 100644
index 4ea70e2..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/refcount.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "shared.rsh"
-
-// Testing reference counting of RS object types
-
-rs_allocation globalA;
-static rs_allocation staticGlobalA;
-
-void refcount_test() {
-    staticGlobalA = globalA;
-    rsClearObject(&globalA);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rsdebug.rs
deleted file mode 100644
index 68ac168..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rsdebug.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-float2 float2Test = {2.99f, 12.99f};
-float3 float3Test = {3.99f, 13.99f, 23.99f};
-float4 float4Test = {4.99f, 14.99f, 24.99f, 34.99f};
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    // For this reason, none of the outputs are actually checked.
-
-    rsDebug("floatTest", floatTest);
-    rsDebug("float2Test", float2Test);
-    rsDebug("float3Test", float3Test);
-    rsDebug("float4Test", float4Test);
-    rsDebug("doubleTest", doubleTest);
-    rsDebug("charTest", charTest);
-    rsDebug("shortTest", shortTest);
-    rsDebug("intTest", intTest);
-    rsDebug("longTest", longTest);
-    rsDebug("longlongTest", longlongTest);
-
-    rsDebug("ucharTest", ucharTest);
-    rsDebug("ushortTest", ushortTest);
-    rsDebug("uintTest", uintTest);
-    rsDebug("ulongTest", ulongTest);
-    rsDebug("int64_tTest", int64_tTest);
-    rsDebug("uint64_tTest", uint64_tTest);
-
-    return failed;
-}
-
-void test_rsdebug(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rsdebug_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rsdebug_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rslist.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rslist.rs
deleted file mode 100644
index 650243e..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rslist.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2013 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.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_compat)
-
-typedef struct ListAllocs_s {
-    rs_allocation text;
-    int result;
-} ListAllocs;
-
-ListAllocs *gList;
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rstime.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rstime.rs
deleted file mode 100644
index 7be955d..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rstime.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "shared.rsh"
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_time_t curTime = rsTime(0);
-    rs_tm tm;
-    rsDebug("curTime", curTime);
-
-    rsLocaltime(&tm, &curTime);
-
-    rsDebug("tm.tm_sec", tm.tm_sec);
-    rsDebug("tm.tm_min", tm.tm_min);
-    rsDebug("tm.tm_hour", tm.tm_hour);
-    rsDebug("tm.tm_mday", tm.tm_mday);
-    rsDebug("tm.tm_mon", tm.tm_mon);
-    rsDebug("tm.tm_year", tm.tm_year);
-    rsDebug("tm.tm_wday", tm.tm_wday);
-    rsDebug("tm.tm_yday", tm.tm_yday);
-    rsDebug("tm.tm_isdst", tm.tm_isdst);
-
-    // Test a specific time (since we set America/Los_Angeles localtime)
-    curTime = 1294438893;
-    rsLocaltime(&tm, &curTime);
-
-    _RS_ASSERT(tm.tm_sec == 33);
-    _RS_ASSERT(tm.tm_min == 21);
-    _RS_ASSERT(tm.tm_hour == 14);
-    _RS_ASSERT(tm.tm_mday == 7);
-    _RS_ASSERT(tm.tm_mon == 0);
-    _RS_ASSERT(tm.tm_year == 111);
-    _RS_ASSERT(tm.tm_wday == 5);
-    _RS_ASSERT(tm.tm_yday == 6);
-    _RS_ASSERT(tm.tm_isdst == 0);
-
-    return failed;
-}
-
-void test_rstime(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstime_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstime_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs
deleted file mode 100644
index bec124d..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element elementTest;
-rs_type typeTest;
-rs_allocation allocationTest;
-rs_sampler samplerTest;
-rs_script scriptTest;
-
-rs_matrix4x4 matrix4x4Test;
-rs_matrix3x3 matrix3x3Test;
-rs_matrix2x2 matrix2x2Test;
-
-struct my_struct {
-    int i;
-    rs_allocation banana;
-};
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_matrix4x4 matrix4x4TestLocal;
-    rs_matrix3x3 matrix3x3TestLocal;
-    rs_matrix2x2 matrix2x2TestLocal;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    rs_element elementTestLocal;
-    rs_type typeTestLocal;
-    rs_allocation allocationTestLocal;
-    rs_sampler samplerTestLocal;
-    rs_script scriptTestLocal;
-
-    struct my_struct structTest;
-
-    //allocationTestLocal = allocationTest;
-
-    //allocationTest = allocationTestLocal;
-
-    /*for (int i = 0; i < 4; i++) {
-        fontTestLocalArray[i] = fontTestLocal;
-    }*/
-
-    /*fontTest = fontTestLocalArray[3];*/
-
-    return failed;
-}
-
-void test_rstypes(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstypes_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstypes_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/sampler.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/sampler.rs
deleted file mode 100644
index ff1c0a7..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/sampler.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-rs_sampler minification;
-rs_sampler magnification;
-rs_sampler wrapS;
-rs_sampler wrapT;
-rs_sampler anisotropy;
-
-static bool test_sampler_getters() {
-    bool failed = false;
-
-    _RS_ASSERT(rsSamplerGetMagnification(minification) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(minification) == RS_SAMPLER_LINEAR_MIP_LINEAR);
-    _RS_ASSERT(rsSamplerGetWrapS(minification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(minification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(minification) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(magnification) == RS_SAMPLER_LINEAR);
-    _RS_ASSERT(rsSamplerGetMinification(magnification) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(magnification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(magnification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(magnification) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(wrapS) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(wrapS) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(wrapS) == RS_SAMPLER_WRAP);
-    _RS_ASSERT(rsSamplerGetWrapT(wrapS) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(wrapS) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(wrapT) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(wrapT) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(wrapT) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(wrapT) == RS_SAMPLER_WRAP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(wrapT) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(anisotropy) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(anisotropy) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(anisotropy) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(anisotropy) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(anisotropy) == 8.0f);
-
-    if (failed) {
-        rsDebug("test_sampler_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_sampler_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void sampler_test() {
-    bool failed = false;
-    failed |= test_sampler_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh
deleted file mode 100644
index b05a354..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh
+++ /dev/null
@@ -1,114 +0,0 @@
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_compat)
-
-typedef struct TestResult_s {
-    rs_allocation name;
-    bool pass;
-    float score;
-    int64_t time;
-} TestResult;
-//TestResult *g_results;
-
-static int64_t g_time;
-
-static void start(void) {
-    g_time = rsUptimeMillis();
-}
-
-static float end(uint32_t idx) {
-    int64_t t = rsUptimeMillis() - g_time;
-    //g_results[idx].time = t;
-    //rsDebug("test time", (int)t);
-    return ((float)t) / 1000.f;
-}
-
-#define _RS_ASSERT(b) \
-do { \
-    if (!(b)) { \
-        failed = true; \
-        rsDebug(#b " FAILED", 0); \
-    } \
-\
-} while (0)
-
-static const int iposinf = 0x7f800000;
-static const int ineginf = 0xff800000;
-
-static const float posinf() {
-    float f = *((float*)&iposinf);
-    return f;
-}
-
-static const float neginf() {
-    float f = *((float*)&ineginf);
-    return f;
-}
-
-static bool isposinf(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == iposinf);
-}
-
-static bool isneginf(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == ineginf);
-}
-
-static bool isnan(float f) {
-    int i = *((int*)(void*)&f);
-    return (((i & 0x7f800000) == 0x7f800000) && (i & 0x007fffff));
-}
-
-static bool isposzero(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == 0x00000000);
-}
-
-static bool isnegzero(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == 0x80000000);
-}
-
-static bool iszero(float f) {
-    return isposzero(f) || isnegzero(f);
-}
-
-/* Absolute epsilon used for floats.  Value is similar to float.h. */
-#ifndef FLT_EPSILON
-#define FLT_EPSILON 1.19e7f
-#endif
-/* Max ULPs while still being considered "equal".  Only used when this number
-   of ULPs is of a greater size than FLT_EPSILON. */
-#define FLT_MAX_ULP 1
-
-/* Calculate the difference in ULPs between the two values.  (Return zero on
-   perfect equality.) */
-static int float_dist(float f1, float f2) {
-    return *((int *)(&f1)) - *((int *)(&f2));
-}
-
-/* Check if two floats are essentially equal.  Will fail with some values
-   due to design.  (Validate using FLT_EPSILON or similar if necessary.) */
-static bool float_almost_equal(float f1, float f2) {
-    int *i1 = (int*)(&f1);
-    int *i2 = (int*)(&f2);
-
-    // Check for sign equality
-    if ( ((*i1 >> 31) == 0) != ((*i2 >> 31) == 0) ) {
-        // Handle signed zeroes
-        if (f1 == f2)
-            return true;
-        return false;
-    }
-
-    // Check with ULP distance
-    if (float_dist(f1, f2) > FLT_MAX_ULP)
-        return false;
-    return true;
-}
-
-/* These constants must match those in UnitTest.java */
-static const int RS_MSG_TEST_PASSED = 100;
-static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/struct.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/struct.rs
deleted file mode 100644
index 1cd728e..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/struct.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "shared.rsh"
-
-typedef struct Point2 {
-   int x;
-   int y;
-} Point_2;
-Point_2 *point2;
-
-static bool test_Point_2(int expected) {
-    bool failed = false;
-
-    rsDebug("Point: ", point2[0].x, point2[0].y);
-    _RS_ASSERT(point2[0].x == expected);
-    _RS_ASSERT(point2[0].y == expected);
-
-    if (failed) {
-        rsDebug("test_Point_2 FAILED", 0);
-    }
-    else {
-        rsDebug("test_Point_2 PASSED", 0);
-    }
-
-    return failed;
-}
-
-void struct_test(int expected) {
-    bool failed = false;
-    failed |= test_Point_2(expected);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/test_root.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/test_root.rs
deleted file mode 100644
index 89e7de7..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/test_root.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Fountain test script
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_compat)
-
-#pragma stateFragment(parent)
-
-#include "rs_graphics.rsh"
-
-
-typedef struct TestResult {
-    rs_allocation name;
-    bool pass;
-    float score;
-} TestResult_t;
-TestResult_t *results;
-
-int root() {
-
-    return 0;
-}
-
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/unsigned.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/unsigned.rs
deleted file mode 100644
index 2c056f4..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/unsigned.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "shared.rsh"
-
-// Testing unsigned types for Bug 6764163
-unsigned int ui = 37;
-unsigned char uc = 5;
-
-static bool test_unsigned() {
-    bool failed = false;
-
-    rsDebug("ui", ui);
-    rsDebug("uc", uc);
-    _RS_ASSERT(ui == 0x7fffffff);
-    _RS_ASSERT(uc == 129);
-
-    if (failed) {
-        rsDebug("test_unsigned FAILED", -1);
-    }
-    else {
-        rsDebug("test_unsigned PASSED", 0);
-    }
-
-    return failed;
-}
-
-void unsigned_test() {
-    bool failed = false;
-    failed |= test_unsigned();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/vector.rs b/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/vector.rs
deleted file mode 100644
index 0430a2f..0000000
--- a/tests/RenderScriptTests/RSTest_CompatLib/src/com/android/rs/test/vector.rs
+++ /dev/null
@@ -1,198 +0,0 @@
-#include "shared.rsh"
-
-// Testing vector types
-float2 f2 = { 1.0f, 2.0f };
-float3 f3 = { 1.0f, 2.0f, 3.0f };
-float4 f4 = { 1.0f, 2.0f, 3.0f, 4.0f };
-
-double2 d2 = { 1.0, 2.0 };
-double3 d3 = { 1.0, 2.0, 3.0 };
-double4 d4 = { 1.0, 2.0, 3.0, 4.0 };
-
-char2 i8_2 = { 1, 2 };
-char3 i8_3 = { 1, 2, 3 };
-char4 i8_4 = { 1, 2, 3, 4 };
-
-uchar2 u8_2 = { 1, 2 };
-uchar3 u8_3 = { 1, 2, 3 };
-uchar4 u8_4 = { 1, 2, 3, 4 };
-
-short2 i16_2 = { 1, 2 };
-short3 i16_3 = { 1, 2, 3 };
-short4 i16_4 = { 1, 2, 3, 4 };
-
-ushort2 u16_2 = { 1, 2 };
-ushort3 u16_3 = { 1, 2, 3 };
-ushort4 u16_4 = { 1, 2, 3, 4 };
-
-int2 i32_2 = { 1, 2 };
-int3 i32_3 = { 1, 2, 3 };
-int4 i32_4 = { 1, 2, 3, 4 };
-
-uint2 u32_2 = { 1, 2 };
-uint3 u32_3 = { 1, 2, 3 };
-uint4 u32_4 = { 1, 2, 3, 4 };
-
-long2 i64_2 = { 1, 2 };
-long3 i64_3 = { 1, 2, 3 };
-long4 i64_4 = { 1, 2, 3, 4 };
-
-ulong2 u64_2 = { 1, 2 };
-ulong3 u64_3 = { 1, 2, 3 };
-ulong4 u64_4 = { 1, 2, 3, 4 };
-
-static bool test_vector_types() {
-    bool failed = false;
-
-    rsDebug("Testing F32", 0);
-    _RS_ASSERT(f2.x == 2.99f);
-    _RS_ASSERT(f2.y == 3.99f);
-
-    _RS_ASSERT(f3.x == 2.99f);
-    _RS_ASSERT(f3.y == 3.99f);
-    _RS_ASSERT(f3.z == 4.99f);
-
-    _RS_ASSERT(f4.x == 2.99f);
-    _RS_ASSERT(f4.y == 3.99f);
-    _RS_ASSERT(f4.z == 4.99f);
-    _RS_ASSERT(f4.w == 5.99f);
-
-    rsDebug("Testing F64", 0);
-    _RS_ASSERT(d2.x == 2.99);
-    _RS_ASSERT(d2.y == 3.99);
-
-    _RS_ASSERT(d3.x == 2.99);
-    _RS_ASSERT(d3.y == 3.99);
-    _RS_ASSERT(d3.z == 4.99);
-
-    _RS_ASSERT(d4.x == 2.99);
-    _RS_ASSERT(d4.y == 3.99);
-    _RS_ASSERT(d4.z == 4.99);
-    _RS_ASSERT(d4.w == 5.99);
-
-    rsDebug("Testing I8", 0);
-    _RS_ASSERT(i8_2.x == 2);
-    _RS_ASSERT(i8_2.y == 3);
-
-    _RS_ASSERT(i8_3.x == 2);
-    _RS_ASSERT(i8_3.y == 3);
-    _RS_ASSERT(i8_3.z == 4);
-
-    _RS_ASSERT(i8_4.x == 2);
-    _RS_ASSERT(i8_4.y == 3);
-    _RS_ASSERT(i8_4.z == 4);
-    _RS_ASSERT(i8_4.w == 5);
-
-    rsDebug("Testing U8", 0);
-    _RS_ASSERT(u8_2.x == 2);
-    _RS_ASSERT(u8_2.y == 3);
-
-    _RS_ASSERT(u8_3.x == 2);
-    _RS_ASSERT(u8_3.y == 3);
-    _RS_ASSERT(u8_3.z == 4);
-
-    _RS_ASSERT(u8_4.x == 2);
-    _RS_ASSERT(u8_4.y == 3);
-    _RS_ASSERT(u8_4.z == 4);
-    _RS_ASSERT(u8_4.w == 5);
-
-    rsDebug("Testing I16", 0);
-    _RS_ASSERT(i16_2.x == 2);
-    _RS_ASSERT(i16_2.y == 3);
-
-    _RS_ASSERT(i16_3.x == 2);
-    _RS_ASSERT(i16_3.y == 3);
-    _RS_ASSERT(i16_3.z == 4);
-
-    _RS_ASSERT(i16_4.x == 2);
-    _RS_ASSERT(i16_4.y == 3);
-    _RS_ASSERT(i16_4.z == 4);
-    _RS_ASSERT(i16_4.w == 5);
-
-    rsDebug("Testing U16", 0);
-    _RS_ASSERT(u16_2.x == 2);
-    _RS_ASSERT(u16_2.y == 3);
-
-    _RS_ASSERT(u16_3.x == 2);
-    _RS_ASSERT(u16_3.y == 3);
-    _RS_ASSERT(u16_3.z == 4);
-
-    _RS_ASSERT(u16_4.x == 2);
-    _RS_ASSERT(u16_4.y == 3);
-    _RS_ASSERT(u16_4.z == 4);
-    _RS_ASSERT(u16_4.w == 5);
-
-    rsDebug("Testing I32", 0);
-    _RS_ASSERT(i32_2.x == 2);
-    _RS_ASSERT(i32_2.y == 3);
-
-    _RS_ASSERT(i32_3.x == 2);
-    _RS_ASSERT(i32_3.y == 3);
-    _RS_ASSERT(i32_3.z == 4);
-
-    _RS_ASSERT(i32_4.x == 2);
-    _RS_ASSERT(i32_4.y == 3);
-    _RS_ASSERT(i32_4.z == 4);
-    _RS_ASSERT(i32_4.w == 5);
-
-    rsDebug("Testing U32", 0);
-    _RS_ASSERT(u32_2.x == 2);
-    _RS_ASSERT(u32_2.y == 3);
-
-    _RS_ASSERT(u32_3.x == 2);
-    _RS_ASSERT(u32_3.y == 3);
-    _RS_ASSERT(u32_3.z == 4);
-
-    _RS_ASSERT(u32_4.x == 2);
-    _RS_ASSERT(u32_4.y == 3);
-    _RS_ASSERT(u32_4.z == 4);
-    _RS_ASSERT(u32_4.w == 5);
-
-    rsDebug("Testing I64", 0);
-    _RS_ASSERT(i64_2.x == 2);
-    _RS_ASSERT(i64_2.y == 3);
-
-    _RS_ASSERT(i64_3.x == 2);
-    _RS_ASSERT(i64_3.y == 3);
-    _RS_ASSERT(i64_3.z == 4);
-
-    _RS_ASSERT(i64_4.x == 2);
-    _RS_ASSERT(i64_4.y == 3);
-    _RS_ASSERT(i64_4.z == 4);
-    _RS_ASSERT(i64_4.w == 5);
-
-    rsDebug("Testing U64", 0);
-    _RS_ASSERT(u64_2.x == 2);
-    _RS_ASSERT(u64_2.y == 3);
-
-    _RS_ASSERT(u64_3.x == 2);
-    _RS_ASSERT(u64_3.y == 3);
-    _RS_ASSERT(u64_3.z == 4);
-
-    _RS_ASSERT(u64_4.x == 2);
-    _RS_ASSERT(u64_4.y == 3);
-    _RS_ASSERT(u64_4.z == 4);
-    _RS_ASSERT(u64_4.w == 5);
-
-    if (failed) {
-        rsDebug("test_vector FAILED", 0);
-    }
-    else {
-        rsDebug("test_vector PASSED", 0);
-    }
-
-    return failed;
-}
-
-void vector_test() {
-    bool failed = false;
-    failed |= test_vector_types();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/SampleTest/Android.mk b/tests/RenderScriptTests/SampleTest/Android.mk
deleted file mode 100644
index f3439b0..0000000
--- a/tests/RenderScriptTests/SampleTest/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Copyright (C) 2012 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := SampleRS
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/SampleTest/AndroidManifest.xml b/tests/RenderScriptTests/SampleTest/AndroidManifest.xml
deleted file mode 100644
index ec115f7..0000000
--- a/tests/RenderScriptTests/SampleTest/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2012 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.rs.sample">
-    <uses-sdk android:minSdkVersion="14" />
-    <application android:label="Sample Test"
-                 android:hardwareAccelerated="true">
-
-        <activity android:name="SampleRSActivity"
-                  android:label="Sample Test">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/SampleTest/res/drawable-nodpi/city.png b/tests/RenderScriptTests/SampleTest/res/drawable-nodpi/city.png
deleted file mode 100644
index 27c4618..0000000
--- a/tests/RenderScriptTests/SampleTest/res/drawable-nodpi/city.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/SampleTest/res/drawable-nodpi/twobytwo.png b/tests/RenderScriptTests/SampleTest/res/drawable-nodpi/twobytwo.png
deleted file mode 100644
index 98cf963..0000000
--- a/tests/RenderScriptTests/SampleTest/res/drawable-nodpi/twobytwo.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/SampleTest/res/layout/rs.xml b/tests/RenderScriptTests/SampleTest/res/layout/rs.xml
deleted file mode 100644
index f2a356f..0000000
--- a/tests/RenderScriptTests/SampleTest/res/layout/rs.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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="fill_parent"
-            android:layout_height="fill_parent"
-            android:id="@+id/toplevel">
-    <ScrollView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
-            <TextView
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/wraplinear"/>
-            <TextureView
-                android:id="@+id/display"
-                android:layout_width="256sp"
-                android:layout_height="256sp" />
-            <TextView
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/clamplinear"/>
-            <TextureView
-                android:id="@+id/display2"
-                android:layout_width="256sp"
-                android:layout_height="256sp" />
-            <TextView
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/wrapnearest"/>
-            <TextureView
-                android:id="@+id/display3"
-                android:layout_width="256sp"
-                android:layout_height="256sp" />
-            <TextView
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/clampnearest"/>
-            <TextureView
-                android:id="@+id/display4"
-                android:layout_width="256sp"
-                android:layout_height="256sp" />
-            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:orientation="horizontal"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content">
-                    <Button
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:text="@string/benchmark"
-                        android:onClick="benchmark"/>
-                    <TextView
-                        android:id="@+id/benchmarkText"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:textSize="8pt"
-                        android:text="@string/benchmark"/>
-            </LinearLayout>
-            </LinearLayout>
-    </ScrollView>
-</LinearLayout>
-
diff --git a/tests/RenderScriptTests/SampleTest/res/values/strings.xml b/tests/RenderScriptTests/SampleTest/res/values/strings.xml
deleted file mode 100644
index a0a2499..0000000
--- a/tests/RenderScriptTests/SampleTest/res/values/strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-* Copyright (C) 2012 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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- General -->
-    <skip />
-    <string name="benchmark">Benchmark</string>
-    <string name="wraplinear">Wrap Linear</string>
-    <string name="clamplinear">Clamp Linear</string>
-    <string name="wrapnearest">Wrap Nearest</string>
-    <string name="clampnearest">Clamp Nearest</string>
-</resources>
diff --git a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java b/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java
deleted file mode 100644
index 77cbf84..0000000
--- a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/SampleRSActivity.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.sample;
-
-import android.app.Activity;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.Config;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.SurfaceTexture;
-import android.os.Bundle;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.Matrix3f;
-import android.renderscript.RenderScript;
-import android.renderscript.Sampler;
-import android.renderscript.Type;
-import android.renderscript.Type.Builder;
-import android.util.Log;
-import android.view.TextureView;
-import android.view.TextureView.SurfaceTextureListener;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-public class SampleRSActivity extends Activity {
-    class TextureViewUpdater implements TextureView.SurfaceTextureListener {
-        private Allocation mOutPixelsAllocation;
-        private Sampler mSampler;
-
-        TextureViewUpdater(Allocation outAlloc, Sampler sampler) {
-            mOutPixelsAllocation = outAlloc;
-            mSampler = sampler;
-        }
-
-        public void onSurfaceTextureUpdated(SurfaceTexture surface) {
-        }
-
-        public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
-            mOutPixelsAllocation.setSurfaceTexture(surface);
-        }
-
-        public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
-            mOutPixelsAllocation.setSurfaceTexture(surface);
-            filterAlloc(mOutPixelsAllocation, mSampler);
-        }
-
-        public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
-            mOutPixelsAllocation.setSurfaceTexture(null);
-            return true;
-        }
-    }
-
-    private final String TAG = "Img";
-    private Bitmap mBitmapTwoByTwo;
-    private Bitmap mBitmapCity;
-
-    private TextView mBenchmarkResult;
-
-    private RenderScript mRS;
-    private Allocation mTwoByTwoAlloc;
-    private Allocation mCityAlloc;
-    private ScriptC_sample mScript;
-
-    public void onStartTrackingTouch(SeekBar seekBar) {
-    }
-
-    public void onStopTrackingTouch(SeekBar seekBar) {
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.rs);
-
-        mBitmapTwoByTwo = loadBitmap(R.drawable.twobytwo);
-        mBitmapCity = loadBitmap(R.drawable.city);
-
-        mBenchmarkResult = (TextView) findViewById(R.id.benchmarkText);
-        mBenchmarkResult.setText("Result: not run");
-
-        mRS = RenderScript.create(this);
-        mTwoByTwoAlloc = Allocation.createFromBitmap(mRS, mBitmapTwoByTwo,
-                                                          Allocation.MipmapControl.MIPMAP_NONE,
-                                                          Allocation.USAGE_SCRIPT);
-
-        mCityAlloc = Allocation.createFromBitmap(mRS, mBitmapCity,
-                                                          Allocation.MipmapControl.MIPMAP_NONE,
-                                                          Allocation.USAGE_SCRIPT);
-
-        Type.Builder b = new Type.Builder(mRS, Element.RGBA_8888(mRS));
-
-        int usage = Allocation.USAGE_SCRIPT | Allocation.USAGE_IO_OUTPUT;
-
-        int outX = 256;
-        int outY = 256;
-
-        // Wrap Linear
-        Allocation outAlloc = Allocation.createTyped(mRS, b.setX(outX).setY(outY).create(), usage);
-        TextureViewUpdater updater = new TextureViewUpdater(outAlloc, Sampler.WRAP_LINEAR(mRS));
-        TextureView displayView = (TextureView) findViewById(R.id.display);
-        displayView.setSurfaceTextureListener(updater);
-
-        // Clamp Linear
-        outAlloc = Allocation.createTyped(mRS, b.setX(outX).setY(outY).create(), usage);
-        updater = new TextureViewUpdater(outAlloc, Sampler.CLAMP_LINEAR(mRS));
-        displayView = (TextureView) findViewById(R.id.display2);
-        displayView.setSurfaceTextureListener(updater);
-
-        // Wrap Nearest
-        outAlloc = Allocation.createTyped(mRS, b.setX(outX).setY(outY).create(), usage);
-        updater = new TextureViewUpdater(outAlloc, Sampler.WRAP_NEAREST(mRS));
-        displayView = (TextureView) findViewById(R.id.display3);
-        displayView.setSurfaceTextureListener(updater);
-
-        // Clamp Nearest
-        outAlloc = Allocation.createTyped(mRS, b.setX(outX).setY(outY).create(), usage);
-        updater = new TextureViewUpdater(outAlloc, Sampler.CLAMP_NEAREST(mRS));
-        displayView = (TextureView) findViewById(R.id.display4);
-        displayView.setSurfaceTextureListener(updater);
-
-        mScript = new ScriptC_sample(mRS, getResources(), R.raw.sample);
-    }
-
-    private Bitmap loadBitmap(int resource) {
-        final BitmapFactory.Options options = new BitmapFactory.Options();
-        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
-        Bitmap b = BitmapFactory.decodeResource(getResources(), resource, options);
-        Bitmap b2 = Bitmap.createBitmap(b.getWidth(), b.getHeight(), b.getConfig());
-        Canvas c = new Canvas(b2);
-        c.drawBitmap(b, 0, 0, null);
-        b.recycle();
-        return b2;
-    }
-
-    private synchronized void filterAlloc(Allocation alloc, Sampler sampler) {
-        long t = java.lang.System.currentTimeMillis();
-        mScript.invoke_setSampleData(alloc, mTwoByTwoAlloc, sampler);
-        mScript.forEach_root(alloc);
-        alloc.ioSendOutput();
-        mRS.finish();
-        t = java.lang.System.currentTimeMillis() - t;
-        Log.i(TAG, "Filter time is: " + t + " ms");
-    }
-
-    public void benchmark(View v) {
-        /*filterAlloc();
-        long t = java.lang.System.currentTimeMillis();
-        filterAlloc();
-        t = java.lang.System.currentTimeMillis() - t;
-        mDisplayView.invalidate();
-        mBenchmarkResult.setText("Result: " + t + " ms");*/
-    }
-}
diff --git a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs b/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
deleted file mode 100644
index e2bf43d..0000000
--- a/tests/RenderScriptTests/SampleTest/src/com/android/rs/sample/sample.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#pragma version(1)
-#pragma rs java_package_name(com.android.rs.sample)
-#include "rs_graphics.rsh"
-
-static rs_allocation sourceAlloc;
-static rs_allocation destAlloc;
-static rs_sampler allocSampler;
-
-void setSampleData(rs_allocation dest, rs_allocation source, rs_sampler sampler) {
-    destAlloc = dest;
-    sourceAlloc = source;
-    allocSampler = sampler;
-}
-
-void root(uchar4 *out, uint32_t x, uint32_t y) {
-
-    float destX = (float)rsAllocationGetDimX(destAlloc) - 1.0f;
-    float destY = (float)rsAllocationGetDimY(destAlloc) - 1.0f;
-
-    float2 uv;
-    uv.x = (float)x / destX;
-    uv.y = (float)y / destY;
-
-    out->xyz = convert_uchar3(rsSample(sourceAlloc, allocSampler, uv*2.0f).xyz);
-    out->w = 0xff;
-}
-
diff --git a/tests/RenderScriptTests/tests/Android.mk b/tests/RenderScriptTests/tests/Android.mk
deleted file mode 100644
index 198693c..0000000
--- a/tests/RenderScriptTests/tests/Android.mk
+++ /dev/null
@@ -1,26 +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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RSTest
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/tests/AndroidManifest.xml b/tests/RenderScriptTests/tests/AndroidManifest.xml
deleted file mode 100644
index b660398..0000000
--- a/tests/RenderScriptTests/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.test">
-    <application 
-        android:label="_RS_Test"
-        android:icon="@drawable/test_pattern">
-        <activity android:name="RSTest"
-                  android:screenOrientation="portrait">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/tests/res/drawable-nodpi/test_pattern.png b/tests/RenderScriptTests/tests/res/drawable-nodpi/test_pattern.png
deleted file mode 100644
index e7d1455..0000000
--- a/tests/RenderScriptTests/tests/res/drawable-nodpi/test_pattern.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTest.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTest.java
deleted file mode 100644
index d1b23fa..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTest.java
+++ /dev/null
@@ -1,91 +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.rs.test;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class RSTest extends Activity {
-    //EventListener mListener = new EventListener();
-
-    private static final String LOG_TAG = "RSTest";
-    private static final boolean DEBUG  = false;
-    private static final boolean LOG_ENABLED = false;
-
-    private RSTestView mView;
-
-    // get the current looper (from your Activity UI thread for instance
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        // Create our Preview view and set it as the content of our
-        // Activity
-        mView = new RSTestView(this);
-        setContentView(mView);
-    }
-
-    @Override
-    protected void onResume() {
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity loses focus
-        super.onResume();
-        mView.resume();
-    }
-
-    @Override
-    protected void onPause() {
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity loses focus
-        super.onPause();
-        mView.pause();
-    }
-
-    @Override
-    protected void onStop() {
-        // Actually kill the app if we are stopping. We don't want to
-        // continue/resume this test ever. It should always start fresh.
-        finish();
-        super.onStop();
-    }
-
-    static void log(String message) {
-        if (LOG_ENABLED) {
-            Log.v(LOG_TAG, message);
-        }
-    }
-
-
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java
deleted file mode 100644
index 8645ae5..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2008-2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-import java.util.ArrayList;
-import java.util.ListIterator;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class RSTestCore {
-    int mWidth;
-    int mHeight;
-    Context mCtx;
-
-    public RSTestCore(Context ctx) {
-        mCtx = ctx;
-    }
-
-    private Resources mRes;
-    private RenderScriptGL mRS;
-
-    private Font mFont;
-    ScriptField_ListAllocs_s mListAllocs;
-    int mLastX;
-    int mLastY;
-    private ScriptC_rslist mScript;
-
-    private ArrayList<UnitTest> unitTests;
-    private ListIterator<UnitTest> test_iter;
-    private UnitTest activeTest;
-    private boolean stopTesting;
-
-    /* Periodic timer for ensuring future tests get scheduled */
-    private Timer mTimer;
-    public static final int RS_TIMER_PERIOD = 100;
-
-    public void init(RenderScriptGL rs, Resources res, int width, int height) {
-        mRS = rs;
-        mRes = res;
-        mWidth = width;
-        mHeight = height;
-        stopTesting = false;
-
-        mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);
-
-        unitTests = new ArrayList<UnitTest>();
-
-        unitTests.add(new UT_primitives(this, mRes, mCtx));
-        unitTests.add(new UT_constant(this, mRes, mCtx));
-        unitTests.add(new UT_vector(this, mRes, mCtx));
-        unitTests.add(new UT_unsigned(this, mRes, mCtx));
-        unitTests.add(new UT_array_init(this, mRes, mCtx));
-        unitTests.add(new UT_array_alloc(this, mRes, mCtx));
-        unitTests.add(new UT_kernel(this, mRes, mCtx));
-        unitTests.add(new UT_kernel_struct(this, mRes, mCtx));
-        unitTests.add(new UT_bug_char(this, mRes, mCtx));
-        unitTests.add(new UT_clamp(this, mRes, mCtx));
-        unitTests.add(new UT_clamp_relaxed(this, mRes, mCtx));
-        unitTests.add(new UT_convert(this, mRes, mCtx));
-        unitTests.add(new UT_convert_relaxed(this, mRes, mCtx));
-        unitTests.add(new UT_copy_test(this, mRes, mCtx));
-        unitTests.add(new UT_rsdebug(this, mRes, mCtx));
-        unitTests.add(new UT_rstime(this, mRes, mCtx));
-        unitTests.add(new UT_rstypes(this, mRes, mCtx));
-        unitTests.add(new UT_alloc(this, mRes, mCtx));
-        unitTests.add(new UT_refcount(this, mRes, mCtx));
-        unitTests.add(new UT_foreach(this, mRes, mCtx));
-        unitTests.add(new UT_foreach_bounds(this, mRes, mCtx));
-        unitTests.add(new UT_noroot(this, mRes, mCtx));
-        unitTests.add(new UT_atomic(this, mRes, mCtx));
-        unitTests.add(new UT_struct(this, mRes, mCtx));
-        unitTests.add(new UT_math(this, mRes, mCtx));
-        unitTests.add(new UT_math_conformance(this, mRes, mCtx));
-        unitTests.add(new UT_math_agree(this, mRes, mCtx));
-        unitTests.add(new UT_min(this, mRes, mCtx));
-        unitTests.add(new UT_int4(this, mRes, mCtx));
-        unitTests.add(new UT_element(this, mRes, mCtx));
-        unitTests.add(new UT_sampler(this, mRes, mCtx));
-        unitTests.add(new UT_program_store(this, mRes, mCtx));
-        unitTests.add(new UT_program_raster(this, mRes, mCtx));
-        unitTests.add(new UT_mesh(this, mRes, mCtx));
-        unitTests.add(new UT_fp_mad(this, mRes, mCtx));
-
-        /*
-        unitTests.add(new UnitTest(null, "<Pass>", 1));
-        unitTests.add(new UnitTest());
-        unitTests.add(new UnitTest(null, "<Fail>", -1));
-
-        for (int i = 0; i < 20; i++) {
-            unitTests.add(new UnitTest(null, "<Pass>", 1));
-        }
-        */
-
-        UnitTest [] uta = new UnitTest[unitTests.size()];
-        uta = unitTests.toArray(uta);
-
-        mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
-        for (int i = 0; i < uta.length; i++) {
-            ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
-            listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
-            listElem.result = uta[i].getResult();
-            mListAllocs.set(listElem, i, false);
-            uta[i].setItem(listElem);
-        }
-
-        mListAllocs.copyAll();
-
-        mScript.bind_gList(mListAllocs);
-
-        mFont = Font.create(mRS, mRes, "serif", Font.Style.BOLD, 8);
-        mScript.set_gFont(mFont);
-
-        mRS.bindRootScript(mScript);
-
-        test_iter = unitTests.listIterator();
-        refreshTestResults(); /* Kick off the first test */
-
-        TimerTask pTask = new TimerTask() {
-            public void run() {
-                refreshTestResults();
-            }
-        };
-
-        mTimer = new Timer();
-        mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
-    }
-
-    public void checkAndRunNextTest() {
-        if (activeTest != null) {
-            if (!activeTest.isAlive()) {
-                /* Properly clean up on our last test */
-                try {
-                    activeTest.join();
-                }
-                catch (InterruptedException e) {
-                }
-                activeTest = null;
-            }
-        }
-
-        if (!stopTesting && activeTest == null) {
-            if (test_iter.hasNext()) {
-                activeTest = test_iter.next();
-                activeTest.start();
-                /* This routine will only get called once when a new test
-                 * should start running. The message handler in UnitTest.java
-                 * ensures this. */
-            }
-            else {
-                if (mTimer != null) {
-                    mTimer.cancel();
-                    mTimer.purge();
-                    mTimer = null;
-                }
-            }
-        }
-    }
-
-    public void refreshTestResults() {
-        checkAndRunNextTest();
-
-        if (mListAllocs != null && mScript != null && mRS != null) {
-            mListAllocs.copyAll();
-
-            mScript.bind_gList(mListAllocs);
-            mRS.bindRootScript(mScript);
-        }
-    }
-
-    public void cleanup() {
-        stopTesting = true;
-        UnitTest t = activeTest;
-
-        /* Stop periodic refresh of testing */
-        if (mTimer != null) {
-            mTimer.cancel();
-            mTimer.purge();
-            mTimer = null;
-        }
-
-        /* Wait to exit until we finish the current test */
-        if (t != null) {
-            try {
-                t.join();
-            }
-            catch (InterruptedException e) {
-            }
-            t = null;
-        }
-
-    }
-
-    public void newTouchPosition(float x, float y, float pressure, int id) {
-    }
-
-    public void onActionDown(int x, int y) {
-        mScript.set_gDY(0.0f);
-        mLastX = x;
-        mLastY = y;
-        refreshTestResults();
-    }
-
-    public void onActionMove(int x, int y) {
-        int dx = mLastX - x;
-        int dy = mLastY - y;
-
-        if (Math.abs(dy) <= 2) {
-            dy = 0;
-        }
-
-        mScript.set_gDY(dy);
-
-        mLastX = x;
-        mLastY = y;
-        refreshTestResults();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestView.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestView.java
deleted file mode 100644
index 368f286..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestView.java
+++ /dev/null
@@ -1,97 +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.rs.test;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class RSTestView extends RSSurfaceView {
-
-    private Context mCtx;
-
-    public RSTestView(Context context) {
-        super(context);
-        mCtx = context;
-        //setFocusable(true);
-    }
-
-    private RenderScriptGL mRS;
-    private RSTestCore mRender;
-
-    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
-        super.surfaceChanged(holder, format, w, h);
-        if (mRS == null) {
-            RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
-            mRS = createRenderScriptGL(sc);
-            mRS.setSurface(holder, w, h);
-            mRender = new RSTestCore(mCtx);
-            mRender.init(mRS, getResources(), w, h);
-        }
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        if(mRS != null) {
-            mRender.cleanup();
-            mRS = null;
-            destroyRenderScriptGL();
-        }
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event)
-    {
-        return super.onKeyDown(keyCode, event);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev)
-    {
-        boolean ret = false;
-        int act = ev.getAction();
-        if (act == ev.ACTION_DOWN) {
-            mRender.onActionDown((int)ev.getX(), (int)ev.getY());
-            ret = true;
-        }
-        else if (act == ev.ACTION_MOVE) {
-            mRender.onActionMove((int)ev.getX(), (int)ev.getY());
-            ret = true;
-        }
-
-        return ret;
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java
deleted file mode 100644
index 3ea942c..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_alloc extends UnitTest {
-    private Resources mRes;
-
-    protected UT_alloc(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Alloc", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_alloc s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        int Z = 0;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        s.set_dimZ(Z);
-        typeBuilder.setX(X).setY(Y);
-        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_a(A);
-        s.set_aRaw(A);
-
-        typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        typeBuilder.setX(X).setY(Y).setFaces(true);
-        Allocation AFaces = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aFaces(AFaces);
-        typeBuilder.setFaces(false).setMipmaps(true);
-        Allocation ALOD = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aLOD(ALOD);
-        typeBuilder.setFaces(true).setMipmaps(true);
-        Allocation AFacesLOD = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aFacesLOD(AFacesLOD);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_alloc s = new ScriptC_alloc(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_root(s.get_aRaw());
-        s.invoke_alloc_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_alloc.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_alloc.java
deleted file mode 100644
index ac01a93..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_alloc.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_array_alloc extends UnitTest {
-    private Resources mRes;
-
-    protected UT_array_alloc(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Array Allocation", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_array_alloc s = new ScriptC_array_alloc(pRS);
-        pRS.setMessageHandler(mRsMessage);
-
-        int dimX = s.get_dimX();
-        Allocation[] Arr = new Allocation[dimX];
-        Type.Builder typeBuilder = new Type.Builder(pRS, Element.I32(pRS));
-        Type T = typeBuilder.setX(1).create();
-        for (int i = 0; i < dimX; i++) {
-            Allocation A = Allocation.createTyped(pRS, T);
-            Arr[i] = A;
-        }
-        s.set_a(Arr);
-
-        s.invoke_array_alloc_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_init.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_init.java
deleted file mode 100644
index c74e4b3..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_array_init.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_array_init extends UnitTest {
-    private Resources mRes;
-
-    protected UT_array_init(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Array Init", ctx);
-        mRes = res;
-    }
-
-    private void checkInit(ScriptC_array_init s) {
-        float[] fa = s.get_fa();
-        _RS_ASSERT("fa[0] == 1.0", fa[0] == 1.0);
-        _RS_ASSERT("fa[1] == 9.9999f", fa[1] == 9.9999f);
-        _RS_ASSERT("fa[2] == 0", fa[2] == 0);
-        _RS_ASSERT("fa[3] == 0", fa[3] == 0);
-        _RS_ASSERT("fa.length == 4", fa.length == 4);
-
-        double[] da = s.get_da();
-        _RS_ASSERT("da[0] == 7.0", da[0] == 7.0);
-        _RS_ASSERT("da[1] == 8.88888", da[1] == 8.88888);
-        _RS_ASSERT("da.length == 2", da.length == 2);
-
-        byte[] ca = s.get_ca();
-        _RS_ASSERT("ca[0] == 'a'", ca[0] == 'a');
-        _RS_ASSERT("ca[1] == 7", ca[1] == 7);
-        _RS_ASSERT("ca[2] == 'b'", ca[2] == 'b');
-        _RS_ASSERT("ca[3] == 'c'", ca[3] == 'c');
-        _RS_ASSERT("ca.length == 4", ca.length == 4);
-
-        short[] sa = s.get_sa();
-        _RS_ASSERT("sa[0] == 1", sa[0] == 1);
-        _RS_ASSERT("sa[1] == 1", sa[1] == 1);
-        _RS_ASSERT("sa[2] == 2", sa[2] == 2);
-        _RS_ASSERT("sa[3] == 3", sa[3] == 3);
-        _RS_ASSERT("sa.length == 4", sa.length == 4);
-
-        int[] ia = s.get_ia();
-        _RS_ASSERT("ia[0] == 5", ia[0] == 5);
-        _RS_ASSERT("ia[1] == 8", ia[1] == 8);
-        _RS_ASSERT("ia[2] == 0", ia[2] == 0);
-        _RS_ASSERT("ia[3] == 0", ia[3] == 0);
-        _RS_ASSERT("ia.length == 4", ia.length == 4);
-
-        long[] la = s.get_la();
-        _RS_ASSERT("la[0] == 13", la[0] == 13);
-        _RS_ASSERT("la[1] == 21", la[1] == 21);
-        _RS_ASSERT("la.length == 4", la.length == 2);
-
-        long[] lla = s.get_lla();
-        _RS_ASSERT("lla[0] == 34", lla[0] == 34);
-        _RS_ASSERT("lla[1] == 0", lla[1] == 0);
-        _RS_ASSERT("lla[2] == 0", lla[2] == 0);
-        _RS_ASSERT("lla[3] == 0", lla[3] == 0);
-        _RS_ASSERT("lla.length == 4", lla.length == 4);
-
-        boolean[] ba = s.get_ba();
-        _RS_ASSERT("ba[0] == true", ba[0] == true);
-        _RS_ASSERT("ba[1] == false", ba[1] == false);
-        _RS_ASSERT("ba[2] == false", ba[2] == false);
-        _RS_ASSERT("ba.length == 3", ba.length == 3);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_array_init s = new ScriptC_array_init(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        checkInit(s);
-        s.invoke_array_init_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_atomic.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_atomic.java
deleted file mode 100644
index 0b8e072..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_atomic.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_atomic extends UnitTest {
-    private Resources mRes;
-
-    protected UT_atomic(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Atomics", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_atomic s = new ScriptC_atomic(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_atomic_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_bug_char.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_bug_char.java
deleted file mode 100644
index faf3a31..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_bug_char.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-import java.util.Arrays;
-
-public class UT_bug_char extends UnitTest {
-    private Resources mRes;
-
-    protected UT_bug_char(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Bug Char", ctx);
-        mRes = res;
-    }
-
-    // packing functions
-    private Byte2 pack_b2(byte[] val) {
-        assert val.length == 2;
-        Log.i("bug_char", "pack_b2 " + val[0] + " " + val[1]);
-        return new Byte2(val[0], val[1]);
-    }
-
-    private byte min(byte v1, byte v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private byte[] min(byte[] v1, byte[] v2) {
-        assert v1.length == v2.length;
-        byte[] rv = new byte[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-
-    private void initializeValues(ScriptC_bug_char s) {
-        byte rand_sc1_0 = (byte)7;
-        byte[] rand_sc2_0 = new byte[2];
-        rand_sc2_0[0] = 11;
-        rand_sc2_0[1] = 21;
-        Log.i("bug_char", "Generated sc2_0 to " + Arrays.toString(rand_sc2_0));
-        byte rand_sc1_1 = (byte)10;
-        byte[] rand_sc2_1 = new byte[2];
-        rand_sc2_1[0] = 13;
-        rand_sc2_1[1] = 15;
-        Log.i("bug_char", "Generated sc2_1 to " + Arrays.toString(rand_sc2_1));
-
-        s.set_rand_sc1_0(rand_sc1_0);
-        s.set_rand_sc2_0(pack_b2(rand_sc2_0));
-        s.set_rand_sc1_1(rand_sc1_1);
-        s.set_rand_sc2_1(pack_b2(rand_sc2_1));
-        // Set results for min
-        s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
-        byte[] min_rand_sc2_raw = min(rand_sc2_0, rand_sc2_1);
-        Log.i("bug_char", "Generating min_rand_sc2_sc2 to " +
-              Arrays.toString(min_rand_sc2_raw));
-        Byte2 min_rand_sc2 = pack_b2(min_rand_sc2_raw);
-        Log.i("bug_char", "Setting min_rand_sc2_sc2 to [" + min_rand_sc2.x +
-              ", " + min_rand_sc2.y + "]");
-        s.set_min_rand_sc2_sc2(min_rand_sc2);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_bug_char s = new ScriptC_bug_char(pRS, mRes,
-                R.raw.bug_char);
-        pRS.setMessageHandler(mRsMessage);
-        initializeValues(s);
-        s.invoke_bug_char_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_clamp.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_clamp.java
deleted file mode 100644
index de98d0c..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_clamp.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_clamp extends UnitTest {
-    private Resources mRes;
-
-    protected UT_clamp(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Clamp (Full)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_clamp s = new ScriptC_clamp(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_clamp_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_clamp_relaxed.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_clamp_relaxed.java
deleted file mode 100644
index 91e7140..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_clamp_relaxed.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_clamp_relaxed extends UnitTest {
-    private Resources mRes;
-
-    protected UT_clamp_relaxed(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Clamp (Relaxed)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_clamp_relaxed s =
-                new ScriptC_clamp_relaxed(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_clamp_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_constant.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_constant.java
deleted file mode 100644
index adda5a3..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_constant.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_constant extends UnitTest {
-    private Resources mRes;
-
-    protected UT_constant(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Const", ctx);
-        mRes = res;
-    }
-
-    private void Assert(boolean b) {
-        if (!b) {
-            failTest();
-        }
-    }
-
-    public void run() {
-        Assert(ScriptC_constant.const_floatTest == 1.99f);
-        Assert(ScriptC_constant.const_doubleTest == 2.05);
-        Assert(ScriptC_constant.const_charTest == -8);
-        Assert(ScriptC_constant.const_shortTest == -16);
-        Assert(ScriptC_constant.const_intTest == -32);
-        Assert(ScriptC_constant.const_longTest == 17179869184l);
-        Assert(ScriptC_constant.const_longlongTest == 68719476736l);
-
-        Assert(ScriptC_constant.const_ucharTest == 8);
-        Assert(ScriptC_constant.const_ushortTest == 16);
-        Assert(ScriptC_constant.const_uintTest == 32);
-        Assert(ScriptC_constant.const_ulongTest == 4611686018427387904L);
-        Assert(ScriptC_constant.const_int64_tTest == -17179869184l);
-        Assert(ScriptC_constant.const_uint64_tTest == 117179869184l);
-
-        Assert(ScriptC_constant.const_boolTest == true);
-
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_convert.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_convert.java
deleted file mode 100644
index adf79bc..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_convert.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_convert extends UnitTest {
-    private Resources mRes;
-
-    protected UT_convert(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Convert", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_convert s = new ScriptC_convert(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_convert_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_convert_relaxed.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_convert_relaxed.java
deleted file mode 100644
index a0757f3..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_convert_relaxed.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_convert_relaxed extends UnitTest {
-    private Resources mRes;
-
-    protected UT_convert_relaxed(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Convert (Relaxed)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_convert_relaxed s =
-                new ScriptC_convert_relaxed(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_convert_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_copy_test.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_copy_test.java
deleted file mode 100644
index 380f6ec..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_copy_test.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-
-public class UT_copy_test extends UnitTest {
-    private Resources mRes;
-    boolean pass = true;
-
-    protected UT_copy_test(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Copy", ctx);
-        mRes = res;
-    }
-
-    void testFloat2(RenderScript rs, ScriptC_copy_test s) {
-        Allocation a1 = Allocation.createSized(rs, Element.F32_2(rs), 1024);
-        Allocation a2 = Allocation.createSized(rs, Element.F32_2(rs), 1024);
-
-        float[] f1 = new float[1024 * 2];
-        float[] f2 = new float[1024 * 2];
-        for (int ct=0; ct < f1.length; ct++) {
-            f1[ct] = (float)ct;
-        }
-        a1.copyFrom(f1);
-
-        s.forEach_copyFloat2(a1, a2);
-
-        a2.copyTo(f2);
-        for (int ct=0; ct < f1.length; ct++) {
-            if (f1[ct] != f2[ct]) {
-                failTest();
-                Log.v("RS Test", "Compare failed at " + ct + ", " + f1[ct] + ", " + f2[ct]);
-            }
-        }
-        a1.destroy();
-        a2.destroy();
-    }
-
-    void testFloat3(RenderScript rs, ScriptC_copy_test s) {
-        Allocation a1 = Allocation.createSized(rs, Element.F32_3(rs), 1024);
-        Allocation a2 = Allocation.createSized(rs, Element.F32_3(rs), 1024);
-
-        float[] f1 = new float[1024 * 4];
-        float[] f2 = new float[1024 * 4];
-        for (int ct=0; ct < f1.length; ct++) {
-            f1[ct] = (float)ct;
-        }
-        a1.copyFrom(f1);
-
-        s.forEach_copyFloat3(a1, a2);
-
-        a2.copyTo(f2);
-        for (int ct=0; ct < f1.length; ct++) {
-            if ((f1[ct] != f2[ct]) && ((ct&3) != 3)) {
-                failTest();
-                Log.v("RS Test", "Compare failed at " + ct + ", " + f1[ct] + ", " + f2[ct]);
-            }
-        }
-        a1.destroy();
-        a2.destroy();
-    }
-
-    void testFloat4(RenderScript rs, ScriptC_copy_test s) {
-        Allocation a1 = Allocation.createSized(rs, Element.F32_4(rs), 1024);
-        Allocation a2 = Allocation.createSized(rs, Element.F32_4(rs), 1024);
-
-        float[] f1 = new float[1024 * 4];
-        float[] f2 = new float[1024 * 4];
-        for (int ct=0; ct < f1.length; ct++) {
-            f1[ct] = (float)ct;
-        }
-        a1.copyFrom(f1);
-
-        s.forEach_copyFloat4(a1, a2);
-
-        a2.copyTo(f2);
-        for (int ct=0; ct < f1.length; ct++) {
-            if (f1[ct] != f2[ct]) {
-                failTest();
-                Log.v("RS Test", "Compare failed at " + ct + ", " + f1[ct] + ", " + f2[ct]);
-            }
-        }
-        a1.destroy();
-        a2.destroy();
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_copy_test s = new ScriptC_copy_test(pRS);
-        pRS.setMessageHandler(mRsMessage);
-
-        testFloat2(pRS, s);
-        testFloat3(pRS, s);
-        testFloat4(pRS, s);
-        s.invoke_sendResult(true);
-
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java
deleted file mode 100644
index 07bcc74..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.Element.*;
-import android.renderscript.Element.DataKind.*;
-import android.renderscript.Element.DataType.*;
-
-public class UT_element extends UnitTest {
-    private Resources mRes;
-
-    Element simpleElem;
-    Element complexElem;
-
-    final String subElemNames[] = {
-        "subElem0",
-        "subElem1",
-        "subElem2",
-        "arrayElem0",
-        "arrayElem1",
-        "subElem3",
-        "subElem4",
-        "subElem5",
-        "subElem6",
-        "subElem_7",
-    };
-
-    final int subElemArraySizes[] = {
-        1,
-        1,
-        1,
-        2,
-        5,
-        1,
-        1,
-        1,
-        1,
-        1,
-    };
-
-    final int subElemOffsets[] = {
-        0,
-        4,
-        8,
-        12,
-        20,
-        40,
-        44,
-        48,
-        64,
-        80,
-    };
-
-    protected UT_element(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Element", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_element s) {
-        simpleElem = Element.F32_3(RS);
-        complexElem = ScriptField_ComplexStruct.createElement(RS);
-        s.set_simpleElem(simpleElem);
-        s.set_complexElem(complexElem);
-
-        ScriptField_ComplexStruct data = new ScriptField_ComplexStruct(RS, 1);
-        s.bind_complexStruct(data);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_element s = new ScriptC_element(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_element_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    private void testJavaSide(RenderScript RS) {
-
-        int subElemCount = simpleElem.getSubElementCount();
-        _RS_ASSERT("subElemCount == 0", subElemCount == 0);
-        _RS_ASSERT("simpleElem.getDataKind() == USER",
-                   simpleElem.getDataKind() == DataKind.USER);
-        _RS_ASSERT("simpleElem.getDataType() == FLOAT_32",
-                   simpleElem.getDataType() == DataType.FLOAT_32);
-
-        subElemCount = complexElem.getSubElementCount();
-        _RS_ASSERT("subElemCount == 10", subElemCount == 10);
-        _RS_ASSERT("complexElem.getDataKind() == USER",
-                   complexElem.getDataKind() == DataKind.USER);
-        _RS_ASSERT("complexElemsimpleElem.getDataType() == NONE",
-                   complexElem.getDataType() == DataType.NONE);
-        _RS_ASSERT("complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof",
-                   complexElem.getBytesSize() == ScriptField_ComplexStruct.Item.sizeof);
-
-        for (int i = 0; i < subElemCount; i ++) {
-            _RS_ASSERT("complexElem.getSubElement(i) != null",
-                       complexElem.getSubElement(i) != null);
-            _RS_ASSERT("complexElem.getSubElementName(i).equals(subElemNames[i])",
-                       complexElem.getSubElementName(i).equals(subElemNames[i]));
-            _RS_ASSERT("complexElem.getSubElementArraySize(i) == subElemArraySizes[i]",
-                       complexElem.getSubElementArraySize(i) == subElemArraySizes[i]);
-            _RS_ASSERT("complexElem.getSubElementOffsetBytes(i) == subElemOffsets[i]",
-                       complexElem.getSubElementOffsetBytes(i) == subElemOffsets[i]);
-        }
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testScriptSide(pRS);
-        testJavaSide(pRS);
-        passTest();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java
deleted file mode 100644
index 6c95109..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2011-2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_foreach extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_foreach(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_foreach s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_foreach s = new ScriptC_foreach(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_root(A);
-        s.invoke_verify_root();
-        s.forEach_foo(A, A);
-        s.invoke_verify_foo();
-        s.invoke_foreach_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java
deleted file mode 100644
index 97f3a32..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_foreach_bounds extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_foreach_bounds(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach (bounds)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_foreach_bounds s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        final int xStart = 2;
-        final int xEnd = 5;
-        final int yStart = 3;
-        final int yEnd = 6;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-        s.set_s(s);
-        s.set_ain(A);
-        s.set_aout(A);
-        s.set_xStart(xStart);
-        s.set_xEnd(xEnd);
-        s.set_yStart(yStart);
-        s.set_yEnd(yEnd);
-        s.forEach_zero(A);
-
-        Script.LaunchOptions sc = new Script.LaunchOptions();
-        sc.setX(xStart, xEnd).setY(yStart, yEnd);
-        s.forEach_root(A, sc);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_foreach_bounds s = new ScriptC_foreach_bounds(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_verify_root();
-        s.invoke_foreach_bounds_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_fp_mad.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_fp_mad.java
deleted file mode 100644
index 5b7344d..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_fp_mad.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_fp_mad extends UnitTest {
-    private Resources mRes;
-
-    protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Fp_Mad", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_fp_mad s = new ScriptC_fp_mad(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_fp_mad_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_int4.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_int4.java
deleted file mode 100644
index 89a2a71..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_int4.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_int4 extends UnitTest {
-    private Resources mRes;
-
-    protected UT_int4(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "int4", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_int4 s = new ScriptC_int4(pRS, mRes, R.raw.int4);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_int4_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_kernel.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_kernel.java
deleted file mode 100644
index e0bd33e..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_kernel.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-
-public class UT_kernel extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-    private Allocation B;
-
-    protected UT_kernel(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Kernels (pass-by-value)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_kernel s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        s.set_dimX(X);
-        typeBuilder.setX(X);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_ain(A);
-        B = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_aout(B);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_kernel s = new ScriptC_kernel(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_init_vars(A);
-        s.forEach_root(A, B);
-        s.invoke_verify_root();
-        s.invoke_kernel_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_kernel_struct.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_kernel_struct.java
deleted file mode 100644
index 8e22810..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_kernel_struct.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-
-public class UT_kernel_struct extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-    private Allocation B;
-
-    protected UT_kernel_struct(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Kernels (struct pass-by-value)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_kernel_struct s) {
-        int X = 5;
-        s.set_dimX(X);
-        ScriptField_simpleStruct t;
-        t = new ScriptField_simpleStruct(RS, X);
-        s.bind_ain(t);
-        A = t.getAllocation();
-        t = new ScriptField_simpleStruct(RS, X);
-        s.bind_aout(t);
-        B = t.getAllocation();
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_kernel_struct s = new ScriptC_kernel_struct(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_init_vars(A);
-        s.forEach_root(A, B);
-        s.invoke_verify_root();
-        s.invoke_kernel_struct_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math.java
deleted file mode 100644
index 8ad462b..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_math extends UnitTest {
-    private Resources mRes;
-
-    protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math s = new ScriptC_math(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_math_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
deleted file mode 100644
index 220509c..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-import java.util.Arrays;
-import java.util.Random;
-
-public class UT_math_agree extends UnitTest {
-    private Resources mRes;
-    private Random rand;
-
-    protected UT_math_agree(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math Agreement", ctx);
-        mRes = res;
-        rand = new Random();
-    }
-
-    // packing functions
-    private Float2 pack_f2(float[] val) {
-        assert val.length == 2;
-        return new Float2(val[0], val[1]);
-    }
-    private Float3 pack_f3(float[] val) {
-        assert val.length == 3;
-        return new Float3(val[0], val[1], val[2]);
-    }
-    private Float4 pack_f4(float[] val) {
-        assert val.length == 4;
-        return new Float4(val[0], val[1], val[2], val[3]);
-    }
-    private Byte2 pack_b2(byte[] val) {
-        assert val.length == 2;
-        return new Byte2(val[0], val[1]);
-    }
-    private Byte3 pack_b3(byte[] val) {
-        assert val.length == 3;
-        return new Byte3(val[0], val[1], val[2]);
-    }
-    private Byte4 pack_b4(byte[] val) {
-        assert val.length == 4;
-        return new Byte4(val[0], val[1], val[2], val[3]);
-    }
-    private Short2 pack_s2(short[] val) {
-        assert val.length == 2;
-        return new Short2(val[0], val[1]);
-    }
-    private Short3 pack_s3(short[] val) {
-        assert val.length == 3;
-        return new Short3(val[0], val[1], val[2]);
-    }
-    private Short4 pack_s4(short[] val) {
-        assert val.length == 4;
-        return new Short4(val[0], val[1], val[2], val[3]);
-    }
-    private Int2 pack_i2(int[] val) {
-        assert val.length == 2;
-        return new Int2(val[0], val[1]);
-    }
-    private Int3 pack_i3(int[] val) {
-        assert val.length == 3;
-        return new Int3(val[0], val[1], val[2]);
-    }
-    private Int4 pack_i4(int[] val) {
-        assert val.length == 4;
-        return new Int4(val[0], val[1], val[2], val[3]);
-    }
-    private Long2 pack_l2(long[] val) {
-        assert val.length == 2;
-        return new Long2(val[0], val[1]);
-    }
-    private Long3 pack_l3(long[] val) {
-        assert val.length == 3;
-        return new Long3(val[0], val[1], val[2]);
-    }
-    private Long4 pack_l4(long[] val) {
-        assert val.length == 4;
-        return new Long4(val[0], val[1], val[2], val[3]);
-    }
-
-    // random vector generation functions
-    private float[] randvec_float(int dim) {
-        float[] fv = new float[dim];
-        for (int i = 0; i < dim; ++i)
-            fv[i] = rand.nextFloat();
-        return fv;
-    }
-    private byte[] randvec_char(int dim) {
-        byte[] cv = new byte[dim];
-        rand.nextBytes(cv);
-        return cv;
-    }
-    private short[] randvec_uchar(int dim) {
-       short[] ucv = new short[dim];
-       for (int i = 0; i < dim; ++i)
-           ucv[i] = (short)rand.nextInt(0x1 << 8);
-       return ucv;
-    }
-    private short[] randvec_short(int dim) {
-        short[] sv = new short[dim];
-        for (int i = 0; i < dim; ++i)
-            sv[i] = (short)rand.nextInt(0x1 << 16);
-        return sv;
-    }
-    private int[] randvec_ushort(int dim) {
-        int[] usv = new int[dim];
-        for (int i = 0; i < dim; ++i)
-            usv[i] = rand.nextInt(0x1 << 16);
-        return usv;
-    }
-    private int[] randvec_int(int dim) {
-        int[] iv = new int[dim];
-        for (int i = 0; i < dim; ++i)
-            iv[i] = rand.nextInt();
-        return iv;
-    }
-    private long[] randvec_uint(int dim) {
-        long[] uiv = new long[dim];
-        for (int i = 0; i < dim; ++i)
-            uiv[i] = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
-        return uiv;
-    }
-    private long[] randvec_long(int dim) {
-        long[] lv = new long[dim];
-        for (int i = 0; i < dim; ++i)
-            lv[i] = rand.nextLong();
-        return lv;
-    }
-    // TODO:  unsigned long generator
-
-    // min reference functions
-    private float min(float v1, float v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private float[] min(float[] v1, float[] v2) {
-        assert v1.length == v2.length;
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private byte min(byte v1, byte v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private byte[] min(byte[] v1, byte[] v2) {
-        assert v1.length == v2.length;
-        byte[] rv = new byte[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private short min(short v1, short v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private short[] min(short[] v1, short[] v2) {
-        assert v1.length == v2.length;
-        short[] rv = new short[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private int min(int v1, int v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private int[] min(int[] v1, int[] v2) {
-        assert v1.length == v2.length;
-        int[] rv = new int[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    private long min(long v1, long v2) {
-        return v1 < v2 ? v1 : v2;
-    }
-    private long[] min(long[] v1, long[] v2) {
-        assert v1.length == v2.length;
-        long[] rv = new long[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2[i]);
-        return rv;
-    }
-    // TODO:  unsigned long version of min
-
-    // max reference functions
-    private float max(float v1, float v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private float[] max(float[] v1, float[] v2) {
-        assert v1.length == v2.length;
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private byte max(byte v1, byte v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private byte[] max(byte[] v1, byte[] v2) {
-        assert v1.length == v2.length;
-        byte[] rv = new byte[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private short max(short v1, short v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private short[] max(short[] v1, short[] v2) {
-        assert v1.length == v2.length;
-        short[] rv = new short[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private int max(int v1, int v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private int[] max(int[] v1, int[] v2) {
-        assert v1.length == v2.length;
-        int[] rv = new int[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    private long max(long v1, long v2) {
-        return v1 > v2 ? v1 : v2;
-    }
-    private long[] max(long[] v1, long[] v2) {
-        assert v1.length == v2.length;
-        long[] rv = new long[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2[i]);
-        return rv;
-    }
-    // TODO:  unsigned long version of max
-
-    // fmin reference functions
-    private float fmin(float v1, float v2) {
-        return min(v1, v2);
-    }
-    private float[] fmin(float[] v1, float[] v2) {
-        return min(v1, v2);
-    }
-    private float[] fmin(float[] v1, float v2) {
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = min(v1[i], v2);
-        return rv;
-    }
-
-    // fmax reference functions
-    private float fmax(float v1, float v2) {
-        return max(v1, v2);
-    }
-    private float[] fmax(float[] v1, float[] v2) {
-        return max(v1, v2);
-    }
-    private float[] fmax(float[] v1, float v2) {
-        float[] rv = new float[v1.length];
-        for (int i = 0; i < v1.length; ++i)
-            rv[i] = max(v1[i], v2);
-        return rv;
-    }
-
-    private void initializeValues(ScriptC_math_agree s) {
-        float x = rand.nextFloat();
-        float y = rand.nextFloat();
-
-        s.set_x(x);
-        s.set_y(y);
-        s.set_result_add(x + y);
-        s.set_result_sub(x - y);
-        s.set_result_mul(x * y);
-        s.set_result_div(x / y);
-
-        // Generate random vectors of all types
-        float rand_f1_0 = rand.nextFloat();
-        float[] rand_f2_0 = randvec_float(2);
-        float[] rand_f3_0 = randvec_float(3);
-        float[] rand_f4_0 = randvec_float(4);
-        float rand_f1_1 = rand.nextFloat();
-        float[] rand_f2_1 = randvec_float(2);
-        float[] rand_f3_1 = randvec_float(3);
-        float[] rand_f4_1 = randvec_float(4);
-        short rand_uc1_0 = (short)rand.nextInt(0x1 << 8);
-        short[] rand_uc2_0 = randvec_uchar(2);
-        short[] rand_uc3_0 = randvec_uchar(3);
-        short[] rand_uc4_0 = randvec_uchar(4);
-        short rand_uc1_1 = (short)rand.nextInt(0x1 << 8);
-        short[] rand_uc2_1 = randvec_uchar(2);
-        short[] rand_uc3_1 = randvec_uchar(3);
-        short[] rand_uc4_1 = randvec_uchar(4);
-        short rand_ss1_0 = (short)rand.nextInt(0x1 << 16);
-        short[] rand_ss2_0 = randvec_short(2);
-        short[] rand_ss3_0 = randvec_short(3);
-        short[] rand_ss4_0 = randvec_short(4);
-        short rand_ss1_1 = (short)rand.nextInt(0x1 << 16);
-        short[] rand_ss2_1 = randvec_short(2);
-        short[] rand_ss3_1 = randvec_short(3);
-        short[] rand_ss4_1 = randvec_short(4);
-        int rand_us1_0 = rand.nextInt(0x1 << 16);
-        int[] rand_us2_0 = randvec_ushort(2);
-        int[] rand_us3_0 = randvec_ushort(3);
-        int[] rand_us4_0 = randvec_ushort(4);
-        int rand_us1_1 = rand.nextInt(0x1 << 16);
-        int[] rand_us2_1 = randvec_ushort(2);
-        int[] rand_us3_1 = randvec_ushort(3);
-        int[] rand_us4_1 = randvec_ushort(4);
-        int rand_si1_0 = rand.nextInt();
-        int[] rand_si2_0 = randvec_int(2);
-        int[] rand_si3_0 = randvec_int(3);
-        int[] rand_si4_0 = randvec_int(4);
-        int rand_si1_1 = rand.nextInt();
-        int[] rand_si2_1 = randvec_int(2);
-        int[] rand_si3_1 = randvec_int(3);
-        int[] rand_si4_1 = randvec_int(4);
-        long rand_ui1_0 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
-        long[] rand_ui2_0 = randvec_uint(2);
-        long[] rand_ui3_0 = randvec_uint(3);
-        long[] rand_ui4_0 = randvec_uint(4);
-        long rand_ui1_1 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
-        long[] rand_ui2_1 = randvec_uint(2);
-        long[] rand_ui3_1 = randvec_uint(3);
-        long[] rand_ui4_1 = randvec_uint(4);
-        long rand_sl1_0 = rand.nextLong();
-        long[] rand_sl2_0 = randvec_long(2);
-        long[] rand_sl3_0 = randvec_long(3);
-        long[] rand_sl4_0 = randvec_long(4);
-        long rand_sl1_1 = rand.nextLong();
-        long[] rand_sl2_1 = randvec_long(2);
-        long[] rand_sl3_1 = randvec_long(3);
-        long[] rand_sl4_1 = randvec_long(4);
-        byte rand_sc1_0 = (byte)rand.nextInt(0x1 << 8);
-        byte[] rand_sc2_0 = randvec_char(2);
-        byte[] rand_sc3_0 = randvec_char(3);
-        byte[] rand_sc4_0 = randvec_char(4);
-        byte rand_sc1_1 = (byte)rand.nextInt(0x1 << 8);
-        byte[] rand_sc2_1 = randvec_char(2);
-        byte[] rand_sc3_1 = randvec_char(3);
-        byte[] rand_sc4_1 = randvec_char(4);
-        // TODO:  generate unsigned long vectors
-
-        // Set random vectors in renderscript code
-        s.set_rand_f1_0(rand_f1_0);
-        s.set_rand_f2_0(pack_f2(rand_f2_0));
-        s.set_rand_f3_0(pack_f3(rand_f3_0));
-        s.set_rand_f4_0(pack_f4(rand_f4_0));
-        s.set_rand_f1_1(rand_f1_1);
-        s.set_rand_f2_1(pack_f2(rand_f2_1));
-        s.set_rand_f3_1(pack_f3(rand_f3_1));
-        s.set_rand_f4_1(pack_f4(rand_f4_1));
-        s.set_rand_uc1_1(rand_uc1_1);
-        s.set_rand_uc2_1(pack_s2(rand_uc2_1));
-        s.set_rand_uc3_1(pack_s3(rand_uc3_1));
-        s.set_rand_uc4_1(pack_s4(rand_uc4_1));
-        s.set_rand_ss1_0(rand_ss1_0);
-        s.set_rand_ss2_0(pack_s2(rand_ss2_0));
-        s.set_rand_ss3_0(pack_s3(rand_ss3_0));
-        s.set_rand_ss4_0(pack_s4(rand_ss4_0));
-        s.set_rand_ss1_1(rand_ss1_1);
-        s.set_rand_ss2_1(pack_s2(rand_ss2_1));
-        s.set_rand_ss3_1(pack_s3(rand_ss3_1));
-        s.set_rand_ss4_1(pack_s4(rand_ss4_1));
-        s.set_rand_us1_0(rand_us1_0);
-        s.set_rand_us2_0(pack_i2(rand_us2_0));
-        s.set_rand_us3_0(pack_i3(rand_us3_0));
-        s.set_rand_us4_0(pack_i4(rand_us4_0));
-        s.set_rand_us1_1(rand_us1_1);
-        s.set_rand_us2_1(pack_i2(rand_us2_1));
-        s.set_rand_us3_1(pack_i3(rand_us3_1));
-        s.set_rand_us4_1(pack_i4(rand_us4_1));
-        s.set_rand_si1_0(rand_si1_0);
-        s.set_rand_si2_0(pack_i2(rand_si2_0));
-        s.set_rand_si3_0(pack_i3(rand_si3_0));
-        s.set_rand_si4_0(pack_i4(rand_si4_0));
-        s.set_rand_si1_1(rand_si1_1);
-        s.set_rand_si2_1(pack_i2(rand_si2_1));
-        s.set_rand_si3_1(pack_i3(rand_si3_1));
-        s.set_rand_si4_1(pack_i4(rand_si4_1));
-        s.set_rand_ui1_0(rand_ui1_0);
-        s.set_rand_ui2_0(pack_l2(rand_ui2_0));
-        s.set_rand_ui3_0(pack_l3(rand_ui3_0));
-        s.set_rand_ui4_0(pack_l4(rand_ui4_0));
-        s.set_rand_ui1_1(rand_ui1_1);
-        s.set_rand_ui2_1(pack_l2(rand_ui2_1));
-        s.set_rand_ui3_1(pack_l3(rand_ui3_1));
-        s.set_rand_ui4_1(pack_l4(rand_ui4_1));
-        s.set_rand_sl1_0(rand_sl1_0);
-        s.set_rand_sl2_0(pack_l2(rand_sl2_0));
-        s.set_rand_sl3_0(pack_l3(rand_sl3_0));
-        s.set_rand_sl4_0(pack_l4(rand_sl4_0));
-        s.set_rand_sl1_1(rand_sl1_1);
-        s.set_rand_sl2_1(pack_l2(rand_sl2_1));
-        s.set_rand_sl3_1(pack_l3(rand_sl3_1));
-        s.set_rand_sl4_1(pack_l4(rand_sl4_1));
-        s.set_rand_uc1_0(rand_uc1_0);
-        s.set_rand_uc2_0(pack_s2(rand_uc2_0));
-        s.set_rand_uc3_0(pack_s3(rand_uc3_0));
-        s.set_rand_uc4_0(pack_s4(rand_uc4_0));
-        s.set_rand_sc1_0(rand_sc1_0);
-        s.set_rand_sc2_0(pack_b2(rand_sc2_0));
-        s.set_rand_sc3_0(pack_b3(rand_sc3_0));
-        s.set_rand_sc4_0(pack_b4(rand_sc4_0));
-        s.set_rand_sc1_1(rand_sc1_1);
-        s.set_rand_sc2_1(pack_b2(rand_sc2_1));
-        s.set_rand_sc3_1(pack_b3(rand_sc3_1));
-        s.set_rand_sc4_1(pack_b4(rand_sc4_1));
-        // TODO:  set unsigned long vectors
-
-        // Set results for min
-        s.set_min_rand_f1_f1(min(rand_f1_0, rand_f1_1));
-        s.set_min_rand_f2_f2(pack_f2(min(rand_f2_0, rand_f2_1)));
-        s.set_min_rand_f3_f3(pack_f3(min(rand_f3_0, rand_f3_1)));
-        s.set_min_rand_f4_f4(pack_f4(min(rand_f4_0, rand_f4_1)));
-        s.set_min_rand_uc1_uc1(min(rand_uc1_0, rand_uc1_1));
-        s.set_min_rand_uc2_uc2(pack_s2(min(rand_uc2_0, rand_uc2_1)));
-        s.set_min_rand_uc3_uc3(pack_s3(min(rand_uc3_0, rand_uc3_1)));
-        s.set_min_rand_uc4_uc4(pack_s4(min(rand_uc4_0, rand_uc4_1)));
-        s.set_min_rand_ss1_ss1(min(rand_ss1_0, rand_ss1_1));
-        s.set_min_rand_ss2_ss2(pack_s2(min(rand_ss2_0, rand_ss2_1)));
-        s.set_min_rand_ss3_ss3(pack_s3(min(rand_ss3_0, rand_ss3_1)));
-        s.set_min_rand_ss4_ss4(pack_s4(min(rand_ss4_0, rand_ss4_1)));
-        s.set_min_rand_us1_us1(min(rand_us1_0, rand_us1_1));
-        s.set_min_rand_us2_us2(pack_i2(min(rand_us2_0, rand_us2_1)));
-        s.set_min_rand_us3_us3(pack_i3(min(rand_us3_0, rand_us3_1)));
-        s.set_min_rand_us4_us4(pack_i4(min(rand_us4_0, rand_us4_1)));
-        s.set_min_rand_si1_si1(min(rand_si1_0, rand_si1_1));
-        s.set_min_rand_si2_si2(pack_i2(min(rand_si2_0, rand_si2_1)));
-        s.set_min_rand_si3_si3(pack_i3(min(rand_si3_0, rand_si3_1)));
-        s.set_min_rand_si4_si4(pack_i4(min(rand_si4_0, rand_si4_1)));
-        s.set_min_rand_ui1_ui1(min(rand_ui1_0, rand_ui1_1));
-        s.set_min_rand_ui2_ui2(pack_l2(min(rand_ui2_0, rand_ui2_1)));
-        s.set_min_rand_ui3_ui3(pack_l3(min(rand_ui3_0, rand_ui3_1)));
-        s.set_min_rand_ui4_ui4(pack_l4(min(rand_ui4_0, rand_ui4_1)));
-        s.set_min_rand_sl1_sl1(min(rand_sl1_0, rand_sl1_1));
-        s.set_min_rand_sl2_sl2(pack_l2(min(rand_sl2_0, rand_sl2_1)));
-        s.set_min_rand_sl3_sl3(pack_l3(min(rand_sl3_0, rand_sl3_1)));
-        s.set_min_rand_sl4_sl4(pack_l4(min(rand_sl4_0, rand_sl4_1)));
-        s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
-        s.set_min_rand_sc2_sc2(pack_b2(min(rand_sc2_0, rand_sc2_1)));
-        s.set_min_rand_sc3_sc3(pack_b3(min(rand_sc3_0, rand_sc3_1)));
-        s.set_min_rand_sc4_sc4(pack_b4(min(rand_sc4_0, rand_sc4_1)));
-        // TODO:  set results for unsigned long min
-
-        // Set results for max
-        s.set_max_rand_f1_f1(max(rand_f1_0, rand_f1_1));
-        s.set_max_rand_f2_f2(pack_f2(max(rand_f2_0, rand_f2_1)));
-        s.set_max_rand_f3_f3(pack_f3(max(rand_f3_0, rand_f3_1)));
-        s.set_max_rand_f4_f4(pack_f4(max(rand_f4_0, rand_f4_1)));
-        s.set_max_rand_uc1_uc1(max(rand_uc1_0, rand_uc1_1));
-        s.set_max_rand_uc2_uc2(pack_s2(max(rand_uc2_0, rand_uc2_1)));
-        s.set_max_rand_uc3_uc3(pack_s3(max(rand_uc3_0, rand_uc3_1)));
-        s.set_max_rand_uc4_uc4(pack_s4(max(rand_uc4_0, rand_uc4_1)));
-        s.set_max_rand_ss1_ss1(max(rand_ss1_0, rand_ss1_1));
-        s.set_max_rand_ss2_ss2(pack_s2(max(rand_ss2_0, rand_ss2_1)));
-        s.set_max_rand_ss3_ss3(pack_s3(max(rand_ss3_0, rand_ss3_1)));
-        s.set_max_rand_ss4_ss4(pack_s4(max(rand_ss4_0, rand_ss4_1)));
-        s.set_max_rand_us1_us1(max(rand_us1_0, rand_us1_1));
-        s.set_max_rand_us2_us2(pack_i2(max(rand_us2_0, rand_us2_1)));
-        s.set_max_rand_us3_us3(pack_i3(max(rand_us3_0, rand_us3_1)));
-        s.set_max_rand_us4_us4(pack_i4(max(rand_us4_0, rand_us4_1)));
-        s.set_max_rand_si1_si1(max(rand_si1_0, rand_si1_1));
-        s.set_max_rand_si2_si2(pack_i2(max(rand_si2_0, rand_si2_1)));
-        s.set_max_rand_si3_si3(pack_i3(max(rand_si3_0, rand_si3_1)));
-        s.set_max_rand_si4_si4(pack_i4(max(rand_si4_0, rand_si4_1)));
-        s.set_max_rand_ui1_ui1(max(rand_ui1_0, rand_ui1_1));
-        s.set_max_rand_ui2_ui2(pack_l2(max(rand_ui2_0, rand_ui2_1)));
-        s.set_max_rand_ui3_ui3(pack_l3(max(rand_ui3_0, rand_ui3_1)));
-        s.set_max_rand_ui4_ui4(pack_l4(max(rand_ui4_0, rand_ui4_1)));
-        s.set_max_rand_sl1_sl1(max(rand_sl1_0, rand_sl1_1));
-        s.set_max_rand_sl2_sl2(pack_l2(max(rand_sl2_0, rand_sl2_1)));
-        s.set_max_rand_sl3_sl3(pack_l3(max(rand_sl3_0, rand_sl3_1)));
-        s.set_max_rand_sl4_sl4(pack_l4(max(rand_sl4_0, rand_sl4_1)));
-        s.set_max_rand_sc1_sc1(max(rand_sc1_0, rand_sc1_1));
-        s.set_max_rand_sc2_sc2(pack_b2(max(rand_sc2_0, rand_sc2_1)));
-        s.set_max_rand_sc3_sc3(pack_b3(max(rand_sc3_0, rand_sc3_1)));
-        s.set_max_rand_sc4_sc4(pack_b4(max(rand_sc4_0, rand_sc4_1)));
-
-        // TODO:  set results for unsigned long max
-
-        // Set results for fmin
-        s.set_fmin_rand_f1_f1(fmin(rand_f1_0, rand_f1_1));
-        s.set_fmin_rand_f2_f2(pack_f2(fmin(rand_f2_0, rand_f2_1)));
-        s.set_fmin_rand_f3_f3(pack_f3(fmin(rand_f3_0, rand_f3_1)));
-        s.set_fmin_rand_f4_f4(pack_f4(fmin(rand_f4_0, rand_f4_1)));
-        s.set_fmin_rand_f2_f1(pack_f2(fmin(rand_f2_0, rand_f1_1)));
-        s.set_fmin_rand_f3_f1(pack_f3(fmin(rand_f3_0, rand_f1_1)));
-        s.set_fmin_rand_f4_f1(pack_f4(fmin(rand_f4_0, rand_f1_1)));
-
-        // Set results for fmax
-        s.set_fmax_rand_f1_f1(fmax(rand_f1_0, rand_f1_1));
-        s.set_fmax_rand_f2_f2(pack_f2(fmax(rand_f2_0, rand_f2_1)));
-        s.set_fmax_rand_f3_f3(pack_f3(fmax(rand_f3_0, rand_f3_1)));
-        s.set_fmax_rand_f4_f4(pack_f4(fmax(rand_f4_0, rand_f4_1)));
-        s.set_fmax_rand_f2_f1(pack_f2(fmax(rand_f2_0, rand_f1_1)));
-        s.set_fmax_rand_f3_f1(pack_f3(fmax(rand_f3_0, rand_f1_1)));
-        s.set_fmax_rand_f4_f1(pack_f4(fmax(rand_f4_0, rand_f1_1)));
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math_agree s = new ScriptC_math_agree(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeValues(s);
-        s.invoke_math_agree_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_conformance.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_conformance.java
deleted file mode 100644
index 620eeb5..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_conformance.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_math_conformance extends UnitTest {
-    private Resources mRes;
-
-    protected UT_math_conformance(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math Conformance", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math_conformance s =
-                new ScriptC_math_conformance(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_math_conformance_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-        passTest();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_mesh.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_mesh.java
deleted file mode 100644
index 29e5025..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_mesh.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.Mesh.*;
-
-public class UT_mesh extends UnitTest {
-    private Resources mRes;
-
-    Mesh mesh;
-
-    protected UT_mesh(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Mesh", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_mesh s) {
-        Allocation vAlloc0 = Allocation.createSized(RS, Element.F32(RS), 10);
-        Allocation vAlloc1 = Allocation.createSized(RS, Element.F32_2(RS), 10);
-
-        Allocation iAlloc0 = Allocation.createSized(RS, Element.I16(RS), 10);
-        Allocation iAlloc2 = Allocation.createSized(RS, Element.I16(RS), 10);
-
-        Mesh.AllocationBuilder mBuilder = new Mesh.AllocationBuilder(RS);
-        mBuilder.addVertexAllocation(vAlloc0);
-        mBuilder.addVertexAllocation(vAlloc1);
-
-        mBuilder.addIndexSetAllocation(iAlloc0, Primitive.POINT);
-        mBuilder.addIndexSetType(Primitive.LINE);
-        mBuilder.addIndexSetAllocation(iAlloc2, Primitive.TRIANGLE);
-
-        s.set_mesh(mBuilder.create());
-        s.set_vertexAlloc0(vAlloc0);
-        s.set_vertexAlloc1(vAlloc1);
-        s.set_indexAlloc0(iAlloc0);
-        s.set_indexAlloc2(iAlloc2);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_mesh s = new ScriptC_mesh(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_mesh_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    private void testJavaSide(RenderScript RS) {
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testScriptSide(pRS);
-        testJavaSide(pRS);
-        passTest();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_min.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_min.java
deleted file mode 100644
index 137cae9..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_min.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_min extends UnitTest {
-    private Resources mRes;
-
-    protected UT_min(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Min (relaxed)", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_min s = new ScriptC_min(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_min_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java
deleted file mode 100644
index 69526a8..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011-2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_noroot extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_noroot(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach (no root)", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_noroot s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_noroot s = new ScriptC_noroot(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_foo(A, A);
-        s.invoke_verify_foo();
-        s.invoke_noroot_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_primitives.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_primitives.java
deleted file mode 100644
index c1234f0..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_primitives.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_primitives extends UnitTest {
-    private Resources mRes;
-
-    protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Primitives", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_primitives s) {
-        float pF = s.get_floatTest();
-        if (pF != 1.99f) {
-            return false;
-        }
-        s.set_floatTest(2.99f);
-
-        double pD = s.get_doubleTest();
-        if (pD != 2.05) {
-            return false;
-        }
-        s.set_doubleTest(3.05);
-
-        byte pC = s.get_charTest();
-        if (pC != -8) {
-            return false;
-        }
-        s.set_charTest((byte)-16);
-
-        short pS = s.get_shortTest();
-        if (pS != -16) {
-            return false;
-        }
-        s.set_shortTest((short)-32);
-
-        int pI = s.get_intTest();
-        if (pI != -32) {
-            return false;
-        }
-        s.set_intTest(-64);
-
-        long pL = s.get_longTest();
-        if (pL != 17179869184l) {
-            return false;
-        }
-        s.set_longTest(17179869185l);
-
-        long puL = s.get_ulongTest();
-        if (puL != 4611686018427387904L) {
-            return false;
-        }
-        s.set_ulongTest(4611686018427387903L);
-
-
-        long pLL = s.get_longlongTest();
-        if (pLL != 68719476736L) {
-            return false;
-        }
-        s.set_longlongTest(68719476735L);
-
-        long pu64 = s.get_uint64_tTest();
-        if (pu64 != 117179869184l) {
-            return false;
-        }
-        s.set_uint64_tTest(117179869185l);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_primitives s = new ScriptC_primitives(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            failTest();
-        } else {
-            s.invoke_primitives_test(0, 0);
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java
deleted file mode 100644
index 046a215..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.ProgramRaster;
-import android.renderscript.ProgramRaster.CullMode;
-
-public class UT_program_raster extends UnitTest {
-    private Resources mRes;
-
-    ProgramRaster pointSpriteEnabled;
-    ProgramRaster cullMode;
-
-    protected UT_program_raster(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ProgramRaster", ctx);
-        mRes = res;
-    }
-
-    private ProgramRaster.Builder getDefaultBuilder(RenderScript RS) {
-        ProgramRaster.Builder b = new ProgramRaster.Builder(RS);
-        b.setCullMode(CullMode.BACK);
-        b.setPointSpriteEnabled(false);
-        return b;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_program_raster s) {
-        ProgramRaster.Builder b = getDefaultBuilder(RS);
-        pointSpriteEnabled = b.setPointSpriteEnabled(true).create();
-        b = getDefaultBuilder(RS);
-        cullMode = b.setCullMode(CullMode.FRONT).create();
-
-        s.set_pointSpriteEnabled(pointSpriteEnabled);
-        s.set_cullMode(cullMode);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_program_raster s = new ScriptC_program_raster(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_program_raster_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    private void testJavaSide(RenderScript RS) {
-        _RS_ASSERT("pointSpriteEnabled.isPointSpriteEnabled() == true",
-                    pointSpriteEnabled.isPointSpriteEnabled() == true);
-        _RS_ASSERT("pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK",
-                    pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK);
-
-        _RS_ASSERT("cullMode.isPointSpriteEnabled() == false",
-                    cullMode.isPointSpriteEnabled() == false);
-        _RS_ASSERT("cullMode.getCullMode() == ProgramRaster.CullMode.FRONT",
-                    cullMode.getCullMode() == ProgramRaster.CullMode.FRONT);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testScriptSide(pRS);
-        testJavaSide(pRS);
-        passTest();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java
deleted file mode 100644
index 6510b6b..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.ProgramStore.BlendDstFunc;
-import android.renderscript.ProgramStore.BlendSrcFunc;
-import android.renderscript.ProgramStore.Builder;
-import android.renderscript.ProgramStore.DepthFunc;
-
-public class UT_program_store extends UnitTest {
-    private Resources mRes;
-
-    ProgramStore ditherEnable;
-    ProgramStore colorRWriteEnable;
-    ProgramStore colorGWriteEnable;
-    ProgramStore colorBWriteEnable;
-    ProgramStore colorAWriteEnable;
-    ProgramStore blendSrc;
-    ProgramStore blendDst;
-    ProgramStore depthWriteEnable;
-    ProgramStore depthFunc;
-
-    protected UT_program_store(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ProgramStore", ctx);
-        mRes = res;
-    }
-
-    private ProgramStore.Builder getDefaultBuilder(RenderScript RS) {
-        ProgramStore.Builder b = new ProgramStore.Builder(RS);
-        b.setBlendFunc(ProgramStore.BlendSrcFunc.ZERO, ProgramStore.BlendDstFunc.ZERO);
-        b.setColorMaskEnabled(false, false, false, false);
-        b.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
-        b.setDepthMaskEnabled(false);
-        b.setDitherEnabled(false);
-        return b;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_program_store s) {
-        ProgramStore.Builder b = getDefaultBuilder(RS);
-        ditherEnable = b.setDitherEnabled(true).create();
-
-        b = getDefaultBuilder(RS);
-        colorRWriteEnable = b.setColorMaskEnabled(true,  false, false, false).create();
-
-        b = getDefaultBuilder(RS);
-        colorGWriteEnable = b.setColorMaskEnabled(false, true,  false, false).create();
-
-        b = getDefaultBuilder(RS);
-        colorBWriteEnable = b.setColorMaskEnabled(false, false, true,  false).create();
-
-        b = getDefaultBuilder(RS);
-        colorAWriteEnable = b.setColorMaskEnabled(false, false, false, true).create();
-
-        b = getDefaultBuilder(RS);
-        blendSrc = b.setBlendFunc(ProgramStore.BlendSrcFunc.DST_COLOR,
-                                  ProgramStore.BlendDstFunc.ZERO).create();
-
-        b = getDefaultBuilder(RS);
-        blendDst = b.setBlendFunc(ProgramStore.BlendSrcFunc.ZERO,
-                                  ProgramStore.BlendDstFunc.DST_ALPHA).create();
-
-        b = getDefaultBuilder(RS);
-        depthWriteEnable = b.setDepthMaskEnabled(true).create();
-
-        b = getDefaultBuilder(RS);
-        depthFunc = b.setDepthFunc(ProgramStore.DepthFunc.GREATER).create();
-
-        s.set_ditherEnable(ditherEnable);
-        s.set_colorRWriteEnable(colorRWriteEnable);
-        s.set_colorGWriteEnable(colorGWriteEnable);
-        s.set_colorBWriteEnable(colorBWriteEnable);
-        s.set_colorAWriteEnable(colorAWriteEnable);
-        s.set_blendSrc(blendSrc);
-        s.set_blendDst(blendDst);
-        s.set_depthWriteEnable(depthWriteEnable);
-        s.set_depthFunc(depthFunc);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_program_store s = new ScriptC_program_store(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_program_store_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    void checkObject(ProgramStore ps,
-                     boolean depthMask,
-                     DepthFunc df,
-                     BlendSrcFunc bsf,
-                     BlendDstFunc bdf,
-                     boolean R,
-                     boolean G,
-                     boolean B,
-                     boolean A,
-                     boolean dither) {
-        _RS_ASSERT("ps.isDepthMaskEnabled() == depthMask", ps.isDepthMaskEnabled() == depthMask);
-        _RS_ASSERT("ps.getDepthFunc() == df", ps.getDepthFunc() == df);
-        _RS_ASSERT("ps.getBlendSrcFunc() == bsf", ps.getBlendSrcFunc() == bsf);
-        _RS_ASSERT("ps.getBlendDstFunc() == bdf", ps.getBlendDstFunc() == bdf);
-        _RS_ASSERT("ps.isColorMaskRedEnabled() == R", ps.isColorMaskRedEnabled() == R);
-        _RS_ASSERT("ps.isColorMaskGreenEnabled() == G", ps.isColorMaskGreenEnabled() == G);
-        _RS_ASSERT("ps.isColorMaskBlueEnabled () == B", ps.isColorMaskBlueEnabled () == B);
-        _RS_ASSERT("ps.isColorMaskAlphaEnabled() == A", ps.isColorMaskAlphaEnabled() == A);
-        _RS_ASSERT("ps.isDitherEnabled() == dither", ps.isDitherEnabled() == dither);
-    }
-
-    void varyBuilderColorAndDither(ProgramStore.Builder pb,
-                                   boolean depthMask,
-                                   DepthFunc df,
-                                   BlendSrcFunc bsf,
-                                   BlendDstFunc bdf) {
-        for (int r = 0; r <= 1; r++) {
-            boolean isR = (r == 1);
-            for (int g = 0; g <= 1; g++) {
-                boolean isG = (g == 1);
-                for (int b = 0; b <= 1; b++) {
-                    boolean isB = (b == 1);
-                    for (int a = 0; a <= 1; a++) {
-                        boolean isA = (a == 1);
-                        for (int dither = 0; dither <= 1; dither++) {
-                            boolean isDither = (dither == 1);
-                            pb.setDitherEnabled(isDither);
-                            pb.setColorMaskEnabled(isR, isG, isB, isA);
-                            ProgramStore ps = pb.create();
-                            checkObject(ps, depthMask, df, bsf, bdf, isR, isG, isB, isA, isDither);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    public void testJavaSide(RenderScript RS) {
-        for (int depth = 0; depth <= 1; depth++) {
-            boolean depthMask = (depth == 1);
-            for (DepthFunc df : DepthFunc.values()) {
-                for (BlendSrcFunc bsf : BlendSrcFunc.values()) {
-                    for (BlendDstFunc bdf : BlendDstFunc.values()) {
-                        ProgramStore.Builder b = new ProgramStore.Builder(RS);
-                        b.setDepthFunc(df);
-                        b.setDepthMaskEnabled(depthMask);
-                        b.setBlendFunc(bsf, bdf);
-                        varyBuilderColorAndDither(b, depthMask, df, bsf, bdf);
-                    }
-                }
-            }
-        }
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testJavaSide(pRS);
-        testScriptSide(pRS);
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_refcount.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_refcount.java
deleted file mode 100644
index 22bbd2f..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_refcount.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_refcount extends UnitTest {
-    private Resources mRes;
-
-    protected UT_refcount(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Refcount", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_refcount s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 500;
-        int Y = 700;
-        typeBuilder.setX(X).setY(Y);
-        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_globalA(A);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        pRS.setMessageHandler(mRsMessage);
-        ScriptC_refcount s = new ScriptC_refcount(pRS);
-        initializeGlobals(pRS, s);
-        s.invoke_refcount_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rsdebug.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rsdebug.java
deleted file mode 100644
index 548288b..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rsdebug.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rsdebug extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsDebug", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rsdebug s = new ScriptC_rsdebug(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rsdebug(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rstime.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rstime.java
deleted file mode 100644
index f000412..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rstime.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstime extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTime", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstime s = new ScriptC_rstime(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.setTimeZone("America/Los_Angeles");
-        s.invoke_test_rstime(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rstypes.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rstypes.java
deleted file mode 100644
index f677f10..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_rstypes.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstypes extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTypes", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstypes s = new ScriptC_rstypes(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rstypes(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_sampler.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_sampler.java
deleted file mode 100644
index 00c850c..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_sampler.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.renderscript.Sampler;
-import android.renderscript.Sampler.Value;
-
-public class UT_sampler extends UnitTest {
-    private Resources mRes;
-
-    Sampler minification;
-    Sampler magnification;
-    Sampler wrapS;
-    Sampler wrapT;
-    Sampler anisotropy;
-
-    protected UT_sampler(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Sampler", ctx);
-        mRes = res;
-    }
-
-    private Sampler.Builder getDefaultBuilder(RenderScript RS) {
-        Sampler.Builder b = new Sampler.Builder(RS);
-        b.setMinification(Value.NEAREST);
-        b.setMagnification(Value.NEAREST);
-        b.setWrapS(Value.CLAMP);
-        b.setWrapT(Value.CLAMP);
-        b.setAnisotropy(1.0f);
-        return b;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_sampler s) {
-        Sampler.Builder b = getDefaultBuilder(RS);
-        b.setMinification(Value.LINEAR_MIP_LINEAR);
-        minification = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setMagnification(Value.LINEAR);
-        magnification = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setWrapS(Value.WRAP);
-        wrapS = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setWrapT(Value.WRAP);
-        wrapT = b.create();
-
-        b = getDefaultBuilder(RS);
-        b.setAnisotropy(8.0f);
-        anisotropy = b.create();
-
-        s.set_minification(minification);
-        s.set_magnification(magnification);
-        s.set_wrapS(wrapS);
-        s.set_wrapT(wrapT);
-        s.set_anisotropy(anisotropy);
-    }
-
-    private void testScriptSide(RenderScript pRS) {
-        ScriptC_sampler s = new ScriptC_sampler(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.invoke_sampler_test();
-        pRS.finish();
-        waitForMessage();
-    }
-
-    private void testJavaSide(RenderScript RS) {
-        _RS_ASSERT("minification.getMagnification() == Sampler.Value.NEAREST",
-                    minification.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR",
-                    minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR);
-        _RS_ASSERT("minification.getWrapS() == Sampler.Value.CLAMP",
-                    minification.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("minification.getWrapT() == Sampler.Value.CLAMP",
-                    minification.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("minification.getAnisotropy() == 1.0f",
-                    minification.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("magnification.getMagnification() == Sampler.Value.LINEAR",
-                    magnification.getMagnification() == Sampler.Value.LINEAR);
-        _RS_ASSERT("magnification.getMinification() == Sampler.Value.NEAREST",
-                    magnification.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("magnification.getWrapS() == Sampler.Value.CLAMP",
-                    magnification.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("magnification.getWrapT() == Sampler.Value.CLAMP",
-                    magnification.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("magnification.getAnisotropy() == 1.0f",
-                    magnification.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("wrapS.getMagnification() == Sampler.Value.NEAREST",
-                    wrapS.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapS.getMinification() == Sampler.Value.NEAREST",
-                    wrapS.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapS.getWrapS() == Sampler.Value.WRAP",
-                    wrapS.getWrapS() == Sampler.Value.WRAP);
-        _RS_ASSERT("wrapS.getWrapT() == Sampler.Value.CLAMP",
-                    wrapS.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("wrapS.getAnisotropy() == 1.0f",
-                    wrapS.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("wrapT.getMagnification() == Sampler.Value.NEAREST",
-                    wrapT.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapT.getMinification() == Sampler.Value.NEAREST",
-                    wrapT.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("wrapT.getWrapS() == Sampler.Value.CLAMP",
-                    wrapT.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("wrapT.getWrapT() == Sampler.Value.WRAP",
-                    wrapT.getWrapT() == Sampler.Value.WRAP);
-        _RS_ASSERT("wrapT.getAnisotropy() == 1.0f",
-                    wrapT.getAnisotropy() == 1.0f);
-
-        _RS_ASSERT("anisotropy.getMagnification() == Sampler.Value.NEAREST",
-                    anisotropy.getMagnification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("anisotropy.getMinification() == Sampler.Value.NEAREST",
-                    anisotropy.getMinification() == Sampler.Value.NEAREST);
-        _RS_ASSERT("anisotropy.getWrapS() == Sampler.Value.CLAMP",
-                    anisotropy.getWrapS() == Sampler.Value.CLAMP);
-        _RS_ASSERT("anisotropy.getWrapT() == Sampler.Value.CLAMP",
-                    anisotropy.getWrapT() == Sampler.Value.CLAMP);
-        _RS_ASSERT("anisotropy.getAnisotropy() == 1.0f",
-                    anisotropy.getAnisotropy() == 8.0f);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        testScriptSide(pRS);
-        testJavaSide(pRS);
-        passTest();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_struct.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_struct.java
deleted file mode 100644
index 6f47b72..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_struct.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_struct extends UnitTest {
-    private Resources mRes;
-
-    protected UT_struct(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Struct", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_struct s = new ScriptC_struct(pRS);
-        pRS.setMessageHandler(mRsMessage);
-
-        ScriptField_Point2 p = new ScriptField_Point2(pRS, 1);
-        ScriptField_Point2.Item i = new ScriptField_Point2.Item();
-        int val = 100;
-        i.x = val;
-        i.y = val;
-        p.set(i, 0, true);
-        s.bind_point2(p);
-        s.invoke_struct_test(val);
-        pRS.finish();
-        waitForMessage();
-
-        val = 200;
-        p.set_x(0, val, true);
-        p.set_y(0, val, true);
-        s.invoke_struct_test(val);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_unsigned.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_unsigned.java
deleted file mode 100644
index 9ea0f8a..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_unsigned.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2012 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_unsigned extends UnitTest {
-    private Resources mRes;
-
-    protected UT_unsigned(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Unsigned", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_unsigned s) {
-        short pUC = s.get_uc();
-        if (pUC != 5) {
-            return false;
-        }
-        s.set_uc((short)129);
-
-        long pUI = s.get_ui();
-        if (pUI != 37) {
-            return false;
-        }
-        s.set_ui(0x7fffffff);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_unsigned s = new ScriptC_unsigned(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            failTest();
-        } else {
-            s.invoke_unsigned_test();
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_vector.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_vector.java
deleted file mode 100644
index 91cc0af..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_vector.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_vector extends UnitTest {
-    private Resources mRes;
-
-    protected UT_vector(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Vector", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_vector s) {
-        Float2 F2 = s.get_f2();
-        if (F2.x != 1.0f || F2.y != 2.0f) {
-            return false;
-        }
-        F2.x = 2.99f;
-        F2.y = 3.99f;
-        s.set_f2(F2);
-
-        Float3 F3 = s.get_f3();
-        if (F3.x != 1.0f || F3.y != 2.0f || F3.z != 3.0f) {
-            return false;
-        }
-        F3.x = 2.99f;
-        F3.y = 3.99f;
-        F3.z = 4.99f;
-        s.set_f3(F3);
-
-        Float4 F4 = s.get_f4();
-        if (F4.x != 1.0f || F4.y != 2.0f || F4.z != 3.0f || F4.w != 4.0f) {
-            return false;
-        }
-        F4.x = 2.99f;
-        F4.y = 3.99f;
-        F4.z = 4.99f;
-        F4.w = 5.99f;
-        s.set_f4(F4);
-
-        Double2 D2 = s.get_d2();
-        if (D2.x != 1.0 || D2.y != 2.0) {
-            return false;
-        }
-        D2.x = 2.99;
-        D2.y = 3.99;
-        s.set_d2(D2);
-
-        Double3 D3 = s.get_d3();
-        if (D3.x != 1.0 || D3.y != 2.0 || D3.z != 3.0) {
-            return false;
-        }
-        D3.x = 2.99;
-        D3.y = 3.99;
-        D3.z = 4.99;
-        s.set_d3(D3);
-
-        Double4 D4 = s.get_d4();
-        if (D4.x != 1.0 || D4.y != 2.0 || D4.z != 3.0 || D4.w != 4.0) {
-            return false;
-        }
-        D4.x = 2.99;
-        D4.y = 3.99;
-        D4.z = 4.99;
-        D4.w = 5.99;
-        s.set_d4(D4);
-
-        Byte2 B2 = s.get_i8_2();
-        if (B2.x != 1 || B2.y != 2) {
-            return false;
-        }
-        B2.x = 2;
-        B2.y = 3;
-        s.set_i8_2(B2);
-
-        Byte3 B3 = s.get_i8_3();
-        if (B3.x != 1 || B3.y != 2 || B3.z != 3) {
-            return false;
-        }
-        B3.x = 2;
-        B3.y = 3;
-        B3.z = 4;
-        s.set_i8_3(B3);
-
-        Byte4 B4 = s.get_i8_4();
-        if (B4.x != 1 || B4.y != 2 || B4.z != 3 || B4.w != 4) {
-            return false;
-        }
-        B4.x = 2;
-        B4.y = 3;
-        B4.z = 4;
-        B4.w = 5;
-        s.set_i8_4(B4);
-
-        Short2 S2 = s.get_u8_2();
-        if (S2.x != 1 || S2.y != 2) {
-            return false;
-        }
-        S2.x = 2;
-        S2.y = 3;
-        s.set_u8_2(S2);
-
-        Short3 S3 = s.get_u8_3();
-        if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
-            return false;
-        }
-        S3.x = 2;
-        S3.y = 3;
-        S3.z = 4;
-        s.set_u8_3(S3);
-
-        Short4 S4 = s.get_u8_4();
-        if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
-            return false;
-        }
-        S4.x = 2;
-        S4.y = 3;
-        S4.z = 4;
-        S4.w = 5;
-        s.set_u8_4(S4);
-
-        S2 = s.get_i16_2();
-        if (S2.x != 1 || S2.y != 2) {
-            return false;
-        }
-        S2.x = 2;
-        S2.y = 3;
-        s.set_i16_2(S2);
-
-        S3 = s.get_i16_3();
-        if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
-            return false;
-        }
-        S3.x = 2;
-        S3.y = 3;
-        S3.z = 4;
-        s.set_i16_3(S3);
-
-        S4 = s.get_i16_4();
-        if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
-            return false;
-        }
-        S4.x = 2;
-        S4.y = 3;
-        S4.z = 4;
-        S4.w = 5;
-        s.set_i16_4(S4);
-
-        Int2 I2 = s.get_u16_2();
-        if (I2.x != 1 || I2.y != 2) {
-            return false;
-        }
-        I2.x = 2;
-        I2.y = 3;
-        s.set_u16_2(I2);
-
-        Int3 I3 = s.get_u16_3();
-        if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
-            return false;
-        }
-        I3.x = 2;
-        I3.y = 3;
-        I3.z = 4;
-        s.set_u16_3(I3);
-
-        Int4 I4 = s.get_u16_4();
-        if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
-            return false;
-        }
-        I4.x = 2;
-        I4.y = 3;
-        I4.z = 4;
-        I4.w = 5;
-        s.set_u16_4(I4);
-
-        I2 = s.get_i32_2();
-        if (I2.x != 1 || I2.y != 2) {
-            return false;
-        }
-        I2.x = 2;
-        I2.y = 3;
-        s.set_i32_2(I2);
-
-        I3 = s.get_i32_3();
-        if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
-            return false;
-        }
-        I3.x = 2;
-        I3.y = 3;
-        I3.z = 4;
-        s.set_i32_3(I3);
-
-        I4 = s.get_i32_4();
-        if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
-            return false;
-        }
-        I4.x = 2;
-        I4.y = 3;
-        I4.z = 4;
-        I4.w = 5;
-        s.set_i32_4(I4);
-
-        Long2 L2 = s.get_u32_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_u32_2(L2);
-
-        Long3 L3 = s.get_u32_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_u32_3(L3);
-
-        Long4 L4 = s.get_u32_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_u32_4(L4);
-
-        L2 = s.get_i64_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_i64_2(L2);
-
-        L3 = s.get_i64_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_i64_3(L3);
-
-        L4 = s.get_i64_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_i64_4(L4);
-
-        L2 = s.get_u64_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_u64_2(L2);
-
-        L3 = s.get_u64_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_u64_3(L3);
-
-        L4 = s.get_u64_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_u64_4(L4);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_vector s = new ScriptC_vector(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            failTest();
-        } else {
-            s.invoke_vector_test();
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UnitTest.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UnitTest.java
deleted file mode 100644
index fbac124..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UnitTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test;
-import android.content.Context;
-import android.util.Log;
-import android.renderscript.RenderScript.RSMessageHandler;
-
-public class UnitTest extends Thread {
-    public String name;
-    private int result;
-    private ScriptField_ListAllocs_s.Item mItem;
-    private RSTestCore mRSTC;
-    private boolean msgHandled;
-    protected Context mCtx;
-
-    /* These constants must match those in shared.rsh */
-    public static final int RS_MSG_TEST_PASSED = 100;
-    public static final int RS_MSG_TEST_FAILED = 101;
-
-    private static int numTests = 0;
-    public int testID;
-
-    protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
-        super();
-        mRSTC = rstc;
-        name = n;
-        msgHandled = false;
-        mCtx = ctx;
-        result = initResult;
-        testID = numTests++;
-    }
-
-    protected UnitTest(RSTestCore rstc, String n, Context ctx) {
-        this(rstc, n, 0, ctx);
-    }
-
-    protected UnitTest(RSTestCore rstc, Context ctx) {
-        this (rstc, "<Unknown>", ctx);
-    }
-
-    protected UnitTest(Context ctx) {
-        this (null, ctx);
-    }
-
-    protected void _RS_ASSERT(String message, boolean b) {
-        if(b == false) {
-            Log.e(name, message + " FAILED");
-            failTest();
-        }
-    }
-
-    private void updateUI() {
-        if (mItem != null) {
-            mItem.result = result;
-            msgHandled = true;
-            try {
-                mRSTC.refreshTestResults();
-            }
-            catch (IllegalStateException e) {
-                /* Ignore the case where our message receiver has been
-                   disconnected. This happens when we leave the application
-                   before it finishes running all of the unit tests. */
-            }
-        }
-    }
-
-    protected RSMessageHandler mRsMessage = new RSMessageHandler() {
-        public void run() {
-            if (result == 0) {
-                switch (mID) {
-                    case RS_MSG_TEST_PASSED:
-                        result = 1;
-                        break;
-                    case RS_MSG_TEST_FAILED:
-                        result = -1;
-                        break;
-                    default:
-                        RSTest.log("Unit test got unexpected message");
-                        return;
-                }
-            }
-
-            updateUI();
-        }
-    };
-
-    public void waitForMessage() {
-        while (!msgHandled) {
-            yield();
-        }
-    }
-
-    public int getResult() {
-        return result;
-    }
-
-    public void failTest() {
-        result = -1;
-        updateUI();
-    }
-
-    public void passTest() {
-        if (result != -1) {
-            result = 1;
-        }
-        updateUI();
-    }
-
-    public void setItem(ScriptField_ListAllocs_s.Item item) {
-        mItem = item;
-    }
-
-    public void run() {
-        /* This method needs to be implemented for each subclass */
-        if (mRSTC != null) {
-            mRSTC.refreshTestResults();
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs
deleted file mode 100644
index 1b5e2ac..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "shared.rsh"
-
-int *a;
-int dimX;
-int dimY;
-int dimZ;
-
-rs_allocation aRaw;
-rs_allocation aFaces;
-rs_allocation aLOD;
-rs_allocation aFacesLOD;
-
-void root(int *o, uint32_t x, uint32_t y) {
-    *o = x + y * dimX;
-}
-
-static bool test_alloc_dims() {
-    bool failed = false;
-    int i, j;
-
-    _RS_ASSERT(rsAllocationGetDimX(aRaw) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aRaw) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aRaw) == dimZ);
-
-    // Test 2D addressing
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            rsDebug("Verifying ", i + j * dimX);
-            const void *p = rsGetElementAt(aRaw, i, j);
-            int val = *(const int *)p;
-            _RS_ASSERT(val == (i + j * dimX));
-        }
-    }
-
-    // Test 1D addressing
-    for (i = 0; i < dimX; i++) {
-        rsDebug("Verifying ", i);
-        const void *p = rsGetElementAt(aRaw, i);
-        int val = *(const int *)p;
-        _RS_ASSERT(val == i);
-    }
-
-    // Test 3D addressing
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            rsDebug("Verifying ", i + j * dimX);
-            const void *p = rsGetElementAt(aRaw, i, j, 0);
-            int val = *(const int *)p;
-            _RS_ASSERT(val == (i + j * dimX));
-        }
-    }
-
-    _RS_ASSERT(rsAllocationGetDimX(aFaces) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aFaces) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aFaces) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aFaces) != 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aFaces) == 0);
-
-    _RS_ASSERT(rsAllocationGetDimX(aLOD) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aLOD) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aLOD) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aLOD) == 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aLOD) != 0);
-
-    _RS_ASSERT(rsAllocationGetDimX(aFacesLOD) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aFacesLOD) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aFacesLOD) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aFacesLOD) != 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aFacesLOD) != 0);
-
-    if (failed) {
-        rsDebug("test_alloc_dims FAILED", 0);
-    }
-    else {
-        rsDebug("test_alloc_dims PASSED", 0);
-    }
-
-    return failed;
-}
-
-void alloc_test() {
-    bool failed = false;
-    failed |= test_alloc_dims();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/array_alloc.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/array_alloc.rs
deleted file mode 100644
index 74ffdb1..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/array_alloc.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "shared.rsh"
-
-const int dimX = 20;
-rs_allocation a[dimX];
-
-void array_alloc_test() {
-    bool failed = false;
-
-    for (int i = 0; i < dimX; i++) {
-        rsDebug("i: ", i);
-        _RS_ASSERT(rsAllocationGetDimX(a[i]) == 1);
-    }
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/array_init.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/array_init.rs
deleted file mode 100644
index 842249a..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/array_init.rs
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "shared.rsh"
-
-// Testing constant array initialization
-float fa[4] = {1.0, 9.9999f};
-double da[2] = {7.0, 8.88888};
-char ca[4] = {'a', 7, 'b', 'c'};
-short sa[4] = {1, 1, 2, 3};
-int ia[4] = {5, 8};
-long la[2] = {13, 21};
-long long lla[4] = {34};
-bool ba[3] = {true, false};
-
-void array_init_test() {
-    bool failed = false;
-
-    _RS_ASSERT(fa[0] == 1.0);
-    _RS_ASSERT(fa[1] == 9.9999f);
-    _RS_ASSERT(fa[2] == 0);
-    _RS_ASSERT(fa[3] == 0);
-
-    _RS_ASSERT(da[0] == 7.0);
-    _RS_ASSERT(da[1] == 8.88888);
-
-    _RS_ASSERT(ca[0] == 'a');
-    _RS_ASSERT(ca[1] == 7);
-    _RS_ASSERT(ca[2] == 'b');
-    _RS_ASSERT(ca[3] == 'c');
-
-    _RS_ASSERT(sa[0] == 1);
-    _RS_ASSERT(sa[1] == 1);
-    _RS_ASSERT(sa[2] == 2);
-    _RS_ASSERT(sa[3] == 3);
-
-    _RS_ASSERT(ia[0] == 5);
-    _RS_ASSERT(ia[1] == 8);
-    _RS_ASSERT(ia[2] == 0);
-    _RS_ASSERT(ia[3] == 0);
-
-    _RS_ASSERT(la[0] == 13);
-    _RS_ASSERT(la[1] == 21);
-
-    _RS_ASSERT(lla[0] == 34);
-    _RS_ASSERT(lla[1] == 0);
-    _RS_ASSERT(lla[2] == 0);
-    _RS_ASSERT(lla[3] == 0);
-
-    _RS_ASSERT(ba[0] == true);
-    _RS_ASSERT(ba[1] == false);
-    _RS_ASSERT(ba[2] == false);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/atomic.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/atomic.rs
deleted file mode 100644
index f0a5041..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/atomic.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "shared.rsh"
-
-// Testing atomic operations
-static bool testUMax(uint32_t dst, uint32_t src) {
-    bool failed = false;
-    uint32_t old = dst;
-    uint32_t expect = (dst > src ? dst : src);
-    uint32_t ret = rsAtomicMax(&dst, src);
-    _RS_ASSERT(old == ret);
-    _RS_ASSERT(dst == expect);
-    return failed;
-}
-
-static bool testUMin(uint32_t dst, uint32_t src) {
-    bool failed = false;
-    uint32_t old = dst;
-    uint32_t expect = (dst < src ? dst : src);
-    uint32_t ret = rsAtomicMin(&dst, src);
-    _RS_ASSERT(old == ret);
-    _RS_ASSERT(dst == expect);
-    return failed;
-}
-
-static bool testUCas(uint32_t dst, uint32_t cmp, uint32_t swp) {
-    bool failed = false;
-    uint32_t old = dst;
-    uint32_t expect = (dst == cmp ? swp : dst);
-    uint32_t ret = rsAtomicCas(&dst, cmp, swp);
-    _RS_ASSERT(old == ret);
-    _RS_ASSERT(dst == expect);
-    return failed;
-}
-
-static bool test_atomics() {
-    bool failed = false;
-
-    failed |= testUMax(5, 6);
-    failed |= testUMax(6, 5);
-    failed |= testUMax(5, 0xf0000006);
-    failed |= testUMax(0xf0000006, 5);
-
-    failed |= testUMin(5, 6);
-    failed |= testUMin(6, 5);
-    failed |= testUMin(5, 0xf0000006);
-    failed |= testUMin(0xf0000006, 5);
-
-    failed |= testUCas(4, 4, 5);
-    failed |= testUCas(4, 5, 5);
-    failed |= testUCas(5, 5, 4);
-    failed |= testUCas(5, 4, 4);
-    failed |= testUCas(0xf0000004, 0xf0000004, 0xf0000005);
-    failed |= testUCas(0xf0000004, 0xf0000005, 0xf0000005);
-    failed |= testUCas(0xf0000005, 0xf0000005, 0xf0000004);
-    failed |= testUCas(0xf0000005, 0xf0000004, 0xf0000004);
-
-    if (failed) {
-        rsDebug("test_atomics FAILED", 0);
-    }
-    else {
-        rsDebug("test_atomics PASSED", 0);
-    }
-
-    return failed;
-}
-
-void atomic_test() {
-    bool failed = false;
-    failed |= test_atomics();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/bug_char.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/bug_char.rs
deleted file mode 100644
index dcd7b72..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/bug_char.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "shared.rsh"
-
-char rand_sc1_0, rand_sc1_1;
-char2 rand_sc2_0, rand_sc2_1;
-
-char min_rand_sc1_sc1;
-char2 min_rand_sc2_sc2;
-
-static bool test_bug_char() {
-    bool failed = false;
-
-    rsDebug("rand_sc2_0.x: ", rand_sc2_0.x);
-    rsDebug("rand_sc2_0.y: ", rand_sc2_0.y);
-    rsDebug("rand_sc2_1.x: ", rand_sc2_1.x);
-    rsDebug("rand_sc2_1.y: ", rand_sc2_1.y);
-    char temp_sc1;
-    char2 temp_sc2;
-
-    temp_sc1 = min( rand_sc1_0, rand_sc1_1 );
-    if (temp_sc1 != min_rand_sc1_sc1) {
-        rsDebug("temp_sc1", temp_sc1);
-        failed = true;
-    }
-    rsDebug("broken", 'y');
-
-    temp_sc2 = min( rand_sc2_0, rand_sc2_1 );
-    if (temp_sc2.x != min_rand_sc2_sc2.x
-            || temp_sc2.y != min_rand_sc2_sc2.y) {
-        failed = true;
-    }
-
-
-    return failed;
-}
-
-void bug_char_test() {
-    bool failed = false;
-    failed |= test_bug_char();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/clamp.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/clamp.rs
deleted file mode 100644
index 28b00bd..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/clamp.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "shared.rsh"
-
-static bool test_clamp_vector() {
-    bool failed = false;
-
-    float2 src2 = { 2.0f, 2.0f};
-    float2 min2 = { 0.5f, -3.0f};
-    float2 max2 = { 1.0f, 9.0f};
-
-    float2 res2 = clamp(src2, min2, max2);
-    _RS_ASSERT(res2.x == 1.0f);
-    _RS_ASSERT(res2.y == 2.0f);
-
-
-    float3 src3 = { 2.0f, 2.0f, 1.0f};
-    float3 min3 = { 0.5f, -3.0f, 3.0f};
-    float3 max3 = { 1.0f, 9.0f, 4.0f};
-
-    float3 res3 = clamp(src3, min3, max3);
-    _RS_ASSERT(res3.x == 1.0f);
-    _RS_ASSERT(res3.y == 2.0f);
-    _RS_ASSERT(res3.z == 3.0f);
-
-
-    float4 src4 = { 2.0f, 2.0f, 1.0f, 4.0f };
-    float4 min4 = { 0.5f, -3.0f, 3.0f, 4.0f };
-    float4 max4 = { 1.0f, 9.0f, 4.0f, 4.0f };
-
-    float4 res4 = clamp(src4, min4, max4);
-    _RS_ASSERT(res4.x == 1.0f);
-    _RS_ASSERT(res4.y == 2.0f);
-    _RS_ASSERT(res4.z == 3.0f);
-    _RS_ASSERT(res4.w == 4.0f);
-
-    if (failed) {
-        rsDebug("test_clamp_vector FAILED", 0);
-    }
-    else {
-        rsDebug("test_clamp_vector PASSED", 0);
-    }
-
-    return failed;
-}
-
-void clamp_test() {
-    bool failed = false;
-    failed |= test_clamp_vector();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/clamp_relaxed.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/clamp_relaxed.rs
deleted file mode 100644
index 71c65ae..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/clamp_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "clamp.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/constant.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/constant.rs
deleted file mode 100644
index 732eaef..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/constant.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "shared.rsh"
-
-const float floatTest = 1.99f;
-const double doubleTest = 2.05;
-const char charTest = -8;
-const short shortTest = -16;
-const int intTest = -32;
-const long longTest = 17179869184l; // 1 << 34
-const long long longlongTest = 68719476736l; // 1 << 36
-
-const uchar ucharTest = 8;
-const ushort ushortTest = 16;
-const uint uintTest = 32;
-const ulong ulongTest = 4611686018427387904L;
-const int64_t int64_tTest = -17179869184l; // - 1 << 34
-const uint64_t uint64_tTest = 117179869184l;
-
-const bool boolTest = true;
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/convert.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/convert.rs
deleted file mode 100644
index e314f2b..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/convert.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "shared.rsh"
-
-float4 f4 = { 2.0f, 4.0f, 6.0f, 8.0f };
-
-char4 i8_4 = { -1, -2, -3, 4 };
-
-static bool test_convert() {
-    bool failed = false;
-
-    f4 = convert_float4(i8_4);
-    _RS_ASSERT(f4.x == -1.0f);
-    _RS_ASSERT(f4.y == -2.0f);
-    _RS_ASSERT(f4.z == -3.0f);
-    _RS_ASSERT(f4.w == 4.0f);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-void convert_test() {
-    bool failed = false;
-    failed |= test_convert();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/convert_relaxed.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/convert_relaxed.rs
deleted file mode 100644
index 81abb9b..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/convert_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "convert.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/copy_test.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/copy_test.rs
deleted file mode 100644
index f4243eb..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/copy_test.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-#include "shared.rsh"
-
-void sendResult(bool pass) {
-    if (pass) {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-}
-
-
-float2 __attribute((kernel)) copyFloat2(float2 i) {
-    return i;
-}
-
-float3 __attribute((kernel)) copyFloat3(float3 i) {
-    return i;
-}
-
-float4 __attribute((kernel)) copyFloat4(float4 i) {
-    return i;
-}
-
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/element.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/element.rs
deleted file mode 100644
index 419ce07..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/element.rs
+++ /dev/null
@@ -1,158 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element simpleElem;
-rs_element complexElem;
-typedef struct ComplexStruct {
-    float subElem0;
-    float subElem1;
-    int subElem2;
-    float arrayElem0[2];
-    int arrayElem1[5];
-    char subElem3;
-    float subElem4;
-    float2 subElem5;
-    float3 subElem6;
-    float4 subElem_7;
-} ComplexStruct_t;
-
-ComplexStruct_t *complexStruct;
-
-static const char *subElemNames[] = {
-    "subElem0",
-    "subElem1",
-    "subElem2",
-    "arrayElem0",
-    "arrayElem1",
-    "subElem3",
-    "subElem4",
-    "subElem5",
-    "subElem6",
-    "subElem_7",
-};
-
-static uint32_t subElemNamesSizes[] = {
-    8,
-    8,
-    8,
-    10,
-    10,
-    8,
-    8,
-    8,
-    8,
-    9,
-};
-
-static uint32_t subElemArraySizes[] = {
-    1,
-    1,
-    1,
-    2,
-    5,
-    1,
-    1,
-    1,
-    1,
-    1,
-};
-
-static void resetStruct() {
-    uint8_t *bytePtr = (uint8_t*)complexStruct;
-    uint32_t sizeOfStruct = sizeof(*complexStruct);
-    for(uint32_t i = 0; i < sizeOfStruct; i ++) {
-        bytePtr[i] = 0;
-    }
-}
-
-static bool equals(const char *name0, const char * name1, uint32_t len) {
-    for (uint32_t i = 0; i < len; i ++) {
-        if (name0[i] != name1[i]) {
-            return false;
-        }
-    }
-    return true;
-}
-
-static bool test_element_getters() {
-    bool failed = false;
-
-    uint32_t subElemOffsets[10];
-    uint32_t index = 0;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem0   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem1   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem2   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->arrayElem0 - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->arrayElem1 - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem3   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem4   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem5   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem6   - (uint32_t)complexStruct;
-    subElemOffsets[index++] = (uint32_t)&complexStruct->subElem_7  - (uint32_t)complexStruct;
-
-    uint32_t subElemCount = rsElementGetSubElementCount(simpleElem);
-    _RS_ASSERT(subElemCount == 0);
-    _RS_ASSERT(rsElementGetDataKind(simpleElem) == RS_KIND_USER);
-    _RS_ASSERT(rsElementGetDataType(simpleElem) == RS_TYPE_FLOAT_32);
-    _RS_ASSERT(rsElementGetVectorSize(simpleElem) == 3);
-
-    subElemCount = rsElementGetSubElementCount(complexElem);
-    _RS_ASSERT(subElemCount == 10);
-    _RS_ASSERT(rsElementGetDataKind(complexElem) == RS_KIND_USER);
-    _RS_ASSERT(rsElementGetDataType(complexElem) == RS_TYPE_NONE);
-    _RS_ASSERT(rsElementGetVectorSize(complexElem) == 1);
-    _RS_ASSERT(rsElementGetBytesSize(complexElem) == sizeof(*complexStruct));
-
-    char buffer[64];
-    for (uint32_t i = 0; i < subElemCount; i ++) {
-        rs_element subElem = rsElementGetSubElement(complexElem, i);
-        _RS_ASSERT(rsIsObject(subElem));
-
-        _RS_ASSERT(rsElementGetSubElementNameLength(complexElem, i) == subElemNamesSizes[i] + 1);
-
-        uint32_t written = rsElementGetSubElementName(complexElem, i, buffer, 64);
-        _RS_ASSERT(written == subElemNamesSizes[i]);
-        _RS_ASSERT(equals(buffer, subElemNames[i], written));
-
-        _RS_ASSERT(rsElementGetSubElementArraySize(complexElem, i) == subElemArraySizes[i]);
-        _RS_ASSERT(rsElementGetSubElementOffsetBytes(complexElem, i) == subElemOffsets[i]);
-    }
-
-    // Tests error checking
-    rs_element subElem = rsElementGetSubElement(complexElem, subElemCount);
-    _RS_ASSERT(!rsIsObject(subElem));
-
-    _RS_ASSERT(rsElementGetSubElementNameLength(complexElem, subElemCount) == 0);
-
-    _RS_ASSERT(rsElementGetSubElementName(complexElem, subElemCount, buffer, 64) == 0);
-    _RS_ASSERT(rsElementGetSubElementName(complexElem, 0, NULL, 64) == 0);
-    _RS_ASSERT(rsElementGetSubElementName(complexElem, 0, buffer, 0) == 0);
-    uint32_t written = rsElementGetSubElementName(complexElem, 0, buffer, 5);
-    _RS_ASSERT(written == 4);
-    _RS_ASSERT(buffer[4] == '\0');
-
-    _RS_ASSERT(rsElementGetSubElementArraySize(complexElem, subElemCount) == 0);
-    _RS_ASSERT(rsElementGetSubElementOffsetBytes(complexElem, subElemCount) == 0);
-
-    if (failed) {
-        rsDebug("test_element_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_element_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void element_test() {
-    bool failed = false;
-    failed |= test_element_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs
deleted file mode 100644
index 08e6bed..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "shared.rsh"
-
-rs_allocation aRaw;
-int dimX;
-int dimY;
-static bool failed = false;
-
-void root(int *out, uint32_t x, uint32_t y) {
-    *out = x + y * dimX;
-}
-
-void foo(const int *in, int *out, uint32_t x, uint32_t y) {
-    _RS_ASSERT(*in == (x + y * dimX));
-    *out = 99 + x + y * dimX;
-    _RS_ASSERT(*out == (99 + x + y * dimX));
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-static bool test_foo_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (99 + i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_foo_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_foo_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void verify_foo() {
-    failed |= test_foo_output();
-}
-
-void foreach_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs
deleted file mode 100644
index fa76390..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "shared.rsh"
-
-int dimX;
-int dimY;
-int xStart = 0;
-int xEnd = 0;
-int yStart = 0;
-int yEnd = 0;
-
-static bool failed = false;
-
-rs_script s;
-rs_allocation aRaw;
-rs_allocation ain;
-rs_allocation aout;
-
-void root(int *out, uint32_t x, uint32_t y) {
-    *out = x + y * dimX;
-}
-
-int __attribute__((kernel)) zero() {
-    return 0;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            if (i < xStart || i >= xEnd || j < yStart || j >= yEnd) {
-                _RS_ASSERT(v == 0);
-            } else {
-                _RS_ASSERT(v == (i + j * dimX));
-            }
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void foreach_bounds_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/fp_mad.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/fp_mad.rs
deleted file mode 100644
index b6f2b2a6..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/fp_mad.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "shared.rsh"
-
-const int TEST_COUNT = 1;
-
-static float data_f1[1025];
-static float4 data_f4[1025];
-
-static void test_mad4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = (data_f4[i] * 0.02f +
-                          data_f4[i+1] * 0.04f +
-                          data_f4[i+2] * 0.05f +
-                          data_f4[i+3] * 0.1f +
-                          data_f4[i+4] * 0.2f +
-                          data_f4[i+5] * 0.2f +
-                          data_f4[i+6] * 0.1f +
-                          data_f4[i+7] * 0.05f +
-                          data_f4[i+8] * 0.04f +
-                          data_f4[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad4 M ops", 1000.f / time);
-}
-
-static void test_mad(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = (data_f1[i] * 0.02f +
-                          data_f1[i+1] * 0.04f +
-                          data_f1[i+2] * 0.05f +
-                          data_f1[i+3] * 0.1f +
-                          data_f1[i+4] * 0.2f +
-                          data_f1[i+5] * 0.2f +
-                          data_f1[i+6] * 0.1f +
-                          data_f1[i+7] * 0.05f +
-                          data_f1[i+8] * 0.04f +
-                          data_f1[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad M ops", 1000.f / time);
-}
-
-static void test_norm(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = normalize(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_norm M ops", 10.f / time);
-}
-
-static void test_sincos4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10 / 4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos4 M ops", 10.f / time);
-}
-
-static void test_sincos(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos M ops", 10.f / time);
-}
-
-static void test_clamp(uint32_t index) {
-    start();
-
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp M ops", 100.f / time);
-
-    start();
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            if (data_f1[i] < -1.f) data_f1[i] = -1.f;
-            if (data_f1[i] > -1.f) data_f1[i] = 1.f;
-        }
-    }
-
-    time = end(index);
-    rsDebug("fp_clamp ref M ops", 100.f / time);
-}
-
-static void test_clamp4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100 /4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp4 M ops", 100.f / time);
-}
-
-void fp_mad_test(uint32_t index, int test_num) {
-    int x;
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f;
-        data_f4[x].x = (x & 0xf) * 0.1f;
-        data_f4[x].y = (x & 0xf0) * 0.1f;
-        data_f4[x].z = (x & 0x33) * 0.1f;
-        data_f4[x].w = (x & 0x77) * 0.1f;
-    }
-
-    test_mad4(index);
-    test_mad(index);
-
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
-        data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
-        data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
-    }
-
-    test_norm(index);
-    test_sincos4(index);
-    test_sincos(index);
-    test_clamp4(index);
-    test_clamp(index);
-
-    // TODO Actually verify test result accuracy
-    rsDebug("fp_mad_test PASSED", 0);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/int4.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/int4.rs
deleted file mode 100644
index c791cab..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/int4.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "shared.rsh"
-#pragma rs_fp_relaxed
-
-uchar4 u4 = 4;
-int4 gi4 = {2, 2, 2, 2};
-
-void int4_test() {
-    bool failed = false;
-    int4 i4 = {u4.x, u4.y, u4.z, u4.w};
-    i4 *= gi4;
-
-    rsDebug("i4.x", i4.x);
-    rsDebug("i4.y", i4.y);
-    rsDebug("i4.z", i4.z);
-    rsDebug("i4.w", i4.w);
-
-    _RS_ASSERT(i4.x == 8);
-    _RS_ASSERT(i4.y == 8);
-    _RS_ASSERT(i4.z == 8);
-    _RS_ASSERT(i4.w == 8);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/kernel.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/kernel.rs
deleted file mode 100644
index d6c9df3..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/kernel.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "shared.rsh"
-
-int *ain;
-int *aout;
-int dimX;
-static bool failed = false;
-
-void init_vars(int *out) {
-    *out = 7;
-}
-
-
-int __attribute__((kernel)) root(int ain, uint32_t x) {
-    _RS_ASSERT(ain == 7);
-    return ain + x;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i;
-
-    for (i = 0; i < dimX; i++) {
-        _RS_ASSERT(aout[i] == (i + ain[i]));
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void kernel_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/kernel_struct.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/kernel_struct.rs
deleted file mode 100644
index 62c30ae..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/kernel_struct.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "shared.rsh"
-
-struct simpleStruct {
-    int i1;
-    char ignored1;
-    float f1;
-    int i2;
-    char ignored2;
-    float f2;
-};
-
-struct simpleStruct *ain;
-struct simpleStruct *aout;
-int dimX;
-static bool failed = false;
-
-void init_vars(struct simpleStruct *out, uint32_t x) {
-    out->i1 = 0;
-    out->f1 = 0.f;
-    out->i2 = 1;
-    out->f2 = 1.0f;
-}
-
-struct simpleStruct __attribute__((kernel))
-        root(struct simpleStruct in, uint32_t x) {
-    struct simpleStruct s;
-    s.i1 = in.i1 + x;
-    s.f1 = in.f1 + x;
-    s.i2 = in.i2 + x;
-    s.f2 = in.f2 + x;
-    return s;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i;
-
-    for (i = 0; i < dimX; i++) {
-        _RS_ASSERT(aout[i].i1 == (i + ain[i].i1));
-        _RS_ASSERT(aout[i].f1 == (i + ain[i].f1));
-        _RS_ASSERT(aout[i].i2 == (i + ain[i].i2));
-        _RS_ASSERT(aout[i].f2 == (i + ain[i].f2));
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void kernel_struct_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs
deleted file mode 100644
index edde9d8..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math.rs
+++ /dev/null
@@ -1,437 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define DECL_INT(prefix)            \
-volatile char prefix##_c_1 = 1;     \
-volatile char2 prefix##_c_2 = 1;    \
-volatile char3 prefix##_c_3 = 1;    \
-volatile char4 prefix##_c_4 = 1;    \
-volatile uchar prefix##_uc_1 = 1;   \
-volatile uchar2 prefix##_uc_2 = 1;  \
-volatile uchar3 prefix##_uc_3 = 1;  \
-volatile uchar4 prefix##_uc_4 = 1;  \
-volatile short prefix##_s_1 = 1;    \
-volatile short2 prefix##_s_2 = 1;   \
-volatile short3 prefix##_s_3 = 1;   \
-volatile short4 prefix##_s_4 = 1;   \
-volatile ushort prefix##_us_1 = 1;  \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1;      \
-volatile int2 prefix##_i_2 = 1;     \
-volatile int3 prefix##_i_3 = 1;     \
-volatile int4 prefix##_i_4 = 1;     \
-volatile uint prefix##_ui_1 = 1;    \
-volatile uint2 prefix##_ui_2 = 1;   \
-volatile uint3 prefix##_ui_3 = 1;   \
-volatile uint4 prefix##_ui_4 = 1;   \
-volatile long prefix##_l_1 = 1;     \
-volatile ulong prefix##_ul_1 = 1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-#define TEST_INT_OP_TYPE(op, type)                      \
-rsDebug("Testing " #op " for " #type "1", i++);         \
-res_##type##_1 = src1_##type##_1 op src2_##type##_1;    \
-rsDebug("Testing " #op " for " #type "2", i++);         \
-res_##type##_2 = src1_##type##_2 op src2_##type##_2;    \
-rsDebug("Testing " #op " for " #type "3", i++);         \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3;    \
-rsDebug("Testing " #op " for " #type "4", i++);         \
-res_##type##_4 = src1_##type##_4 op src2_##type##_4;
-
-#define TEST_INT_OP(op)                     \
-TEST_INT_OP_TYPE(op, c)                     \
-TEST_INT_OP_TYPE(op, uc)                    \
-TEST_INT_OP_TYPE(op, s)                     \
-TEST_INT_OP_TYPE(op, us)                    \
-TEST_INT_OP_TYPE(op, i)                     \
-TEST_INT_OP_TYPE(op, ui)                    \
-rsDebug("Testing " #op " for l1", i++);     \
-res_l_1 = src1_l_1 op src2_l_1;             \
-rsDebug("Testing " #op " for ul1", i++);    \
-res_ul_1 = src1_ul_1 op src2_ul_1;
-
-#define TEST_XN_FUNC_YN(typeout, fnc, typein)   \
-    res_##typeout##_1 = fnc(src1_##typein##_1); \
-    res_##typeout##_2 = fnc(src1_##typein##_2); \
-    res_##typeout##_3 = fnc(src1_##typein##_3); \
-    res_##typeout##_4 = fnc(src1_##typein##_4);
-
-#define TEST_XN_FUNC_XN_XN(type, fnc)                       \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
-    res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
-    res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
-    res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
-
-#define TEST_X_FUNC_X_X_X(type, fnc)    \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
-
-#define TEST_IN_FUNC_IN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, uc)    \
-    TEST_XN_FUNC_YN(c, fnc, c)      \
-    TEST_XN_FUNC_YN(us, fnc, us)    \
-    TEST_XN_FUNC_YN(s, fnc, s)      \
-    TEST_XN_FUNC_YN(ui, fnc, ui)    \
-    TEST_XN_FUNC_YN(i, fnc, i)
-
-#define TEST_UIN_FUNC_IN(fnc)       \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, c)     \
-    TEST_XN_FUNC_YN(us, fnc, s)     \
-    TEST_XN_FUNC_YN(ui, fnc, i)     \
-
-#define TEST_IN_FUNC_IN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_XN_XN(uc, fnc)     \
-    TEST_XN_FUNC_XN_XN(c, fnc)      \
-    TEST_XN_FUNC_XN_XN(us, fnc)     \
-    TEST_XN_FUNC_XN_XN(s, fnc)      \
-    TEST_XN_FUNC_XN_XN(ui, fnc)     \
-    TEST_XN_FUNC_XN_XN(i, fnc)
-
-#define TEST_I_FUNC_I_I_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_X_FUNC_X_X_X(uc, fnc)      \
-    TEST_X_FUNC_X_X_X(c, fnc)       \
-    TEST_X_FUNC_X_X_X(us, fnc)      \
-    TEST_X_FUNC_X_X_X(s, fnc)       \
-    TEST_X_FUNC_X_X_X(ui, fnc)      \
-    TEST_X_FUNC_X_X_X(i, fnc)
-
-#define TEST_FN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f2 = fnc(f2);                   \
-    f3 = fnc(f3);                   \
-    f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (float*) &f1);     \
-    f2 = fnc(f2, (float2*) &f2);    \
-    f3 = fnc(f3, (float3*) &f3);    \
-    f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f2);               \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_F34_FUNC_F34_F34(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f1);               \
-    f3 = fnc(f3, f1);               \
-    f4 = fnc(f4, f1);
-
-#define TEST_F_FUNC_FN(fnc)         \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f1 = fnc(f2);                   \
-    f1 = fnc(f3);                   \
-    f1 = fnc(f4);
-
-#define TEST_F_FUNC_FN_FN(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f1 = fnc(f2, f2);               \
-    f1 = fnc(f3, f3);               \
-    f1 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i2);               \
-    f3 = fnc(f3, i3);               \
-    f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i1);               \
-    f3 = fnc(f3, i1);               \
-    f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f2, f2);           \
-    f3 = fnc(f3, f3, f3);           \
-    f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_FN_F(fnc)   \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f1, f1);           \
-    f3 = fnc(f3, f1, f1);           \
-    f4 = fnc(f4, f1, f1);
-
-#define TEST_FN_FUNC_FN_PIN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (int*) &i1);       \
-    f2 = fnc(f2, (int2*) &i2);      \
-    f3 = fnc(f3, (int3*) &i3);      \
-    f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, (int*) &i1);   \
-    f2 = fnc(f2, f2, (int2*) &i2);  \
-    f3 = fnc(f3, f3, (int3*) &i3);  \
-    f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    i1 = fnc(f1);                   \
-    i2 = fnc(f2);                   \
-    i3 = fnc(f3);                   \
-    i4 = fnc(f4);
-
-static bool test_fp_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_FN_FUNC_FN(acos);
-    TEST_FN_FUNC_FN(acosh);
-    TEST_FN_FUNC_FN(acospi);
-    TEST_FN_FUNC_FN(asin);
-    TEST_FN_FUNC_FN(asinh);
-    TEST_FN_FUNC_FN(asinpi);
-    TEST_FN_FUNC_FN(atan);
-    TEST_FN_FUNC_FN_FN(atan2);
-    TEST_FN_FUNC_FN(atanh);
-    TEST_FN_FUNC_FN(atanpi);
-    TEST_FN_FUNC_FN_FN(atan2pi);
-    TEST_FN_FUNC_FN(cbrt);
-    TEST_FN_FUNC_FN(ceil);
-    TEST_FN_FUNC_FN_FN_FN(clamp);
-    TEST_FN_FUNC_FN_FN_F(clamp);
-    TEST_FN_FUNC_FN_FN(copysign);
-    TEST_FN_FUNC_FN(cos);
-    TEST_FN_FUNC_FN(cosh);
-    TEST_FN_FUNC_FN(cospi);
-    TEST_F34_FUNC_F34_F34(cross);
-    TEST_FN_FUNC_FN(degrees);
-    TEST_F_FUNC_FN_FN(distance);
-    TEST_F_FUNC_FN_FN(dot);
-    TEST_FN_FUNC_FN(erfc);
-    TEST_FN_FUNC_FN(erf);
-    TEST_FN_FUNC_FN(exp);
-    TEST_FN_FUNC_FN(exp2);
-    TEST_FN_FUNC_FN(exp10);
-    TEST_FN_FUNC_FN(expm1);
-    TEST_FN_FUNC_FN(fabs);
-    TEST_FN_FUNC_FN_FN(fdim);
-    TEST_FN_FUNC_FN(floor);
-    TEST_FN_FUNC_FN_FN_FN(fma);
-    TEST_FN_FUNC_FN_FN(fmax);
-    TEST_FN_FUNC_FN_F(fmax);
-    TEST_FN_FUNC_FN_FN(fmin);
-    TEST_FN_FUNC_FN_F(fmin);
-    TEST_FN_FUNC_FN_FN(fmod);
-    TEST_FN_FUNC_FN_PFN(fract);
-    TEST_FN_FUNC_FN(fract);
-    TEST_FN_FUNC_FN_PIN(frexp);
-    TEST_FN_FUNC_FN_FN(hypot);
-    TEST_IN_FUNC_FN(ilogb);
-    TEST_FN_FUNC_FN_IN(ldexp);
-    TEST_FN_FUNC_FN_I(ldexp);
-    TEST_F_FUNC_FN(length);
-    TEST_FN_FUNC_FN(lgamma);
-    TEST_FN_FUNC_FN_PIN(lgamma);
-    TEST_FN_FUNC_FN(log);
-    TEST_FN_FUNC_FN(log2);
-    TEST_FN_FUNC_FN(log10);
-    TEST_FN_FUNC_FN(log1p);
-    TEST_FN_FUNC_FN(logb);
-    TEST_FN_FUNC_FN_FN_FN(mad);
-    TEST_FN_FUNC_FN_FN(max);
-    TEST_FN_FUNC_FN_F(max);
-    TEST_FN_FUNC_FN_FN(min);
-    TEST_FN_FUNC_FN_F(min);
-    TEST_FN_FUNC_FN_FN_FN(mix);
-    TEST_FN_FUNC_FN_FN_F(mix);
-    TEST_FN_FUNC_FN_PFN(modf);
-    // nan
-    TEST_FN_FUNC_FN_FN(nextafter);
-    TEST_FN_FUNC_FN(normalize);
-    TEST_FN_FUNC_FN_FN(pow);
-    TEST_FN_FUNC_FN_IN(pown);
-    TEST_FN_FUNC_FN_FN(powr);
-    TEST_FN_FUNC_FN(radians);
-    TEST_FN_FUNC_FN_FN(remainder);
-    TEST_FN_FUNC_FN_FN_PIN(remquo);
-    TEST_FN_FUNC_FN(rint);
-    TEST_FN_FUNC_FN_IN(rootn);
-    TEST_FN_FUNC_FN(round);
-    TEST_FN_FUNC_FN(rsqrt);
-    TEST_FN_FUNC_FN(sign);
-    TEST_FN_FUNC_FN(sin);
-    TEST_FN_FUNC_FN_PFN(sincos);
-    TEST_FN_FUNC_FN(sinh);
-    TEST_FN_FUNC_FN(sinpi);
-    TEST_FN_FUNC_FN(sqrt);
-    TEST_FN_FUNC_FN_FN(step);
-    TEST_FN_FUNC_FN_F(step);
-    TEST_FN_FUNC_FN(tan);
-    TEST_FN_FUNC_FN(tanh);
-    TEST_FN_FUNC_FN(tanpi);
-    TEST_FN_FUNC_FN(tgamma);
-    TEST_FN_FUNC_FN(trunc);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_fp_math FAILED", time);
-    }
-    else {
-        rsDebug("test_fp_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_int_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_UIN_FUNC_IN(abs);
-    TEST_IN_FUNC_IN(clz);
-    TEST_IN_FUNC_IN_IN(min);
-    TEST_IN_FUNC_IN_IN(max);
-    TEST_I_FUNC_I_I_I(rsClamp);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_int_math FAILED", time);
-    }
-    else {
-        rsDebug("test_int_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_basic_operators() {
-    bool failed = false;
-    int i = 0;
-
-    TEST_INT_OP(+);
-    TEST_INT_OP(-);
-    TEST_INT_OP(*);
-    TEST_INT_OP(/);
-    TEST_INT_OP(%);
-    TEST_INT_OP(<<);
-    TEST_INT_OP(>>);
-
-    if (failed) {
-        rsDebug("test_basic_operators FAILED", 0);
-    }
-    else {
-        rsDebug("test_basic_operators PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define TEST_CVT(to, from, type)                        \
-rsDebug("Testing convert from " #from " to " #to, 0);   \
-to##1 = from##1;                                        \
-to##2 = convert_##type##2(from##2);                     \
-to##3 = convert_##type##3(from##3);                     \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type)   \
-TEST_CVT(to, c, type);              \
-TEST_CVT(to, uc, type);             \
-TEST_CVT(to, s, type);              \
-TEST_CVT(to, us, type);             \
-TEST_CVT(to, i, type);              \
-TEST_CVT(to, ui, type);             \
-TEST_CVT(to, f, type);              \
-
-static bool test_convert() {
-    bool failed = false;
-
-    TEST_CVT_MATRIX(c, char);
-    TEST_CVT_MATRIX(uc, uchar);
-    TEST_CVT_MATRIX(s, short);
-    TEST_CVT_MATRIX(us, ushort);
-    TEST_CVT_MATRIX(i, int);
-    TEST_CVT_MATRIX(ui, uint);
-    TEST_CVT_MATRIX(f, float);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_convert();
-    failed |= test_fp_math(index);
-    failed |= test_int_math(index);
-    failed |= test_basic_operators();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
deleted file mode 100644
index 5bfbb2b..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
+++ /dev/null
@@ -1,409 +0,0 @@
-#include "shared.rsh"
-//#pragma rs_fp_relaxed
-
-volatile float x = 0.0f;
-volatile float y = 0.0f;
-volatile float result_add = 0.0f;
-volatile float result_sub = 0.0f;
-volatile float result_mul = 0.0f;
-volatile float result_div = 0.0f;
-
-#define DECLARE_INPUT_SET(type, abbrev)         \
-volatile type    rand_##abbrev##1_0, rand_##abbrev##1_1; \
-volatile type##2 rand_##abbrev##2_0, rand_##abbrev##2_1; \
-volatile type##3 rand_##abbrev##3_0, rand_##abbrev##3_1; \
-volatile type##4 rand_##abbrev##4_0, rand_##abbrev##4_1;
-
-#define DECLARE_ALL_INPUT_SETS()    \
-DECLARE_INPUT_SET(float, f);        \
-DECLARE_INPUT_SET(char, sc);        \
-DECLARE_INPUT_SET(uchar, uc);       \
-DECLARE_INPUT_SET(short, ss);       \
-DECLARE_INPUT_SET(ushort, us);      \
-DECLARE_INPUT_SET(int, si);         \
-DECLARE_INPUT_SET(uint, ui);        \
-DECLARE_INPUT_SET(long, sl);        \
-DECLARE_INPUT_SET(ulong, ul);
-
-DECLARE_ALL_INPUT_SETS();
-
-#define DECLARE_REFERENCE_SET_VEC_VEC(type, abbrev, func)   \
-volatile type    func##_rand_##abbrev##1_##abbrev##1;                \
-volatile type##2 func##_rand_##abbrev##2_##abbrev##2;                \
-volatile type##3 func##_rand_##abbrev##3_##abbrev##3;                \
-volatile type##4 func##_rand_##abbrev##4_##abbrev##4;
-#define DECLARE_REFERENCE_SET_VEC_SCL(type, abbrev, func)   \
-volatile type##2 func##_rand_##abbrev##2_##abbrev##1;                \
-volatile type##3 func##_rand_##abbrev##3_##abbrev##1;                \
-volatile type##4 func##_rand_##abbrev##4_##abbrev##1;
-
-#define DECLARE_ALL_REFERENCE_SETS_VEC_VEC(func)    \
-DECLARE_REFERENCE_SET_VEC_VEC(float, f, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(char, sc, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(uchar, uc, func);     \
-DECLARE_REFERENCE_SET_VEC_VEC(short, ss, func);     \
-DECLARE_REFERENCE_SET_VEC_VEC(ushort, us, func);    \
-DECLARE_REFERENCE_SET_VEC_VEC(int, si, func);       \
-DECLARE_REFERENCE_SET_VEC_VEC(uint, ui, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(long, sl, func);      \
-DECLARE_REFERENCE_SET_VEC_VEC(ulong, ul, func);
-
-DECLARE_ALL_REFERENCE_SETS_VEC_VEC(min);
-DECLARE_ALL_REFERENCE_SETS_VEC_VEC(max);
-DECLARE_REFERENCE_SET_VEC_VEC(float, f, fmin);
-DECLARE_REFERENCE_SET_VEC_SCL(float, f, fmin);
-DECLARE_REFERENCE_SET_VEC_VEC(float, f, fmax);
-DECLARE_REFERENCE_SET_VEC_SCL(float, f, fmax);
-
-static void fail_f1(float v1, float v2, float actual, float expected, char *op_name) {
-    int dist = float_dist(actual, expected);
-    rsDebug("float operation did not match!", op_name);
-    rsDebug("v1", v1);
-    rsDebug("v2", v2);
-    rsDebug("Dalvik result", expected);
-    rsDebug("Renderscript result", actual);
-    rsDebug("ULP difference", dist);
-}
-
-static void fail_f2(float2 v1, float2 v2, float2 actual, float2 expected, char *op_name) {
-    int2 dist;
-    dist.x = float_dist(actual.x, expected.x);
-    dist.y = float_dist(actual.y, expected.y);
-    rsDebug("float2 operation did not match!", op_name);
-    rsDebug("v1.x", v1.x);
-    rsDebug("v1.y", v1.y);
-    rsDebug("v2.x", v2.x);
-    rsDebug("v2.y", v2.y);
-    rsDebug("Dalvik result .x", expected.x);
-    rsDebug("Dalvik result .y", expected.y);
-    rsDebug("Renderscript result .x", actual.x);
-    rsDebug("Renderscript result .y", actual.y);
-    rsDebug("ULP difference .x", dist.x);
-    rsDebug("ULP difference .y", dist.y);
-}
-
-static void fail_f3(float3 v1, float3 v2, float3 actual, float3 expected, char *op_name) {
-    int3 dist;
-    dist.x = float_dist(actual.x, expected.x);
-    dist.y = float_dist(actual.y, expected.y);
-    dist.z = float_dist(actual.z, expected.z);
-    rsDebug("float3 operation did not match!", op_name);
-    rsDebug("v1.x", v1.x);
-    rsDebug("v1.y", v1.y);
-    rsDebug("v1.z", v1.z);
-    rsDebug("v2.x", v2.x);
-    rsDebug("v2.y", v2.y);
-    rsDebug("v2.z", v2.z);
-    rsDebug("Dalvik result .x", expected.x);
-    rsDebug("Dalvik result .y", expected.y);
-    rsDebug("Dalvik result .z", expected.z);
-    rsDebug("Renderscript result .x", actual.x);
-    rsDebug("Renderscript result .y", actual.y);
-    rsDebug("Renderscript result .z", actual.z);
-    rsDebug("ULP difference .x", dist.x);
-    rsDebug("ULP difference .y", dist.y);
-    rsDebug("ULP difference .z", dist.z);
-}
-
-static void fail_f4(float4 v1, float4 v2, float4 actual, float4 expected, char *op_name) {
-    int4 dist;
-    dist.x = float_dist(actual.x, expected.x);
-    dist.y = float_dist(actual.y, expected.y);
-    dist.z = float_dist(actual.z, expected.z);
-    dist.w = float_dist(actual.w, expected.w);
-    rsDebug("float4 operation did not match!", op_name);
-    rsDebug("v1.x", v1.x);
-    rsDebug("v1.y", v1.y);
-    rsDebug("v1.z", v1.z);
-    rsDebug("v1.w", v1.w);
-    rsDebug("v2.x", v2.x);
-    rsDebug("v2.y", v2.y);
-    rsDebug("v2.z", v2.z);
-    rsDebug("v2.w", v2.w);
-    rsDebug("Dalvik result .x", expected.x);
-    rsDebug("Dalvik result .y", expected.y);
-    rsDebug("Dalvik result .z", expected.z);
-    rsDebug("Dalvik result .w", expected.w);
-    rsDebug("Renderscript result .x", actual.x);
-    rsDebug("Renderscript result .y", actual.y);
-    rsDebug("Renderscript result .z", actual.z);
-    rsDebug("Renderscript result .w", actual.w);
-    rsDebug("ULP difference .x", dist.x);
-    rsDebug("ULP difference .y", dist.y);
-    rsDebug("ULP difference .z", dist.z);
-    rsDebug("ULP difference .w", dist.w);
-}
-
-static bool f1_almost_equal(float a, float b) {
-    return float_almost_equal(a, b);
-}
-
-static bool f2_almost_equal(float2 a, float2 b) {
-    return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y);
-}
-
-
-static bool f3_almost_equal(float3 a, float3 b) {
-    return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y)
-            && float_almost_equal(a.z, b.z);
-}
-
-static bool f4_almost_equal(float4 a, float4 b) {
-    return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y)
-            && float_almost_equal(a.z, b.z) && float_almost_equal(a.w, b.w);
-}
-
-#define TEST_BASIC_FLOAT_OP(op, opName)                 \
-temp_f1 = x op y;                                       \
-if (! float_almost_equal(temp_f1, result_##opName)) {   \
-    fail_f1(x, y , temp_f1, result_##opName, #opName);  \
-    failed = true;                                      \
-}
-
-#define TEST_FN_FN(func, size)                                                  \
-temp_f##size = func(rand_f##size##_0, rand_f##size##_1);                        \
-if (! f##size##_almost_equal(temp_f##size , func##_rand_f##size##_f##size)) {   \
-    fail_f##size (x, y , temp_f##size, func##_rand_f##size##_f##size, #func);   \
-    failed = true;                                                              \
-}
-#define TEST_FN_F(func, size)                                               \
-temp_f##size = func(rand_f##size##_0, rand_f1_1);                           \
-if (! f##size##_almost_equal(temp_f##size , func##_rand_f##size##_f1)) {    \
-    fail_f##size (x, y , temp_f##size, func##_rand_f##size##_f1 , #func);   \
-    failed = true;                                                          \
-}
-
-#define TEST_FN_FN_ALL(func)    \
-TEST_FN_FN(func, 1)             \
-TEST_FN_FN(func, 2)             \
-TEST_FN_FN(func, 3)             \
-TEST_FN_FN(func, 4)
-#define TEST_FN_F_ALL(func) \
-TEST_FN_F(func, 2)          \
-TEST_FN_F(func, 3)          \
-TEST_FN_F(func, 4)
-
-#define TEST_VEC1_VEC1(func, type)                              \
-temp_##type##1 = func( rand_##type##1_0, rand_##type##1_1 );    \
-if (temp_##type##1 != func##_rand_##type##1_##type##1) {        \
-    rsDebug(#func " " #type "1 operation did not match!", 0);   \
-    rsDebug("v1", rand_##type##1_0);                            \
-    rsDebug("v2", rand_##type##1_1);                            \
-    rsDebug("Dalvik result", func##_rand_##type##1_##type##1);  \
-    rsDebug("Renderscript result", temp_##type##1);             \
-    failed = true;                                              \
-}
-#define TEST_VEC2_VEC2(func, type)                                      \
-temp_##type##2 = func( rand_##type##2_0, rand_##type##2_1 );            \
-if (temp_##type##2 .x != func##_rand_##type##2_##type##2 .x             \
-        || temp_##type##2 .y != func##_rand_##type##2_##type##2 .y) {   \
-    rsDebug(#func " " #type "2 operation did not match!", 0);           \
-    rsDebug("v1.x", rand_##type##2_0 .x);                               \
-    rsDebug("v1.y", rand_##type##2_0 .y);                               \
-    rsDebug("v2.x", rand_##type##2_1 .x);                               \
-    rsDebug("v2.y", rand_##type##2_1 .y);                               \
-    rsDebug("Dalvik result .x", func##_rand_##type##2_##type##2 .x);    \
-    rsDebug("Dalvik result .y", func##_rand_##type##2_##type##2 .y);    \
-    rsDebug("Renderscript result .x", temp_##type##2 .x);               \
-    rsDebug("Renderscript result .y", temp_##type##2 .y);               \
-    failed = true;                                                      \
-}
-#define TEST_VEC3_VEC3(func, type)                                      \
-temp_##type##3 = func( rand_##type##3_0, rand_##type##3_1 );            \
-if (temp_##type##3 .x != func##_rand_##type##3_##type##3 .x             \
-        || temp_##type##3 .y != func##_rand_##type##3_##type##3 .y      \
-        || temp_##type##3 .z != func##_rand_##type##3_##type##3 .z) {   \
-    rsDebug(#func " " #type "3 operation did not match!", 0);           \
-    rsDebug("v1.x", rand_##type##3_0 .x);                               \
-    rsDebug("v1.y", rand_##type##3_0 .y);                               \
-    rsDebug("v1.z", rand_##type##3_0 .z);                               \
-    rsDebug("v2.x", rand_##type##3_1 .x);                               \
-    rsDebug("v2.y", rand_##type##3_1 .y);                               \
-    rsDebug("v2.z", rand_##type##3_1 .z);                               \
-    rsDebug("Dalvik result .x", func##_rand_##type##3_##type##3 .x);    \
-    rsDebug("Dalvik result .y", func##_rand_##type##3_##type##3 .y);    \
-    rsDebug("Dalvik result .z", func##_rand_##type##3_##type##3 .z);    \
-    rsDebug("Renderscript result .x", temp_##type##3 .x);               \
-    rsDebug("Renderscript result .y", temp_##type##3 .y);               \
-    rsDebug("Renderscript result .z", temp_##type##3 .z);               \
-    failed = true;                                                      \
-}
-#define TEST_VEC4_VEC4(func, type)                                      \
-temp_##type##4 = func( rand_##type##4_0, rand_##type##4_1 );            \
-if (temp_##type##4 .x != func##_rand_##type##4_##type##4 .x             \
-        || temp_##type##4 .y != func##_rand_##type##4_##type##4 .y      \
-        || temp_##type##4 .z != func##_rand_##type##4_##type##4 .z      \
-        || temp_##type##4 .w != func##_rand_##type##4_##type##4 .w) {   \
-    rsDebug(#func " " #type "4 operation did not match!", 0);           \
-    rsDebug("v1.x", rand_##type##4_0 .x);                               \
-    rsDebug("v1.y", rand_##type##4_0 .y);                               \
-    rsDebug("v1.z", rand_##type##4_0 .z);                               \
-    rsDebug("v1.w", rand_##type##4_0 .w);                               \
-    rsDebug("v2.x", rand_##type##4_1 .x);                               \
-    rsDebug("v2.y", rand_##type##4_1 .y);                               \
-    rsDebug("v2.z", rand_##type##4_1 .z);                               \
-    rsDebug("v2.w", rand_##type##4_1 .w);                               \
-    rsDebug("Dalvik result .x", func##_rand_##type##4_##type##4 .x);    \
-    rsDebug("Dalvik result .y", func##_rand_##type##4_##type##4 .y);    \
-    rsDebug("Dalvik result .z", func##_rand_##type##4_##type##4 .z);    \
-    rsDebug("Dalvik result .w", func##_rand_##type##4_##type##4 .w);    \
-    rsDebug("Renderscript result .x", temp_##type##4 .x);               \
-    rsDebug("Renderscript result .y", temp_##type##4 .y);               \
-    rsDebug("Renderscript result .z", temp_##type##4 .z);               \
-    rsDebug("Renderscript result .w", temp_##type##4 .w);               \
-    failed = true;                                                      \
-}
-
-#define TEST_SC1_SC1(func)  TEST_VEC1_VEC1(func, sc)
-#define TEST_SC2_SC2(func)  TEST_VEC2_VEC2(func, sc)
-#define TEST_SC3_SC3(func)  TEST_VEC3_VEC3(func, sc)
-#define TEST_SC4_SC4(func)  TEST_VEC4_VEC4(func, sc)
-
-#define TEST_UC1_UC1(func)  TEST_VEC1_VEC1(func, uc)
-#define TEST_UC2_UC2(func)  TEST_VEC2_VEC2(func, uc)
-#define TEST_UC3_UC3(func)  TEST_VEC3_VEC3(func, uc)
-#define TEST_UC4_UC4(func)  TEST_VEC4_VEC4(func, uc)
-
-#define TEST_SS1_SS1(func)  TEST_VEC1_VEC1(func, ss)
-#define TEST_SS2_SS2(func)  TEST_VEC2_VEC2(func, ss)
-#define TEST_SS3_SS3(func)  TEST_VEC3_VEC3(func, ss)
-#define TEST_SS4_SS4(func)  TEST_VEC4_VEC4(func, ss)
-
-#define TEST_US1_US1(func)  TEST_VEC1_VEC1(func, us)
-#define TEST_US2_US2(func)  TEST_VEC2_VEC2(func, us)
-#define TEST_US3_US3(func)  TEST_VEC3_VEC3(func, us)
-#define TEST_US4_US4(func)  TEST_VEC4_VEC4(func, us)
-
-#define TEST_SI1_SI1(func)  TEST_VEC1_VEC1(func, si)
-#define TEST_SI2_SI2(func)  TEST_VEC2_VEC2(func, si)
-#define TEST_SI3_SI3(func)  TEST_VEC3_VEC3(func, si)
-#define TEST_SI4_SI4(func)  TEST_VEC4_VEC4(func, si)
-
-#define TEST_UI1_UI1(func)  TEST_VEC1_VEC1(func, ui)
-#define TEST_UI2_UI2(func)  TEST_VEC2_VEC2(func, ui)
-#define TEST_UI3_UI3(func)  TEST_VEC3_VEC3(func, ui)
-#define TEST_UI4_UI4(func)  TEST_VEC4_VEC4(func, ui)
-
-#define TEST_SL1_SL1(func)  TEST_VEC1_VEC1(func, sl)
-#define TEST_SL2_SL2(func)  TEST_VEC2_VEC2(func, sl)
-#define TEST_SL3_SL3(func)  TEST_VEC3_VEC3(func, sl)
-#define TEST_SL4_SL4(func)  TEST_VEC4_VEC4(func, sl)
-
-#define TEST_UL1_UL1(func)  TEST_VEC1_VEC1(func, ul)
-#define TEST_UL2_UL2(func)  TEST_VEC2_VEC2(func, ul)
-#define TEST_UL3_UL3(func)  TEST_VEC3_VEC3(func, ul)
-#define TEST_UL4_UL4(func)  TEST_VEC4_VEC4(func, ul)
-
-#define TEST_SC_SC_ALL(func)    \
-TEST_SC1_SC1(func)              \
-TEST_SC2_SC2(func)              \
-TEST_SC3_SC3(func)              \
-TEST_SC4_SC4(func)
-#define TEST_UC_UC_ALL(func)    \
-TEST_UC1_UC1(func)              \
-TEST_UC2_UC2(func)              \
-TEST_UC3_UC3(func)              \
-TEST_UC4_UC4(func)
-
-#define TEST_SS_SS_ALL(func)    \
-TEST_SS1_SS1(func)              \
-TEST_SS2_SS2(func)              \
-TEST_SS3_SS3(func)              \
-TEST_SS4_SS4(func)
-#define TEST_US_US_ALL(func)    \
-TEST_US1_US1(func)              \
-TEST_US2_US2(func)              \
-TEST_US3_US3(func)              \
-TEST_US4_US4(func)
-#define TEST_SI_SI_ALL(func)    \
-TEST_SI1_SI1(func)              \
-TEST_SI2_SI2(func)              \
-TEST_SI3_SI3(func)              \
-TEST_SI4_SI4(func)
-#define TEST_UI_UI_ALL(func)    \
-TEST_UI1_UI1(func)              \
-TEST_UI2_UI2(func)              \
-TEST_UI3_UI3(func)              \
-TEST_UI4_UI4(func)
-#define TEST_SL_SL_ALL(func)    \
-TEST_SL1_SL1(func)              \
-TEST_SL2_SL2(func)              \
-TEST_SL3_SL3(func)              \
-TEST_SL4_SL4(func)
-#define TEST_UL_UL_ALL(func)    \
-TEST_UL1_UL1(func)              \
-TEST_UL2_UL2(func)              \
-TEST_UL3_UL3(func)              \
-TEST_UL4_UL4(func)
-
-#define TEST_VEC_VEC_ALL(func)  \
-TEST_FN_FN_ALL(func)            \
-TEST_SC_SC_ALL(func)            \
-TEST_UC_UC_ALL(func)            \
-TEST_SS_SS_ALL(func)            \
-TEST_US_US_ALL(func)            \
-TEST_SI_SI_ALL(func)            \
-TEST_UI_UI_ALL(func)
-
-// TODO:  add long types to ALL macro
-#if 0
-TEST_SL_SL_ALL(func)            \
-TEST_UL_UL_ALL(func)
-#endif
-
-#define DECLARE_TEMP_SET(type, abbrev)  \
-volatile type    temp_##abbrev##1;               \
-volatile type##2 temp_##abbrev##2;               \
-volatile type##3 temp_##abbrev##3;               \
-volatile type##4 temp_##abbrev##4;
-
-#define DECLARE_ALL_TEMP_SETS() \
-DECLARE_TEMP_SET(float, f);     \
-DECLARE_TEMP_SET(char, sc);     \
-DECLARE_TEMP_SET(uchar, uc);    \
-DECLARE_TEMP_SET(short, ss);    \
-DECLARE_TEMP_SET(ushort, us);   \
-DECLARE_TEMP_SET(int, si);      \
-DECLARE_TEMP_SET(uint, ui);     \
-DECLARE_TEMP_SET(long, sl);     \
-DECLARE_TEMP_SET(ulong, ul);
-
-static bool test_math_agree() {
-    bool failed = false;
-
-    DECLARE_ALL_TEMP_SETS();
-
-    TEST_BASIC_FLOAT_OP(+, add);
-    TEST_BASIC_FLOAT_OP(-, sub);
-    TEST_BASIC_FLOAT_OP(*, mul);
-    TEST_BASIC_FLOAT_OP(/, div);
-
-    TEST_VEC_VEC_ALL(min);
-    TEST_VEC_VEC_ALL(max);
-    TEST_FN_FN_ALL(fmin);
-    TEST_FN_F_ALL(fmin);
-    TEST_FN_FN_ALL(fmax);
-    TEST_FN_F_ALL(fmax);
-
-    if (failed) {
-        rsDebug("test_math_agree FAILED", 0);
-    }
-    else {
-        rsDebug("test_math_agree PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_agree_test() {
-    bool failed = false;
-    failed |= test_math_agree();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_conformance.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_conformance.rs
deleted file mode 100644
index 2d62f343..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_conformance.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "shared.rsh"
-
-// Testing math conformance
-
-static bool test_rootn() {
-    bool failed = false;
-
-    // rootn(x, 0) -> NaN
-    _RS_ASSERT(isnan(rootn(1.0f, 0)));
-
-    // rootn(+/-0, n) -> +/-inf for odd n < 0
-    _RS_ASSERT(isposinf(rootn(0.f, -3)));
-    _RS_ASSERT(isneginf(rootn(-0.f, -3)));
-
-    // rootn(+/-0, n) -> +inf for even n < 0
-    _RS_ASSERT(isposinf(rootn(0.f, -8)));
-    _RS_ASSERT(isposinf(rootn(-0.f, -8)));
-
-    // rootn(+/-0, n) -> +/-0 for odd n > 0
-    _RS_ASSERT(isposzero(rootn(0.f, 3)));
-    _RS_ASSERT(isnegzero(rootn(-0.f, 3)));
-
-    // rootn(+/-0, n) -> +0 for even n > 0
-    _RS_ASSERT(isposzero(rootn(0.f, 8)));
-    _RS_ASSERT(isposzero(rootn(-0.f, 8)));
-
-    // rootn(x, n) -> NaN for x < 0 and even n
-    _RS_ASSERT(isnan(rootn(-10000.f, -4)));
-    _RS_ASSERT(isnan(rootn(-10000.f, 4)));
-
-    // rootn(x, n) -> value for x < 0 and odd n
-    _RS_ASSERT(!isnan(rootn(-10000.f, -3)));
-    _RS_ASSERT(!isnan(rootn(-10000.f, 3)));
-
-    if (failed) {
-        rsDebug("test_rootn FAILED", -1);
-    }
-    else {
-        rsDebug("test_rootn PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_conformance_test() {
-    bool failed = false;
-    failed |= test_rootn();
-
-    if (failed) {
-        rsDebug("math_conformance_test FAILED", -1);
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsDebug("math_conformance_test PASSED", 0);
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs
deleted file mode 100644
index 1354897..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/mesh.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_mesh mesh;
-rs_allocation vertexAlloc0;
-rs_allocation vertexAlloc1;
-
-rs_allocation indexAlloc0;
-rs_allocation indexAlloc2;
-
-static bool test_mesh_getters() {
-    bool failed = false;
-
-    _RS_ASSERT(rsgMeshGetVertexAllocationCount(mesh) == 2);
-    _RS_ASSERT(rsgMeshGetPrimitiveCount(mesh) == 3);
-
-    rs_allocation meshV0 = rsgMeshGetVertexAllocation(mesh, 0);
-    rs_allocation meshV1 = rsgMeshGetVertexAllocation(mesh, 1);
-    rs_allocation meshV2 = rsgMeshGetVertexAllocation(mesh, 2);
-    _RS_ASSERT(meshV0.p == vertexAlloc0.p);
-    _RS_ASSERT(meshV1.p == vertexAlloc1.p);
-    _RS_ASSERT(!rsIsObject(meshV2));
-
-    rs_allocation meshI0 = rsgMeshGetIndexAllocation(mesh, 0);
-    rs_allocation meshI1 = rsgMeshGetIndexAllocation(mesh, 1);
-    rs_allocation meshI2 = rsgMeshGetIndexAllocation(mesh, 2);
-    rs_allocation meshI3 = rsgMeshGetIndexAllocation(mesh, 3);
-    _RS_ASSERT(meshI0.p == indexAlloc0.p);
-    _RS_ASSERT(!rsIsObject(meshI1));
-    _RS_ASSERT(meshI2.p == indexAlloc2.p);
-    _RS_ASSERT(!rsIsObject(meshI3));
-
-    rs_primitive p0 = rsgMeshGetPrimitive(mesh, 0);
-    rs_primitive p1 = rsgMeshGetPrimitive(mesh, 1);
-    rs_primitive p2 = rsgMeshGetPrimitive(mesh, 2);
-    rs_primitive p3 = rsgMeshGetPrimitive(mesh, 3);
-
-    _RS_ASSERT(p0 == RS_PRIMITIVE_POINT);
-    _RS_ASSERT(p1 == RS_PRIMITIVE_LINE);
-    _RS_ASSERT(p2 == RS_PRIMITIVE_TRIANGLE);
-    _RS_ASSERT(p3 == RS_PRIMITIVE_INVALID);
-
-    if (failed) {
-        rsDebug("test_mesh_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_mesh_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void mesh_test() {
-    bool failed = false;
-    failed |= test_mesh_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/min.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/min.rs
deleted file mode 100644
index 4b92763..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/min.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "shared.rsh"
-#pragma rs_fp_relaxed
-
-volatile uchar2 res_uc_2 = 1;
-volatile uchar2 src1_uc_2 = 1;
-volatile uchar2 src2_uc_2 = 1;
-
-void min_test() {
-    bool failed = false;
-
-    res_uc_2 = min(src1_uc_2, src2_uc_2);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs
deleted file mode 100644
index 2c807bd..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "shared.rsh"
-
-rs_allocation aRaw;
-int dimX;
-int dimY;
-static bool failed = false;
-
-void foo(const int *in, int *out, uint32_t x, uint32_t y) {
-    *out = 99 + x + y * dimX;
-}
-
-static bool test_foo_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (99 + i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_foo_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_foo_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_foo() {
-    failed |= test_foo_output();
-}
-
-void noroot_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/primitives.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/primitives.rs
deleted file mode 100644
index ce451da..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/primitives.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool test_primitive_types(uint32_t index) {
-    bool failed = false;
-    start();
-
-    _RS_ASSERT(floatTest == 2.99f);
-    _RS_ASSERT(doubleTest == 3.05);
-    _RS_ASSERT(charTest == -16);
-    _RS_ASSERT(shortTest == -32);
-    _RS_ASSERT(intTest == -64);
-    _RS_ASSERT(longTest == 17179869185l);
-    _RS_ASSERT(longlongTest == 68719476735l);
-
-    _RS_ASSERT(ucharTest == 8);
-    _RS_ASSERT(ushortTest == 16);
-    _RS_ASSERT(uintTest == 32);
-    _RS_ASSERT(ulongTest == 4611686018427387903L);
-    _RS_ASSERT(int64_tTest == -17179869184l);
-    _RS_ASSERT(uint64_tTest == 117179869185l);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_primitives FAILED", time);
-    }
-    else {
-        rsDebug("test_primitives PASSED", time);
-    }
-
-    return failed;
-}
-
-void primitives_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_primitive_types(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/program_raster.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/program_raster.rs
deleted file mode 100644
index 3d6b502..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/program_raster.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_program_raster pointSpriteEnabled;
-rs_program_raster cullMode;
-
-static bool test_program_raster_getters() {
-    bool failed = false;
-
-    _RS_ASSERT(rsgProgramRasterIsPointSpriteEnabled(pointSpriteEnabled) == true);
-    _RS_ASSERT(rsgProgramRasterGetCullMode(pointSpriteEnabled) == RS_CULL_BACK);
-
-    _RS_ASSERT(rsgProgramRasterIsPointSpriteEnabled(cullMode) == false);
-    _RS_ASSERT(rsgProgramRasterGetCullMode(cullMode) == RS_CULL_FRONT);
-
-    if (failed) {
-        rsDebug("test_program_raster_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_program_raster_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void program_raster_test() {
-    bool failed = false;
-    failed |= test_program_raster_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/program_store.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/program_store.rs
deleted file mode 100644
index 2ae5636..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/program_store.rs
+++ /dev/null
@@ -1,128 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_program_store ditherEnable;
-rs_program_store colorRWriteEnable;
-rs_program_store colorGWriteEnable;
-rs_program_store colorBWriteEnable;
-rs_program_store colorAWriteEnable;
-rs_program_store blendSrc;
-rs_program_store blendDst;
-rs_program_store depthWriteEnable;
-rs_program_store depthFunc;
-
-static bool test_program_store_getters() {
-    bool failed = false;
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(depthFunc) == RS_DEPTH_FUNC_GREATER);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(depthFunc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(depthFunc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(depthFunc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(depthFunc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( depthFunc) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(depthFunc) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(depthFunc) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(depthFunc) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(depthWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(depthWriteEnable) == true);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(depthWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(depthWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(depthWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( depthWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(depthWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(depthWriteEnable) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(depthWriteEnable) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorRWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorRWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorRWriteEnable) == true);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorRWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorRWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorRWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorRWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorRWriteEnable) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorRWriteEnable) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorGWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorGWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorGWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorGWriteEnable) == true);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorGWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorGWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorGWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorGWriteEnable) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorGWriteEnable) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorBWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorBWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorBWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorBWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorBWriteEnable) == true);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorBWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorBWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorBWriteEnable) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorBWriteEnable) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorAWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorAWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorAWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorAWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorAWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorAWriteEnable) == true);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorAWriteEnable) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorAWriteEnable) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorAWriteEnable) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(ditherEnable) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(ditherEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(ditherEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(ditherEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(ditherEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( ditherEnable) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(ditherEnable) == true);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(ditherEnable) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(ditherEnable) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(blendSrc) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(blendSrc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(blendSrc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(blendSrc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(blendSrc) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( blendSrc) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(blendSrc) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(blendSrc) == RS_BLEND_SRC_DST_COLOR);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(blendSrc) == RS_BLEND_DST_ZERO);
-
-    _RS_ASSERT(rsgProgramStoreGetDepthFunc(blendDst) == RS_DEPTH_FUNC_ALWAYS);
-    _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(blendDst) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(blendDst) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(blendDst) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(blendDst) == false);
-    _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( blendDst) == false);
-    _RS_ASSERT(rsgProgramStoreIsDitherEnabled(blendDst) == false);
-    _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(blendDst) == RS_BLEND_SRC_ZERO);
-    _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(blendDst) == RS_BLEND_DST_DST_ALPHA);
-
-    if (failed) {
-        rsDebug("test_program_store_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_program_store_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void program_store_test() {
-    bool failed = false;
-    failed |= test_program_store_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/refcount.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/refcount.rs
deleted file mode 100644
index 4ea70e2..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/refcount.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "shared.rsh"
-
-// Testing reference counting of RS object types
-
-rs_allocation globalA;
-static rs_allocation staticGlobalA;
-
-void refcount_test() {
-    staticGlobalA = globalA;
-    rsClearObject(&globalA);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs
deleted file mode 100644
index 68ac168..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/rsdebug.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-float2 float2Test = {2.99f, 12.99f};
-float3 float3Test = {3.99f, 13.99f, 23.99f};
-float4 float4Test = {4.99f, 14.99f, 24.99f, 34.99f};
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    // For this reason, none of the outputs are actually checked.
-
-    rsDebug("floatTest", floatTest);
-    rsDebug("float2Test", float2Test);
-    rsDebug("float3Test", float3Test);
-    rsDebug("float4Test", float4Test);
-    rsDebug("doubleTest", doubleTest);
-    rsDebug("charTest", charTest);
-    rsDebug("shortTest", shortTest);
-    rsDebug("intTest", intTest);
-    rsDebug("longTest", longTest);
-    rsDebug("longlongTest", longlongTest);
-
-    rsDebug("ucharTest", ucharTest);
-    rsDebug("ushortTest", ushortTest);
-    rsDebug("uintTest", uintTest);
-    rsDebug("ulongTest", ulongTest);
-    rsDebug("int64_tTest", int64_tTest);
-    rsDebug("uint64_tTest", uint64_tTest);
-
-    return failed;
-}
-
-void test_rsdebug(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rsdebug_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rsdebug_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/rslist.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/rslist.rs
deleted file mode 100644
index d8663fb..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/rslist.rs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2009 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.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-#include "rs_graphics.rsh"
-
-float gDY;
-
-rs_font gFont;
-
-typedef struct ListAllocs_s {
-    rs_allocation text;
-    int result;
-} ListAllocs;
-
-ListAllocs *gList;
-
-void init() {
-    gDY = 0.0f;
-}
-
-int textPos = 0;
-
-int root(void) {
-
-    rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-    rsgClearDepth(1.0f);
-
-    textPos -= (int)gDY*2;
-    gDY *= 0.95;
-
-    rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
-    rsgBindFont(gFont);
-
-    rs_allocation listAlloc;
-    listAlloc = rsGetAllocation(gList);
-    int allocSize = rsAllocationGetDimX(listAlloc);
-
-    int width = rsgGetWidth();
-    int height = rsgGetHeight();
-
-    int itemHeight = 80;
-    int totalItemHeight = itemHeight * allocSize;
-
-    /* Prevent scrolling above the top of the list */
-    int firstItem = height - totalItemHeight;
-    if (firstItem < 0) {
-        firstItem = 0;
-    }
-
-    /* Prevent scrolling past the last line of the list */
-    int lastItem = -1 * (totalItemHeight - height);
-    if (lastItem > 0) {
-        lastItem = 0;
-    }
-
-    if (textPos > firstItem) {
-        textPos = firstItem;
-    }
-    else if (textPos < lastItem) {
-        textPos = lastItem;
-    }
-
-    int currentYPos = itemHeight + textPos;
-
-    for(int i = 0; i < allocSize; i ++) {
-        if(currentYPos - itemHeight > height) {
-            break;
-        }
-
-        if(currentYPos > 0) {
-            switch(gList[i].result) {
-                case 1: /* Passed */
-                    rsgFontColor(0.5f, 0.9f, 0.5f, 1.0f);
-                    break;
-                case -1: /* Failed */
-                    rsgFontColor(0.9f, 0.5f, 0.5f, 1.0f);
-                    break;
-                case 0: /* Still Testing */
-                    rsgFontColor(0.9f, 0.9f, 0.5f, 1.0f);
-                    break;
-                default: /* Unknown */
-                    rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
-                    break;
-            }
-            rsgDrawRect(0, currentYPos - 1, width, currentYPos, 0);
-            rsgDrawText(gList[i].text, 30, currentYPos - 32);
-        }
-        currentYPos += itemHeight;
-    }
-
-    return 10;
-}
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/rstime.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/rstime.rs
deleted file mode 100644
index 7be955d..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/rstime.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "shared.rsh"
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_time_t curTime = rsTime(0);
-    rs_tm tm;
-    rsDebug("curTime", curTime);
-
-    rsLocaltime(&tm, &curTime);
-
-    rsDebug("tm.tm_sec", tm.tm_sec);
-    rsDebug("tm.tm_min", tm.tm_min);
-    rsDebug("tm.tm_hour", tm.tm_hour);
-    rsDebug("tm.tm_mday", tm.tm_mday);
-    rsDebug("tm.tm_mon", tm.tm_mon);
-    rsDebug("tm.tm_year", tm.tm_year);
-    rsDebug("tm.tm_wday", tm.tm_wday);
-    rsDebug("tm.tm_yday", tm.tm_yday);
-    rsDebug("tm.tm_isdst", tm.tm_isdst);
-
-    // Test a specific time (since we set America/Los_Angeles localtime)
-    curTime = 1294438893;
-    rsLocaltime(&tm, &curTime);
-
-    _RS_ASSERT(tm.tm_sec == 33);
-    _RS_ASSERT(tm.tm_min == 21);
-    _RS_ASSERT(tm.tm_hour == 14);
-    _RS_ASSERT(tm.tm_mday == 7);
-    _RS_ASSERT(tm.tm_mon == 0);
-    _RS_ASSERT(tm.tm_year == 111);
-    _RS_ASSERT(tm.tm_wday == 5);
-    _RS_ASSERT(tm.tm_yday == 6);
-    _RS_ASSERT(tm.tm_isdst == 0);
-
-    return failed;
-}
-
-void test_rstime(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstime_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstime_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/rstypes.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/rstypes.rs
deleted file mode 100644
index 22d9c13..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/rstypes.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element elementTest;
-rs_type typeTest;
-rs_allocation allocationTest;
-rs_sampler samplerTest;
-rs_script scriptTest;
-rs_mesh meshTest;
-rs_program_fragment program_fragmentTest;
-rs_program_vertex program_vertexTest;
-rs_program_raster program_rasterTest;
-rs_program_store program_storeTest;
-rs_font fontTest;
-
-rs_matrix4x4 matrix4x4Test;
-rs_matrix3x3 matrix3x3Test;
-rs_matrix2x2 matrix2x2Test;
-
-struct my_struct {
-    int i;
-    rs_font fontTestStruct;
-};
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_matrix4x4 matrix4x4TestLocal;
-    rs_matrix3x3 matrix3x3TestLocal;
-    rs_matrix2x2 matrix2x2TestLocal;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    rs_element elementTestLocal;
-    rs_type typeTestLocal;
-    rs_allocation allocationTestLocal;
-    rs_sampler samplerTestLocal;
-    rs_script scriptTestLocal;
-    rs_mesh meshTestLocal;
-    rs_program_fragment program_fragmentTestLocal;
-    rs_program_vertex program_vertexTestLocal;
-    rs_program_raster program_rasterTestLocal;
-    rs_program_store program_storeTestLocal;
-    rs_font fontTestLocal;
-
-    rs_font fontTestLocalArray[4];
-
-    rs_font fontTestLocalPreInit = fontTest;
-
-    struct my_struct structTest;
-
-    fontTestLocal = fontTest;
-    //allocationTestLocal = allocationTest;
-
-    fontTest = fontTestLocal;
-    //allocationTest = allocationTestLocal;
-
-    /*for (int i = 0; i < 4; i++) {
-        fontTestLocalArray[i] = fontTestLocal;
-    }*/
-
-    /*fontTest = fontTestLocalArray[3];*/
-
-    return failed;
-}
-
-void test_rstypes(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstypes_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstypes_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs
deleted file mode 100644
index ff1c0a7..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/sampler.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-rs_sampler minification;
-rs_sampler magnification;
-rs_sampler wrapS;
-rs_sampler wrapT;
-rs_sampler anisotropy;
-
-static bool test_sampler_getters() {
-    bool failed = false;
-
-    _RS_ASSERT(rsSamplerGetMagnification(minification) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(minification) == RS_SAMPLER_LINEAR_MIP_LINEAR);
-    _RS_ASSERT(rsSamplerGetWrapS(minification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(minification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(minification) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(magnification) == RS_SAMPLER_LINEAR);
-    _RS_ASSERT(rsSamplerGetMinification(magnification) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(magnification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(magnification) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(magnification) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(wrapS) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(wrapS) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(wrapS) == RS_SAMPLER_WRAP);
-    _RS_ASSERT(rsSamplerGetWrapT(wrapS) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(wrapS) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(wrapT) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(wrapT) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(wrapT) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(wrapT) == RS_SAMPLER_WRAP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(wrapT) == 1.0f);
-
-    _RS_ASSERT(rsSamplerGetMagnification(anisotropy) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetMinification(anisotropy) == RS_SAMPLER_NEAREST);
-    _RS_ASSERT(rsSamplerGetWrapS(anisotropy) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetWrapT(anisotropy) == RS_SAMPLER_CLAMP);
-    _RS_ASSERT(rsSamplerGetAnisotropy(anisotropy) == 8.0f);
-
-    if (failed) {
-        rsDebug("test_sampler_getters FAILED", 0);
-    }
-    else {
-        rsDebug("test_sampler_getters PASSED", 0);
-    }
-
-    return failed;
-}
-
-void sampler_test() {
-    bool failed = false;
-    failed |= test_sampler_getters();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/shared.rsh b/tests/RenderScriptTests/tests/src/com/android/rs/test/shared.rsh
deleted file mode 100644
index 3adc999..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/shared.rsh
+++ /dev/null
@@ -1,114 +0,0 @@
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-typedef struct TestResult_s {
-    rs_allocation name;
-    bool pass;
-    float score;
-    int64_t time;
-} TestResult;
-//TestResult *g_results;
-
-static int64_t g_time;
-
-static void start(void) {
-    g_time = rsUptimeMillis();
-}
-
-static float end(uint32_t idx) {
-    int64_t t = rsUptimeMillis() - g_time;
-    //g_results[idx].time = t;
-    //rsDebug("test time", (int)t);
-    return ((float)t) / 1000.f;
-}
-
-#define _RS_ASSERT(b) \
-do { \
-    if (!(b)) { \
-        failed = true; \
-        rsDebug(#b " FAILED", 0); \
-    } \
-\
-} while (0)
-
-static const int iposinf = 0x7f800000;
-static const int ineginf = 0xff800000;
-
-static const float posinf() {
-    float f = *((float*)&iposinf);
-    return f;
-}
-
-static const float neginf() {
-    float f = *((float*)&ineginf);
-    return f;
-}
-
-static bool isposinf(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == iposinf);
-}
-
-static bool isneginf(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == ineginf);
-}
-
-static bool isnan(float f) {
-    int i = *((int*)(void*)&f);
-    return (((i & 0x7f800000) == 0x7f800000) && (i & 0x007fffff));
-}
-
-static bool isposzero(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == 0x00000000);
-}
-
-static bool isnegzero(float f) {
-    int i = *((int*)(void*)&f);
-    return (i == 0x80000000);
-}
-
-static bool iszero(float f) {
-    return isposzero(f) || isnegzero(f);
-}
-
-/* Absolute epsilon used for floats.  Value is similar to float.h. */
-#ifndef FLT_EPSILON
-#define FLT_EPSILON 1.19e7f
-#endif
-/* Max ULPs while still being considered "equal".  Only used when this number
-   of ULPs is of a greater size than FLT_EPSILON. */
-#define FLT_MAX_ULP 1
-
-/* Calculate the difference in ULPs between the two values.  (Return zero on
-   perfect equality.) */
-static int float_dist(float f1, float f2) {
-    return *((int *)(&f1)) - *((int *)(&f2));
-}
-
-/* Check if two floats are essentially equal.  Will fail with some values
-   due to design.  (Validate using FLT_EPSILON or similar if necessary.) */
-static bool float_almost_equal(float f1, float f2) {
-    int *i1 = (int*)(&f1);
-    int *i2 = (int*)(&f2);
-
-    // Check for sign equality
-    if ( ((*i1 >> 31) == 0) != ((*i2 >> 31) == 0) ) {
-        // Handle signed zeroes
-        if (f1 == f2)
-            return true;
-        return false;
-    }
-
-    // Check with ULP distance
-    if (float_dist(f1, f2) > FLT_MAX_ULP)
-        return false;
-    return true;
-}
-
-/* These constants must match those in UnitTest.java */
-static const int RS_MSG_TEST_PASSED = 100;
-static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/struct.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/struct.rs
deleted file mode 100644
index 1cd728e..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/struct.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "shared.rsh"
-
-typedef struct Point2 {
-   int x;
-   int y;
-} Point_2;
-Point_2 *point2;
-
-static bool test_Point_2(int expected) {
-    bool failed = false;
-
-    rsDebug("Point: ", point2[0].x, point2[0].y);
-    _RS_ASSERT(point2[0].x == expected);
-    _RS_ASSERT(point2[0].y == expected);
-
-    if (failed) {
-        rsDebug("test_Point_2 FAILED", 0);
-    }
-    else {
-        rsDebug("test_Point_2 PASSED", 0);
-    }
-
-    return failed;
-}
-
-void struct_test(int expected) {
-    bool failed = false;
-    failed |= test_Point_2(expected);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/test_root.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/test_root.rs
deleted file mode 100644
index 6dc83ba..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/test_root.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Fountain test script
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-#pragma stateFragment(parent)
-
-#include "rs_graphics.rsh"
-
-
-typedef struct TestResult {
-    rs_allocation name;
-    bool pass;
-    float score;
-} TestResult_t;
-TestResult_t *results;
-
-int root() {
-
-    return 0;
-}
-
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/unsigned.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/unsigned.rs
deleted file mode 100644
index 2c056f4..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/unsigned.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "shared.rsh"
-
-// Testing unsigned types for Bug 6764163
-unsigned int ui = 37;
-unsigned char uc = 5;
-
-static bool test_unsigned() {
-    bool failed = false;
-
-    rsDebug("ui", ui);
-    rsDebug("uc", uc);
-    _RS_ASSERT(ui == 0x7fffffff);
-    _RS_ASSERT(uc == 129);
-
-    if (failed) {
-        rsDebug("test_unsigned FAILED", -1);
-    }
-    else {
-        rsDebug("test_unsigned PASSED", 0);
-    }
-
-    return failed;
-}
-
-void unsigned_test() {
-    bool failed = false;
-    failed |= test_unsigned();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/vector.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/vector.rs
deleted file mode 100644
index 0430a2f..0000000
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/vector.rs
+++ /dev/null
@@ -1,198 +0,0 @@
-#include "shared.rsh"
-
-// Testing vector types
-float2 f2 = { 1.0f, 2.0f };
-float3 f3 = { 1.0f, 2.0f, 3.0f };
-float4 f4 = { 1.0f, 2.0f, 3.0f, 4.0f };
-
-double2 d2 = { 1.0, 2.0 };
-double3 d3 = { 1.0, 2.0, 3.0 };
-double4 d4 = { 1.0, 2.0, 3.0, 4.0 };
-
-char2 i8_2 = { 1, 2 };
-char3 i8_3 = { 1, 2, 3 };
-char4 i8_4 = { 1, 2, 3, 4 };
-
-uchar2 u8_2 = { 1, 2 };
-uchar3 u8_3 = { 1, 2, 3 };
-uchar4 u8_4 = { 1, 2, 3, 4 };
-
-short2 i16_2 = { 1, 2 };
-short3 i16_3 = { 1, 2, 3 };
-short4 i16_4 = { 1, 2, 3, 4 };
-
-ushort2 u16_2 = { 1, 2 };
-ushort3 u16_3 = { 1, 2, 3 };
-ushort4 u16_4 = { 1, 2, 3, 4 };
-
-int2 i32_2 = { 1, 2 };
-int3 i32_3 = { 1, 2, 3 };
-int4 i32_4 = { 1, 2, 3, 4 };
-
-uint2 u32_2 = { 1, 2 };
-uint3 u32_3 = { 1, 2, 3 };
-uint4 u32_4 = { 1, 2, 3, 4 };
-
-long2 i64_2 = { 1, 2 };
-long3 i64_3 = { 1, 2, 3 };
-long4 i64_4 = { 1, 2, 3, 4 };
-
-ulong2 u64_2 = { 1, 2 };
-ulong3 u64_3 = { 1, 2, 3 };
-ulong4 u64_4 = { 1, 2, 3, 4 };
-
-static bool test_vector_types() {
-    bool failed = false;
-
-    rsDebug("Testing F32", 0);
-    _RS_ASSERT(f2.x == 2.99f);
-    _RS_ASSERT(f2.y == 3.99f);
-
-    _RS_ASSERT(f3.x == 2.99f);
-    _RS_ASSERT(f3.y == 3.99f);
-    _RS_ASSERT(f3.z == 4.99f);
-
-    _RS_ASSERT(f4.x == 2.99f);
-    _RS_ASSERT(f4.y == 3.99f);
-    _RS_ASSERT(f4.z == 4.99f);
-    _RS_ASSERT(f4.w == 5.99f);
-
-    rsDebug("Testing F64", 0);
-    _RS_ASSERT(d2.x == 2.99);
-    _RS_ASSERT(d2.y == 3.99);
-
-    _RS_ASSERT(d3.x == 2.99);
-    _RS_ASSERT(d3.y == 3.99);
-    _RS_ASSERT(d3.z == 4.99);
-
-    _RS_ASSERT(d4.x == 2.99);
-    _RS_ASSERT(d4.y == 3.99);
-    _RS_ASSERT(d4.z == 4.99);
-    _RS_ASSERT(d4.w == 5.99);
-
-    rsDebug("Testing I8", 0);
-    _RS_ASSERT(i8_2.x == 2);
-    _RS_ASSERT(i8_2.y == 3);
-
-    _RS_ASSERT(i8_3.x == 2);
-    _RS_ASSERT(i8_3.y == 3);
-    _RS_ASSERT(i8_3.z == 4);
-
-    _RS_ASSERT(i8_4.x == 2);
-    _RS_ASSERT(i8_4.y == 3);
-    _RS_ASSERT(i8_4.z == 4);
-    _RS_ASSERT(i8_4.w == 5);
-
-    rsDebug("Testing U8", 0);
-    _RS_ASSERT(u8_2.x == 2);
-    _RS_ASSERT(u8_2.y == 3);
-
-    _RS_ASSERT(u8_3.x == 2);
-    _RS_ASSERT(u8_3.y == 3);
-    _RS_ASSERT(u8_3.z == 4);
-
-    _RS_ASSERT(u8_4.x == 2);
-    _RS_ASSERT(u8_4.y == 3);
-    _RS_ASSERT(u8_4.z == 4);
-    _RS_ASSERT(u8_4.w == 5);
-
-    rsDebug("Testing I16", 0);
-    _RS_ASSERT(i16_2.x == 2);
-    _RS_ASSERT(i16_2.y == 3);
-
-    _RS_ASSERT(i16_3.x == 2);
-    _RS_ASSERT(i16_3.y == 3);
-    _RS_ASSERT(i16_3.z == 4);
-
-    _RS_ASSERT(i16_4.x == 2);
-    _RS_ASSERT(i16_4.y == 3);
-    _RS_ASSERT(i16_4.z == 4);
-    _RS_ASSERT(i16_4.w == 5);
-
-    rsDebug("Testing U16", 0);
-    _RS_ASSERT(u16_2.x == 2);
-    _RS_ASSERT(u16_2.y == 3);
-
-    _RS_ASSERT(u16_3.x == 2);
-    _RS_ASSERT(u16_3.y == 3);
-    _RS_ASSERT(u16_3.z == 4);
-
-    _RS_ASSERT(u16_4.x == 2);
-    _RS_ASSERT(u16_4.y == 3);
-    _RS_ASSERT(u16_4.z == 4);
-    _RS_ASSERT(u16_4.w == 5);
-
-    rsDebug("Testing I32", 0);
-    _RS_ASSERT(i32_2.x == 2);
-    _RS_ASSERT(i32_2.y == 3);
-
-    _RS_ASSERT(i32_3.x == 2);
-    _RS_ASSERT(i32_3.y == 3);
-    _RS_ASSERT(i32_3.z == 4);
-
-    _RS_ASSERT(i32_4.x == 2);
-    _RS_ASSERT(i32_4.y == 3);
-    _RS_ASSERT(i32_4.z == 4);
-    _RS_ASSERT(i32_4.w == 5);
-
-    rsDebug("Testing U32", 0);
-    _RS_ASSERT(u32_2.x == 2);
-    _RS_ASSERT(u32_2.y == 3);
-
-    _RS_ASSERT(u32_3.x == 2);
-    _RS_ASSERT(u32_3.y == 3);
-    _RS_ASSERT(u32_3.z == 4);
-
-    _RS_ASSERT(u32_4.x == 2);
-    _RS_ASSERT(u32_4.y == 3);
-    _RS_ASSERT(u32_4.z == 4);
-    _RS_ASSERT(u32_4.w == 5);
-
-    rsDebug("Testing I64", 0);
-    _RS_ASSERT(i64_2.x == 2);
-    _RS_ASSERT(i64_2.y == 3);
-
-    _RS_ASSERT(i64_3.x == 2);
-    _RS_ASSERT(i64_3.y == 3);
-    _RS_ASSERT(i64_3.z == 4);
-
-    _RS_ASSERT(i64_4.x == 2);
-    _RS_ASSERT(i64_4.y == 3);
-    _RS_ASSERT(i64_4.z == 4);
-    _RS_ASSERT(i64_4.w == 5);
-
-    rsDebug("Testing U64", 0);
-    _RS_ASSERT(u64_2.x == 2);
-    _RS_ASSERT(u64_2.y == 3);
-
-    _RS_ASSERT(u64_3.x == 2);
-    _RS_ASSERT(u64_3.y == 3);
-    _RS_ASSERT(u64_3.z == 4);
-
-    _RS_ASSERT(u64_4.x == 2);
-    _RS_ASSERT(u64_4.y == 3);
-    _RS_ASSERT(u64_4.z == 4);
-    _RS_ASSERT(u64_4.w == 5);
-
-    if (failed) {
-        rsDebug("test_vector FAILED", 0);
-    }
-    else {
-        rsDebug("test_vector PASSED", 0);
-    }
-
-    return failed;
-}
-
-void vector_test() {
-    bool failed = false;
-    failed |= test_vector_types();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v11/Android.mk b/tests/RenderScriptTests/tests_v11/Android.mk
deleted file mode 100644
index 52d326b..0000000
--- a/tests/RenderScriptTests/tests_v11/Android.mk
+++ /dev/null
@@ -1,31 +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.
-#
-
-ifneq ($(TARGET_SIMULATOR),true)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RSTest_v11
-LOCAL_SDK_VERSION := 11
-
-include $(BUILD_PACKAGE)
-
-endif
diff --git a/tests/RenderScriptTests/tests_v11/AndroidManifest.xml b/tests/RenderScriptTests/tests_v11/AndroidManifest.xml
deleted file mode 100644
index f4aeda2..0000000
--- a/tests/RenderScriptTests/tests_v11/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.test_v11">
-    <uses-sdk android:minSdkVersion="11" />
-    <application 
-        android:label="_RS_Test_v11"
-        android:icon="@drawable/test_pattern">
-        <activity android:name="RSTest_v11"
-                  android:screenOrientation="portrait">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/tests_v11/res/drawable/test_pattern.png b/tests/RenderScriptTests/tests_v11/res/drawable/test_pattern.png
deleted file mode 100644
index e7d1455..0000000
--- a/tests/RenderScriptTests/tests_v11/res/drawable/test_pattern.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestCore.java
deleted file mode 100644
index 888cfe4..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestCore.java
+++ /dev/null
@@ -1,206 +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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-import java.util.ArrayList;
-import java.util.ListIterator;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class RSTestCore {
-    int mWidth;
-    int mHeight;
-    Context mCtx;
-
-    public RSTestCore(Context ctx) {
-        mCtx = ctx;
-    }
-
-    private Resources mRes;
-    private RenderScriptGL mRS;
-
-    private Font mFont;
-    ScriptField_ListAllocs_s mListAllocs;
-    int mLastX;
-    int mLastY;
-    private ScriptC_rslist mScript;
-
-    private ArrayList<UnitTest> unitTests;
-    private ListIterator<UnitTest> test_iter;
-    private UnitTest activeTest;
-    private boolean stopTesting;
-
-    /* Periodic timer for ensuring future tests get scheduled */
-    private Timer mTimer;
-    public static final int RS_TIMER_PERIOD = 100;
-
-    public void init(RenderScriptGL rs, Resources res, int width, int height) {
-        mRS = rs;
-        mRes = res;
-        mWidth = width;
-        mHeight = height;
-        stopTesting = false;
-
-        mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);
-
-        unitTests = new ArrayList<UnitTest>();
-
-        unitTests.add(new UT_primitives(this, mRes, mCtx));
-        unitTests.add(new UT_rsdebug(this, mRes, mCtx));
-        unitTests.add(new UT_rstime(this, mRes, mCtx));
-        unitTests.add(new UT_rstypes(this, mRes, mCtx));
-        unitTests.add(new UT_math(this, mRes, mCtx));
-        unitTests.add(new UT_fp_mad(this, mRes, mCtx));
-        /*
-        unitTests.add(new UnitTest(null, "<Pass>", 1));
-        unitTests.add(new UnitTest());
-        unitTests.add(new UnitTest(null, "<Fail>", -1));
-
-        for (int i = 0; i < 20; i++) {
-            unitTests.add(new UnitTest(null, "<Pass>", 1));
-        }
-        */
-
-        UnitTest [] uta = new UnitTest[unitTests.size()];
-        uta = unitTests.toArray(uta);
-
-        mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
-        for (int i = 0; i < uta.length; i++) {
-            ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
-            listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
-            listElem.result = uta[i].result;
-            mListAllocs.set(listElem, i, false);
-            uta[i].setItem(listElem);
-        }
-
-        mListAllocs.copyAll();
-
-        mScript.bind_gList(mListAllocs);
-
-        mFont = Font.create(mRS, mRes, "serif", Font.Style.BOLD, 8);
-        mScript.set_gFont(mFont);
-
-        mRS.bindRootScript(mScript);
-
-        test_iter = unitTests.listIterator();
-        refreshTestResults(); /* Kick off the first test */
-
-        TimerTask pTask = new TimerTask() {
-            public void run() {
-                refreshTestResults();
-            }
-        };
-
-        mTimer = new Timer();
-        mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
-    }
-
-    public void checkAndRunNextTest() {
-        if (activeTest != null) {
-            if (!activeTest.isAlive()) {
-                /* Properly clean up on our last test */
-                try {
-                    activeTest.join();
-                }
-                catch (InterruptedException e) {
-                }
-                activeTest = null;
-            }
-        }
-
-        if (!stopTesting && activeTest == null) {
-            if (test_iter.hasNext()) {
-                activeTest = test_iter.next();
-                activeTest.start();
-                /* This routine will only get called once when a new test
-                 * should start running. The message handler in UnitTest.java
-                 * ensures this. */
-            }
-            else {
-                if (mTimer != null) {
-                    mTimer.cancel();
-                    mTimer.purge();
-                    mTimer = null;
-                }
-            }
-        }
-    }
-
-    public void refreshTestResults() {
-        checkAndRunNextTest();
-
-        if (mListAllocs != null && mScript != null && mRS != null) {
-            mListAllocs.copyAll();
-
-            mScript.bind_gList(mListAllocs);
-            mRS.bindRootScript(mScript);
-        }
-    }
-
-    public void cleanup() {
-        stopTesting = true;
-        UnitTest t = activeTest;
-
-        /* Stop periodic refresh of testing */
-        if (mTimer != null) {
-            mTimer.cancel();
-            mTimer.purge();
-            mTimer = null;
-        }
-
-        /* Wait to exit until we finish the current test */
-        if (t != null) {
-            try {
-                t.join();
-            }
-            catch (InterruptedException e) {
-            }
-            t = null;
-        }
-
-    }
-
-    public void newTouchPosition(float x, float y, float pressure, int id) {
-    }
-
-    public void onActionDown(int x, int y) {
-        mScript.set_gDY(0.0f);
-        mLastX = x;
-        mLastY = y;
-        refreshTestResults();
-    }
-
-    public void onActionMove(int x, int y) {
-        int dx = mLastX - x;
-        int dy = mLastY - y;
-
-        if (Math.abs(dy) <= 2) {
-            dy = 0;
-        }
-
-        mScript.set_gDY(dy);
-
-        mLastX = x;
-        mLastY = y;
-        refreshTestResults();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestView.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestView.java
deleted file mode 100644
index b5bebe9..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTestView.java
+++ /dev/null
@@ -1,97 +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.rs.test_v11;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class RSTestView extends RSSurfaceView {
-
-    private Context mCtx;
-
-    public RSTestView(Context context) {
-        super(context);
-        mCtx = context;
-        //setFocusable(true);
-    }
-
-    private RenderScriptGL mRS;
-    private RSTestCore mRender;
-
-    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
-        super.surfaceChanged(holder, format, w, h);
-        if (mRS == null) {
-            RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
-            mRS = createRenderScriptGL(sc);
-            mRS.setSurface(holder, w, h);
-            mRender = new RSTestCore(mCtx);
-            mRender.init(mRS, getResources(), w, h);
-        }
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        if(mRS != null) {
-            mRender.cleanup();
-            mRS = null;
-            destroyRenderScriptGL();
-        }
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event)
-    {
-        return super.onKeyDown(keyCode, event);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev)
-    {
-        boolean ret = false;
-        int act = ev.getAction();
-        if (act == ev.ACTION_DOWN) {
-            mRender.onActionDown((int)ev.getX(), (int)ev.getY());
-            ret = true;
-        }
-        else if (act == ev.ACTION_MOVE) {
-            mRender.onActionMove((int)ev.getX(), (int)ev.getY());
-            ret = true;
-        }
-
-        return ret;
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTest_v11.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTest_v11.java
deleted file mode 100644
index 1dedfce..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/RSTest_v11.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.rs.test_v11;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Config;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class RSTest_v11 extends Activity {
-    //EventListener mListener = new EventListener();
-
-    private static final String LOG_TAG = "libRS_jni";
-    private static final boolean DEBUG  = false;
-    private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
-
-    private RSTestView mView;
-
-    // get the current looper (from your Activity UI thread for instance
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        // Create our Preview view and set it as the content of our
-        // Activity
-        mView = new RSTestView(this);
-        setContentView(mView);
-    }
-
-    @Override
-    protected void onResume() {
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity loses focus
-        super.onResume();
-        mView.resume();
-    }
-
-    @Override
-    protected void onPause() {
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity loses focus
-        super.onPause();
-        mView.pause();
-    }
-
-    static void log(String message) {
-        if (LOG_ENABLED) {
-            Log.v(LOG_TAG, message);
-        }
-    }
-
-
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_fp_mad.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_fp_mad.java
deleted file mode 100644
index 5d72aa6..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_fp_mad.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_fp_mad extends UnitTest {
-    private Resources mRes;
-
-    protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Fp_Mad", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_fp_mad s = new ScriptC_fp_mad(pRS, mRes, R.raw.fp_mad);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_fp_mad_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_math.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_math.java
deleted file mode 100644
index 7e356f8..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_math.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_math extends UnitTest {
-    private Resources mRes;
-
-    protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math s = new ScriptC_math(pRS, mRes, R.raw.math);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_math_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_primitives.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_primitives.java
deleted file mode 100644
index dc3efbc..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_primitives.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_primitives extends UnitTest {
-    private Resources mRes;
-
-    protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Primitives", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_primitives s) {
-        float pF = s.get_floatTest();
-        if (pF != 1.99f) {
-            return false;
-        }
-        s.set_floatTest(2.99f);
-
-        double pD = s.get_doubleTest();
-        if (pD != 2.05) {
-            return false;
-        }
-        s.set_doubleTest(3.05);
-
-        byte pC = s.get_charTest();
-        if (pC != -8) {
-            return false;
-        }
-        s.set_charTest((byte)-16);
-
-        short pS = s.get_shortTest();
-        if (pS != -16) {
-            return false;
-        }
-        s.set_shortTest((short)-32);
-
-        int pI = s.get_intTest();
-        if (pI != -32) {
-            return false;
-        }
-        s.set_intTest(-64);
-
-        long pL = s.get_longTest();
-        if (pL != 17179869184l) {
-            return false;
-        }
-        s.set_longTest(17179869185l);
-
-        long puL = s.get_ulongTest();
-        if (puL != 4611686018427387904L) {
-            return false;
-        }
-        s.set_ulongTest(4611686018427387903L);
-
-
-        long pLL = s.get_longlongTest();
-        if (pLL != 68719476736L) {
-            return false;
-        }
-        s.set_longlongTest(68719476735L);
-
-        long pu64 = s.get_uint64_tTest();
-        if (pu64 != 117179869184l) {
-            return false;
-        }
-        s.set_uint64_tTest(117179869185l);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            // initializeGlobals failed
-            result = -1;
-        } else {
-            s.invoke_primitives_test(0, 0);
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rsdebug.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rsdebug.java
deleted file mode 100644
index 00dbaf5..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rsdebug.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rsdebug extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsDebug", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rsdebug s = new ScriptC_rsdebug(pRS, mRes, R.raw.rsdebug);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rsdebug(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstime.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstime.java
deleted file mode 100644
index 5b4c399..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstime.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstime extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTime", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstime s = new ScriptC_rstime(pRS, mRes, R.raw.rstime);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rstime(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstypes.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstypes.java
deleted file mode 100644
index 72a97c9..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UT_rstypes.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstypes extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTypes", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstypes s = new ScriptC_rstypes(pRS, mRes, R.raw.rstypes);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rstypes(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UnitTest.java b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UnitTest.java
deleted file mode 100644
index b62e535..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/UnitTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v11;
-import android.content.Context;
-import android.renderscript.RenderScript.RSMessageHandler;
-import android.util.Log;
-
-public class UnitTest extends Thread {
-    public String name;
-    public int result;
-    private ScriptField_ListAllocs_s.Item mItem;
-    private RSTestCore mRSTC;
-    private boolean msgHandled;
-    protected Context mCtx;
-
-    /* These constants must match those in shared.rsh */
-    public static final int RS_MSG_TEST_PASSED = 100;
-    public static final int RS_MSG_TEST_FAILED = 101;
-
-    private static int numTests = 0;
-    public int testID;
-
-    protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
-        super();
-        mRSTC = rstc;
-        name = n;
-        msgHandled = false;
-        mCtx = ctx;
-        result = initResult;
-        testID = numTests++;
-    }
-
-    protected UnitTest(RSTestCore rstc, String n, Context ctx) {
-        this(rstc, n, 0, ctx);
-    }
-
-    protected UnitTest(RSTestCore rstc, Context ctx) {
-        this (rstc, "<Unknown>", ctx);
-    }
-
-    protected UnitTest(Context ctx) {
-        this (null, ctx);
-    }
-
-    protected RSMessageHandler mRsMessage = new RSMessageHandler() {
-        public void run() {
-            if (result == 0) {
-                switch (mID) {
-                    case RS_MSG_TEST_PASSED:
-                        result = 1;
-                        break;
-                    case RS_MSG_TEST_FAILED:
-                        result = -1;
-                        break;
-                    default:
-                        android.util.Log.v("RenderScript", "Unit test got unexpected message");
-                        return;
-                }
-            }
-
-            if (mItem != null) {
-                mItem.result = result;
-                msgHandled = true;
-                try {
-                    mRSTC.refreshTestResults();
-                }
-                catch (IllegalStateException e) {
-                    /* Ignore the case where our message receiver has been
-                       disconnected. This happens when we leave the application
-                       before it finishes running all of the unit tests. */
-                }
-            }
-        }
-    };
-
-    public void waitForMessage() {
-        while (!msgHandled) {
-            yield();
-        }
-    }
-
-    public void setItem(ScriptField_ListAllocs_s.Item item) {
-        mItem = item;
-    }
-
-    public void run() {
-        /* This method needs to be implemented for each subclass */
-        if (mRSTC != null) {
-            mRSTC.refreshTestResults();
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/fp_mad.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/fp_mad.rs
deleted file mode 100644
index b6f2b2a6..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/fp_mad.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "shared.rsh"
-
-const int TEST_COUNT = 1;
-
-static float data_f1[1025];
-static float4 data_f4[1025];
-
-static void test_mad4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = (data_f4[i] * 0.02f +
-                          data_f4[i+1] * 0.04f +
-                          data_f4[i+2] * 0.05f +
-                          data_f4[i+3] * 0.1f +
-                          data_f4[i+4] * 0.2f +
-                          data_f4[i+5] * 0.2f +
-                          data_f4[i+6] * 0.1f +
-                          data_f4[i+7] * 0.05f +
-                          data_f4[i+8] * 0.04f +
-                          data_f4[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad4 M ops", 1000.f / time);
-}
-
-static void test_mad(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = (data_f1[i] * 0.02f +
-                          data_f1[i+1] * 0.04f +
-                          data_f1[i+2] * 0.05f +
-                          data_f1[i+3] * 0.1f +
-                          data_f1[i+4] * 0.2f +
-                          data_f1[i+5] * 0.2f +
-                          data_f1[i+6] * 0.1f +
-                          data_f1[i+7] * 0.05f +
-                          data_f1[i+8] * 0.04f +
-                          data_f1[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad M ops", 1000.f / time);
-}
-
-static void test_norm(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = normalize(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_norm M ops", 10.f / time);
-}
-
-static void test_sincos4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10 / 4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos4 M ops", 10.f / time);
-}
-
-static void test_sincos(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos M ops", 10.f / time);
-}
-
-static void test_clamp(uint32_t index) {
-    start();
-
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp M ops", 100.f / time);
-
-    start();
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            if (data_f1[i] < -1.f) data_f1[i] = -1.f;
-            if (data_f1[i] > -1.f) data_f1[i] = 1.f;
-        }
-    }
-
-    time = end(index);
-    rsDebug("fp_clamp ref M ops", 100.f / time);
-}
-
-static void test_clamp4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100 /4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp4 M ops", 100.f / time);
-}
-
-void fp_mad_test(uint32_t index, int test_num) {
-    int x;
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f;
-        data_f4[x].x = (x & 0xf) * 0.1f;
-        data_f4[x].y = (x & 0xf0) * 0.1f;
-        data_f4[x].z = (x & 0x33) * 0.1f;
-        data_f4[x].w = (x & 0x77) * 0.1f;
-    }
-
-    test_mad4(index);
-    test_mad(index);
-
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
-        data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
-        data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
-    }
-
-    test_norm(index);
-    test_sincos4(index);
-    test_sincos(index);
-    test_clamp4(index);
-    test_clamp(index);
-
-    // TODO Actually verify test result accuracy
-    rsDebug("fp_mad_test PASSED", 0);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/math.rs
deleted file mode 100644
index 2867be1..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/math.rs
+++ /dev/null
@@ -1,348 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define TEST_FN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f2 = fnc(f2);                   \
-    f3 = fnc(f3);                   \
-    f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (float*) &f1);     \
-    f2 = fnc(f2, (float2*) &f2);    \
-    f3 = fnc(f3, (float3*) &f3);    \
-    f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f2);               \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f1);               \
-    f3 = fnc(f3, f1);               \
-    f4 = fnc(f4, f1);
-
-#define TEST_FN_FUNC_FN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i2);               \
-    f3 = fnc(f3, i3);               \
-    f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i1);               \
-    f3 = fnc(f3, i1);               \
-    f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f2, f2);           \
-    f3 = fnc(f3, f3, f3);           \
-    f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_PIN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (int*) &i1);       \
-    f2 = fnc(f2, (int2*) &i2);      \
-    f3 = fnc(f3, (int3*) &i3);      \
-    f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, (int*) &i1);   \
-    f2 = fnc(f2, f2, (int2*) &i2);  \
-    f3 = fnc(f3, f3, (int3*) &i3);  \
-    f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    i1 = fnc(f1);                   \
-    i2 = fnc(f2);                   \
-    i3 = fnc(f3);                   \
-    i4 = fnc(f4);
-
-
-static bool test_fp_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_FN_FUNC_FN(acos);
-    TEST_FN_FUNC_FN(acosh);
-    TEST_FN_FUNC_FN(acospi);
-    TEST_FN_FUNC_FN(asin);
-    TEST_FN_FUNC_FN(asinh);
-    TEST_FN_FUNC_FN(asinpi);
-    TEST_FN_FUNC_FN(atan);
-    TEST_FN_FUNC_FN_FN(atan2);
-    TEST_FN_FUNC_FN(atanh);
-    TEST_FN_FUNC_FN(atanpi);
-    TEST_FN_FUNC_FN_FN(atan2pi);
-    TEST_FN_FUNC_FN(cbrt);
-    TEST_FN_FUNC_FN(ceil);
-    TEST_FN_FUNC_FN_FN(copysign);
-    TEST_FN_FUNC_FN(cos);
-    TEST_FN_FUNC_FN(cosh);
-    TEST_FN_FUNC_FN(cospi);
-    TEST_FN_FUNC_FN(erfc);
-    TEST_FN_FUNC_FN(erf);
-    TEST_FN_FUNC_FN(exp);
-    TEST_FN_FUNC_FN(exp2);
-    TEST_FN_FUNC_FN(exp10);
-    TEST_FN_FUNC_FN(expm1);
-    TEST_FN_FUNC_FN(fabs);
-    TEST_FN_FUNC_FN_FN(fdim);
-    TEST_FN_FUNC_FN(floor);
-    TEST_FN_FUNC_FN_FN_FN(fma);
-    TEST_FN_FUNC_FN_FN(fmax);
-    TEST_FN_FUNC_FN_F(fmax);
-    TEST_FN_FUNC_FN_FN(fmin);
-    TEST_FN_FUNC_FN_F(fmin);
-    TEST_FN_FUNC_FN_FN(fmod);
-    TEST_FN_FUNC_FN_PFN(fract);
-    TEST_FN_FUNC_FN_PIN(frexp);
-    TEST_FN_FUNC_FN_FN(hypot);
-    TEST_IN_FUNC_FN(ilogb);
-    TEST_FN_FUNC_FN_IN(ldexp);
-    TEST_FN_FUNC_FN_I(ldexp);
-    TEST_FN_FUNC_FN(lgamma);
-    TEST_FN_FUNC_FN_PIN(lgamma);
-    TEST_FN_FUNC_FN(log);
-    TEST_FN_FUNC_FN(log2);
-    TEST_FN_FUNC_FN(log10);
-    TEST_FN_FUNC_FN(log1p);
-    TEST_FN_FUNC_FN(logb);
-    TEST_FN_FUNC_FN_FN_FN(mad);
-    TEST_FN_FUNC_FN_PFN(modf);
-    // nan
-    TEST_FN_FUNC_FN_FN(nextafter);
-    TEST_FN_FUNC_FN_FN(pow);
-    TEST_FN_FUNC_FN_IN(pown);
-    TEST_FN_FUNC_FN_FN(powr);
-    TEST_FN_FUNC_FN_FN(remainder);
-    TEST_FN_FUNC_FN_FN_PIN(remquo);
-    TEST_FN_FUNC_FN(rint);
-    TEST_FN_FUNC_FN_IN(rootn);
-    TEST_FN_FUNC_FN(round);
-    TEST_FN_FUNC_FN(rsqrt);
-    TEST_FN_FUNC_FN(sin);
-    TEST_FN_FUNC_FN_PFN(sincos);
-    TEST_FN_FUNC_FN(sinh);
-    TEST_FN_FUNC_FN(sinpi);
-    TEST_FN_FUNC_FN(sqrt);
-    TEST_FN_FUNC_FN(tan);
-    TEST_FN_FUNC_FN(tanh);
-    TEST_FN_FUNC_FN(tanpi);
-    TEST_FN_FUNC_FN(tgamma);
-    TEST_FN_FUNC_FN(trunc);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_fp_math FAILED", time);
-    }
-    else {
-        rsDebug("test_fp_math PASSED", time);
-    }
-
-    return failed;
-}
-
-#define DECL_INT(prefix)            \
-volatile char prefix##_c_1 = 1;     \
-volatile char2 prefix##_c_2 = 1;    \
-volatile char3 prefix##_c_3 = 1;    \
-volatile char4 prefix##_c_4 = 1;    \
-volatile uchar prefix##_uc_1 = 1;   \
-volatile uchar2 prefix##_uc_2 = 1;  \
-volatile uchar3 prefix##_uc_3 = 1;  \
-volatile uchar4 prefix##_uc_4 = 1;  \
-volatile short prefix##_s_1 = 1;    \
-volatile short2 prefix##_s_2 = 1;   \
-volatile short3 prefix##_s_3 = 1;   \
-volatile short4 prefix##_s_4 = 1;   \
-volatile ushort prefix##_us_1 = 1;  \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1;      \
-volatile int2 prefix##_i_2 = 1;     \
-volatile int3 prefix##_i_3 = 1;     \
-volatile int4 prefix##_i_4 = 1;     \
-volatile uint prefix##_ui_1 = 1;    \
-volatile uint2 prefix##_ui_2 = 1;   \
-volatile uint3 prefix##_ui_3 = 1;   \
-volatile uint4 prefix##_ui_4 = 1;   \
-volatile long prefix##_l_1 = 1;     \
-volatile ulong prefix##_ul_1 = 1;
-
-#define TEST_INT_OP_TYPE(op, type)                      \
-rsDebug("Testing " #op " for " #type "1", i++);         \
-res_##type##_1 = src1_##type##_1 op src2_##type##_1;    \
-rsDebug("Testing " #op " for " #type "2", i++);         \
-res_##type##_2 = src1_##type##_2 op src2_##type##_2;    \
-rsDebug("Testing " #op " for " #type "3", i++);         \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3;    \
-rsDebug("Testing " #op " for " #type "4", i++);         \
-res_##type##_4 = src1_##type##_4 op src2_##type##_4;
-
-#define TEST_INT_OP(op)                     \
-TEST_INT_OP_TYPE(op, c)                     \
-TEST_INT_OP_TYPE(op, uc)                    \
-TEST_INT_OP_TYPE(op, s)                     \
-TEST_INT_OP_TYPE(op, us)                    \
-TEST_INT_OP_TYPE(op, i)                     \
-TEST_INT_OP_TYPE(op, ui)                    \
-rsDebug("Testing " #op " for l1", i++);     \
-res_l_1 = src1_l_1 op src2_l_1;             \
-rsDebug("Testing " #op " for ul1", i++);    \
-res_ul_1 = src1_ul_1 op src2_ul_1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-static bool test_basic_operators() {
-    bool failed = false;
-    int i = 0;
-
-    TEST_INT_OP(+);
-    TEST_INT_OP(-);
-    TEST_INT_OP(*);
-    TEST_INT_OP(/);
-    TEST_INT_OP(%);
-    TEST_INT_OP(<<);
-    TEST_INT_OP(>>);
-
-    if (failed) {
-        rsDebug("test_basic_operators FAILED", 0);
-    }
-    else {
-        rsDebug("test_basic_operators PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define TEST_CVT(to, from, type)                        \
-rsDebug("Testing convert from " #from " to " #to, 0);   \
-to##1 = from##1;                                        \
-to##2 = convert_##type##2(from##2);                     \
-to##3 = convert_##type##3(from##3);                     \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type)   \
-TEST_CVT(to, c, type);              \
-TEST_CVT(to, uc, type);             \
-TEST_CVT(to, s, type);              \
-TEST_CVT(to, us, type);             \
-TEST_CVT(to, i, type);              \
-TEST_CVT(to, ui, type);             \
-TEST_CVT(to, f, type);              \
-
-static bool test_convert() {
-    bool failed = false;
-
-    TEST_CVT_MATRIX(c, char);
-    TEST_CVT_MATRIX(uc, uchar);
-    TEST_CVT_MATRIX(s, short);
-    TEST_CVT_MATRIX(us, ushort);
-    TEST_CVT_MATRIX(i, int);
-    TEST_CVT_MATRIX(ui, uint);
-    TEST_CVT_MATRIX(f, float);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define INIT_PREFIX_TYPE(prefix, type)  \
-prefix##_##type##_1 = 1;                \
-prefix##_##type##_2.x = 1;              \
-prefix##_##type##_2.y = 1;              \
-prefix##_##type##_3.x = 1;              \
-prefix##_##type##_3.y = 1;              \
-prefix##_##type##_3.z = 1;              \
-prefix##_##type##_4.x = 1;              \
-prefix##_##type##_4.y = 1;              \
-prefix##_##type##_4.z = 1;              \
-prefix##_##type##_4.w = 1;
-
-#define INIT_TYPE(type)         \
-INIT_PREFIX_TYPE(src1, type)    \
-INIT_PREFIX_TYPE(src2, type)    \
-INIT_PREFIX_TYPE(res, type)
-
-#define INIT_ALL    \
-INIT_TYPE(c);       \
-INIT_TYPE(uc);      \
-INIT_TYPE(s);       \
-INIT_TYPE(us);      \
-INIT_TYPE(i);       \
-INIT_TYPE(ui);
-
-void math_test(uint32_t index, int test_num) {
-    bool failed = false;
-    INIT_ALL;
-    failed |= test_convert();
-    failed |= test_fp_math(index);
-    failed |= test_basic_operators();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/primitives.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/primitives.rs
deleted file mode 100644
index ce451da..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/primitives.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool test_primitive_types(uint32_t index) {
-    bool failed = false;
-    start();
-
-    _RS_ASSERT(floatTest == 2.99f);
-    _RS_ASSERT(doubleTest == 3.05);
-    _RS_ASSERT(charTest == -16);
-    _RS_ASSERT(shortTest == -32);
-    _RS_ASSERT(intTest == -64);
-    _RS_ASSERT(longTest == 17179869185l);
-    _RS_ASSERT(longlongTest == 68719476735l);
-
-    _RS_ASSERT(ucharTest == 8);
-    _RS_ASSERT(ushortTest == 16);
-    _RS_ASSERT(uintTest == 32);
-    _RS_ASSERT(ulongTest == 4611686018427387903L);
-    _RS_ASSERT(int64_tTest == -17179869184l);
-    _RS_ASSERT(uint64_tTest == 117179869185l);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_primitives FAILED", time);
-    }
-    else {
-        rsDebug("test_primitives PASSED", time);
-    }
-
-    return failed;
-}
-
-void primitives_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_primitive_types(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rsdebug.rs
deleted file mode 100644
index f7942a5..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rsdebug.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    // For this reason, none of the outputs are actually checked.
-
-    rsDebug("floatTest", floatTest);
-    rsDebug("doubleTest", doubleTest);
-    rsDebug("charTest", charTest);
-    rsDebug("shortTest", shortTest);
-    rsDebug("intTest", intTest);
-    rsDebug("longTest", longTest);
-    rsDebug("longlongTest", longlongTest);
-
-    rsDebug("ucharTest", ucharTest);
-    rsDebug("ushortTest", ushortTest);
-    rsDebug("uintTest", uintTest);
-    rsDebug("ulongTest", ulongTest);
-    rsDebug("int64_tTest", int64_tTest);
-    rsDebug("uint64_tTest", uint64_tTest);
-
-    return failed;
-}
-
-void test_rsdebug(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rsdebug_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rsdebug_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rslist.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rslist.rs
deleted file mode 100644
index 5b2501fc..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rslist.rs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2009 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.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_v11)
-
-#include "rs_graphics.rsh"
-
-float gDY;
-
-rs_font gFont;
-
-typedef struct ListAllocs_s {
-    rs_allocation text;
-    int result;
-} ListAllocs;
-
-ListAllocs *gList;
-
-void init() {
-    gDY = 0.0f;
-}
-
-int textPos = 0;
-
-int root(int launchID) {
-
-    rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-    rsgClearDepth(1.0f);
-
-    textPos -= (int)gDY*2;
-    gDY *= 0.95;
-
-    rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
-    rsgBindFont(gFont);
-
-    rs_allocation listAlloc;
-    rsSetObject(&listAlloc, rsGetAllocation(gList));
-    int allocSize = rsAllocationGetDimX(listAlloc);
-
-    int width = rsgGetWidth();
-    int height = rsgGetHeight();
-
-    int itemHeight = 80;
-    int totalItemHeight = itemHeight * allocSize;
-
-    /* Prevent scrolling above the top of the list */
-    int firstItem = height - totalItemHeight;
-    if (firstItem < 0) {
-        firstItem = 0;
-    }
-
-    /* Prevent scrolling past the last line of the list */
-    int lastItem = -1 * (totalItemHeight - height);
-    if (lastItem > 0) {
-        lastItem = 0;
-    }
-
-    if (textPos > firstItem) {
-        textPos = firstItem;
-    }
-    else if (textPos < lastItem) {
-        textPos = lastItem;
-    }
-
-    int currentYPos = itemHeight + textPos;
-
-    for(int i = 0; i < allocSize; i ++) {
-        if(currentYPos - itemHeight > height) {
-            break;
-        }
-
-        if(currentYPos > 0) {
-            switch(gList[i].result) {
-                case 1: /* Passed */
-                    rsgFontColor(0.5f, 0.9f, 0.5f, 1.0f);
-                    break;
-                case -1: /* Failed */
-                    rsgFontColor(0.9f, 0.5f, 0.5f, 1.0f);
-                    break;
-                case 0: /* Still Testing */
-                    rsgFontColor(0.9f, 0.9f, 0.5f, 1.0f);
-                    break;
-                default: /* Unknown */
-                    rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
-                    break;
-            }
-            rsgDrawRect(0, currentYPos - 1, width, currentYPos, 0);
-            rsgDrawText(gList[i].text, 30, currentYPos - 32);
-        }
-        currentYPos += itemHeight;
-    }
-
-    return 10;
-}
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstime.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstime.rs
deleted file mode 100644
index 5e3e078..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstime.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "shared.rsh"
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_time_t curTime = rsTime(0);
-    rs_tm tm;
-    rsDebug("curTime", curTime);
-
-    rsLocaltime(&tm, &curTime);
-
-    rsDebug("tm.tm_sec", tm.tm_sec);
-    rsDebug("tm.tm_min", tm.tm_min);
-    rsDebug("tm.tm_hour", tm.tm_hour);
-    rsDebug("tm.tm_mday", tm.tm_mday);
-    rsDebug("tm.tm_mon", tm.tm_mon);
-    rsDebug("tm.tm_year", tm.tm_year);
-    rsDebug("tm.tm_wday", tm.tm_wday);
-    rsDebug("tm.tm_yday", tm.tm_yday);
-    rsDebug("tm.tm_isdst", tm.tm_isdst);
-
-    // Test a specific time (only valid for PST localtime)
-    curTime = 1294438893;
-    rsLocaltime(&tm, &curTime);
-
-    _RS_ASSERT(tm.tm_sec == 33);
-    _RS_ASSERT(tm.tm_min == 21);
-    _RS_ASSERT(tm.tm_hour == 14);
-    _RS_ASSERT(tm.tm_mday == 7);
-    _RS_ASSERT(tm.tm_mon == 0);
-    _RS_ASSERT(tm.tm_year == 111);
-    _RS_ASSERT(tm.tm_wday == 5);
-    _RS_ASSERT(tm.tm_yday == 6);
-    _RS_ASSERT(tm.tm_isdst == 0);
-
-    return failed;
-}
-
-void test_rstime(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstime_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstime_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstypes.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstypes.rs
deleted file mode 100644
index f3bf244..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/rstypes.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element elementTest;
-rs_type typeTest;
-rs_allocation allocationTest;
-rs_sampler samplerTest;
-rs_script scriptTest;
-rs_mesh meshTest;
-rs_program_fragment program_fragmentTest;
-rs_program_vertex program_vertexTest;
-rs_program_raster program_rasterTest;
-rs_program_store program_storeTest;
-rs_font fontTest;
-
-rs_matrix4x4 matrix4x4Test;
-rs_matrix3x3 matrix3x3Test;
-rs_matrix2x2 matrix2x2Test;
-
-struct my_struct {
-    int i;
-    rs_font fontTestStruct;
-};
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_matrix4x4 matrix4x4TestLocal;
-    rs_matrix3x3 matrix3x3TestLocal;
-    rs_matrix2x2 matrix2x2TestLocal;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    rs_element elementTestLocal;
-    rs_type typeTestLocal;
-    rs_allocation allocationTestLocal;
-    rs_sampler samplerTestLocal;
-    rs_script scriptTestLocal;
-    rs_mesh meshTestLocal;
-    rs_program_fragment program_fragmentTestLocal;
-    rs_program_vertex program_vertexTestLocal;
-    rs_program_raster program_rasterTestLocal;
-    rs_program_store program_storeTestLocal;
-    rs_font fontTestLocal;
-
-    rs_font fontTestLocalArray[4];
-
-    rs_font fontTestLocalPreInit = fontTest;
-
-    struct my_struct structTest;
-
-    rsSetObject(&fontTestLocal, fontTest);
-    //allocationTestLocal = allocationTest;
-
-    rsSetObject(&fontTest, fontTestLocal);
-    //allocationTest = allocationTestLocal;
-
-    /*for (int i = 0; i < 4; i++) {
-        rsSetObject(&fontTestLocalArray[i], fontTestLocal);
-    }*/
-
-    /*rsSetObject(&fontTest, fontTestLocalArray[3]);*/
-
-    return failed;
-}
-
-void test_rstypes(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstypes_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstypes_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/shared.rsh b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/shared.rsh
deleted file mode 100644
index 6d34481..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/shared.rsh
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_v11)
-
-typedef struct TestResult_s {
-    rs_allocation name;
-    bool pass;
-    float score;
-    int64_t time;
-} TestResult;
-//TestResult *g_results;
-
-static int64_t g_time;
-
-static void start(void) {
-    g_time = rsUptimeMillis();
-}
-
-static float end(uint32_t idx) {
-    int64_t t = rsUptimeMillis() - g_time;
-    //g_results[idx].time = t;
-    //rsDebug("test time", (int)t);
-    return ((float)t) / 1000.f;
-}
-
-#define _RS_ASSERT(b) \
-do { \
-    if (!(b)) { \
-        failed = true; \
-        rsDebug(#b " FAILED", 0); \
-    } \
-\
-} while (0)
-
-/* These constants must match those in UnitTest.java */
-static const int RS_MSG_TEST_PASSED = 100;
-static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/test_root.rs b/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/test_root.rs
deleted file mode 100644
index 6dc83ba..0000000
--- a/tests/RenderScriptTests/tests_v11/src/com/android/rs/test/test_root.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Fountain test script
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test)
-
-#pragma stateFragment(parent)
-
-#include "rs_graphics.rsh"
-
-
-typedef struct TestResult {
-    rs_allocation name;
-    bool pass;
-    float score;
-} TestResult_t;
-TestResult_t *results;
-
-int root() {
-
-    return 0;
-}
-
-
diff --git a/tests/RenderScriptTests/tests_v14/Android.mk b/tests/RenderScriptTests/tests_v14/Android.mk
deleted file mode 100644
index a4386a44..0000000
--- a/tests/RenderScriptTests/tests_v14/Android.mk
+++ /dev/null
@@ -1,27 +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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
-
-LOCAL_PACKAGE_NAME := RSTest_v14
-LOCAL_SDK_VERSION := 14
-
-include $(BUILD_PACKAGE)
diff --git a/tests/RenderScriptTests/tests_v14/AndroidManifest.xml b/tests/RenderScriptTests/tests_v14/AndroidManifest.xml
deleted file mode 100644
index 1cd9bbd..0000000
--- a/tests/RenderScriptTests/tests_v14/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.rs.test_v14">
-    <uses-sdk android:minSdkVersion="14" />
-    <application 
-        android:label="_RS_Test_v14"
-        android:icon="@drawable/test_pattern">
-        <activity android:name="RSTest_v14"
-                  android:screenOrientation="portrait">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/RenderScriptTests/tests_v14/res/drawable-nodpi/test_pattern.png b/tests/RenderScriptTests/tests_v14/res/drawable-nodpi/test_pattern.png
deleted file mode 100644
index e7d1455..0000000
--- a/tests/RenderScriptTests/tests_v14/res/drawable-nodpi/test_pattern.png
+++ /dev/null
Binary files differ
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestCore.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestCore.java
deleted file mode 100644
index f1e81a4..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestCore.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2008-2011 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-import java.util.ArrayList;
-import java.util.ListIterator;
-import java.util.Timer;
-import java.util.TimerTask;
-
-
-public class RSTestCore {
-    int mWidth;
-    int mHeight;
-    Context mCtx;
-
-    public RSTestCore(Context ctx) {
-        mCtx = ctx;
-    }
-
-    private Resources mRes;
-    private RenderScriptGL mRS;
-
-    private Font mFont;
-    ScriptField_ListAllocs_s mListAllocs;
-    int mLastX;
-    int mLastY;
-    private ScriptC_rslist mScript;
-
-    private ArrayList<UnitTest> unitTests;
-    private ListIterator<UnitTest> test_iter;
-    private UnitTest activeTest;
-    private boolean stopTesting;
-
-    /* Periodic timer for ensuring future tests get scheduled */
-    private Timer mTimer;
-    public static final int RS_TIMER_PERIOD = 100;
-
-    public void init(RenderScriptGL rs, Resources res, int width, int height) {
-        mRS = rs;
-        mRes = res;
-        mWidth = width;
-        mHeight = height;
-        stopTesting = false;
-
-        mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);
-
-        unitTests = new ArrayList<UnitTest>();
-
-        unitTests.add(new UT_primitives(this, mRes, mCtx));
-        unitTests.add(new UT_vector(this, mRes, mCtx));
-        unitTests.add(new UT_rsdebug(this, mRes, mCtx));
-        unitTests.add(new UT_rstime(this, mRes, mCtx));
-        unitTests.add(new UT_rstypes(this, mRes, mCtx));
-        unitTests.add(new UT_alloc(this, mRes, mCtx));
-        unitTests.add(new UT_refcount(this, mRes, mCtx));
-        unitTests.add(new UT_foreach(this, mRes, mCtx));
-        unitTests.add(new UT_math(this, mRes, mCtx));
-        unitTests.add(new UT_fp_mad(this, mRes, mCtx));
-        /*
-        unitTests.add(new UnitTest(null, "<Pass>", 1));
-        unitTests.add(new UnitTest());
-        unitTests.add(new UnitTest(null, "<Fail>", -1));
-
-        for (int i = 0; i < 20; i++) {
-            unitTests.add(new UnitTest(null, "<Pass>", 1));
-        }
-        */
-
-        UnitTest [] uta = new UnitTest[unitTests.size()];
-        uta = unitTests.toArray(uta);
-
-        mListAllocs = new ScriptField_ListAllocs_s(mRS, uta.length);
-        for (int i = 0; i < uta.length; i++) {
-            ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
-            listElem.text = Allocation.createFromString(mRS, uta[i].name, Allocation.USAGE_SCRIPT);
-            listElem.result = uta[i].result;
-            mListAllocs.set(listElem, i, false);
-            uta[i].setItem(listElem);
-        }
-
-        mListAllocs.copyAll();
-
-        mScript.bind_gList(mListAllocs);
-
-        mFont = Font.create(mRS, mRes, "serif", Font.Style.BOLD, 8);
-        mScript.set_gFont(mFont);
-
-        mRS.bindRootScript(mScript);
-
-        test_iter = unitTests.listIterator();
-        refreshTestResults(); /* Kick off the first test */
-
-        TimerTask pTask = new TimerTask() {
-            public void run() {
-                refreshTestResults();
-            }
-        };
-
-        mTimer = new Timer();
-        mTimer.schedule(pTask, RS_TIMER_PERIOD, RS_TIMER_PERIOD);
-    }
-
-    public void checkAndRunNextTest() {
-        if (activeTest != null) {
-            if (!activeTest.isAlive()) {
-                /* Properly clean up on our last test */
-                try {
-                    activeTest.join();
-                }
-                catch (InterruptedException e) {
-                }
-                activeTest = null;
-            }
-        }
-
-        if (!stopTesting && activeTest == null) {
-            if (test_iter.hasNext()) {
-                activeTest = test_iter.next();
-                activeTest.start();
-                /* This routine will only get called once when a new test
-                 * should start running. The message handler in UnitTest.java
-                 * ensures this. */
-            }
-            else {
-                if (mTimer != null) {
-                    mTimer.cancel();
-                    mTimer.purge();
-                    mTimer = null;
-                }
-            }
-        }
-    }
-
-    public void refreshTestResults() {
-        checkAndRunNextTest();
-
-        if (mListAllocs != null && mScript != null && mRS != null) {
-            mListAllocs.copyAll();
-
-            mScript.bind_gList(mListAllocs);
-            mRS.bindRootScript(mScript);
-        }
-    }
-
-    public void cleanup() {
-        stopTesting = true;
-        UnitTest t = activeTest;
-
-        /* Stop periodic refresh of testing */
-        if (mTimer != null) {
-            mTimer.cancel();
-            mTimer.purge();
-            mTimer = null;
-        }
-
-        /* Wait to exit until we finish the current test */
-        if (t != null) {
-            try {
-                t.join();
-            }
-            catch (InterruptedException e) {
-            }
-            t = null;
-        }
-
-    }
-
-    public void newTouchPosition(float x, float y, float pressure, int id) {
-    }
-
-    public void onActionDown(int x, int y) {
-        mScript.set_gDY(0.0f);
-        mLastX = x;
-        mLastY = y;
-        refreshTestResults();
-    }
-
-    public void onActionMove(int x, int y) {
-        int dx = mLastX - x;
-        int dy = mLastY - y;
-
-        if (Math.abs(dy) <= 2) {
-            dy = 0;
-        }
-
-        mScript.set_gDY(dy);
-
-        mLastX = x;
-        mLastY = y;
-        refreshTestResults();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestView.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestView.java
deleted file mode 100644
index 40192e4..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTestView.java
+++ /dev/null
@@ -1,97 +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.rs.test_v14;
-
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.concurrent.Semaphore;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-import android.renderscript.RenderScriptGL;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-
-public class RSTestView extends RSSurfaceView {
-
-    private Context mCtx;
-
-    public RSTestView(Context context) {
-        super(context);
-        mCtx = context;
-        //setFocusable(true);
-    }
-
-    private RenderScriptGL mRS;
-    private RSTestCore mRender;
-
-    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
-        super.surfaceChanged(holder, format, w, h);
-        if (mRS == null) {
-            RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
-            mRS = createRenderScriptGL(sc);
-            mRS.setSurface(holder, w, h);
-            mRender = new RSTestCore(mCtx);
-            mRender.init(mRS, getResources(), w, h);
-        }
-    }
-
-    @Override
-    protected void onDetachedFromWindow() {
-        if(mRS != null) {
-            mRender.cleanup();
-            mRS = null;
-            destroyRenderScriptGL();
-        }
-    }
-
-    @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event)
-    {
-        return super.onKeyDown(keyCode, event);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev)
-    {
-        boolean ret = false;
-        int act = ev.getAction();
-        if (act == ev.ACTION_DOWN) {
-            mRender.onActionDown((int)ev.getX(), (int)ev.getY());
-            ret = true;
-        }
-        else if (act == ev.ACTION_MOVE) {
-            mRender.onActionMove((int)ev.getX(), (int)ev.getY());
-            ret = true;
-        }
-
-        return ret;
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTest_v14.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTest_v14.java
deleted file mode 100644
index da09691..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/RSTest_v14.java
+++ /dev/null
@@ -1,91 +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.rs.test_v14;
-
-import android.renderscript.RSSurfaceView;
-import android.renderscript.RenderScript;
-
-import android.app.Activity;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.provider.Settings.System;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.widget.Button;
-import android.widget.ListView;
-
-import java.lang.Runtime;
-
-public class RSTest_v14 extends Activity {
-    //EventListener mListener = new EventListener();
-
-    private static final String LOG_TAG = "RSTest_v14";
-    private static final boolean DEBUG  = false;
-    private static final boolean LOG_ENABLED = false;
-
-    private RSTestView mView;
-
-    // get the current looper (from your Activity UI thread for instance
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        // Create our Preview view and set it as the content of our
-        // Activity
-        mView = new RSTestView(this);
-        setContentView(mView);
-    }
-
-    @Override
-    protected void onResume() {
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity loses focus
-        super.onResume();
-        mView.resume();
-    }
-
-    @Override
-    protected void onPause() {
-        // Ideally a game should implement onResume() and onPause()
-        // to take appropriate action when the activity loses focus
-        super.onPause();
-        mView.pause();
-    }
-
-    @Override
-    protected void onStop() {
-        // Actually kill the app if we are stopping. We don't want to
-        // continue/resume this test ever. It should always start fresh.
-        finish();
-        super.onStop();
-    }
-
-    static void log(String message) {
-        if (LOG_ENABLED) {
-            Log.v(LOG_TAG, message);
-        }
-    }
-
-
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java
deleted file mode 100644
index 079fcce..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_alloc extends UnitTest {
-    private Resources mRes;
-
-    protected UT_alloc(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Alloc", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_alloc s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        int Z = 0;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        s.set_dimZ(Z);
-        typeBuilder.setX(X).setY(Y);
-        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
-        s.bind_a(A);
-        s.set_aRaw(A);
-
-        typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        typeBuilder.setX(X).setY(Y).setFaces(true);
-        Allocation AFaces = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aFaces(AFaces);
-        typeBuilder.setFaces(false).setMipmaps(true);
-        Allocation ALOD = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aLOD(ALOD);
-        typeBuilder.setFaces(true).setMipmaps(true);
-        Allocation AFacesLOD = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aFacesLOD(AFacesLOD);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_alloc s = new ScriptC_alloc(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_root(s.get_aRaw());
-        s.invoke_alloc_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java
deleted file mode 100644
index 31f4114..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_foreach extends UnitTest {
-    private Resources mRes;
-    private Allocation A;
-
-    protected UT_foreach(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "ForEach", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_foreach s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 5;
-        int Y = 7;
-        s.set_dimX(X);
-        s.set_dimY(Y);
-        typeBuilder.setX(X).setY(Y);
-        A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_aRaw(A);
-
-        return;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_foreach s = new ScriptC_foreach(pRS);
-        pRS.setMessageHandler(mRsMessage);
-        initializeGlobals(pRS, s);
-        s.forEach_root(A);
-        s.invoke_verify_root();
-        s.invoke_foreach_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_fp_mad.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_fp_mad.java
deleted file mode 100644
index 239496a..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_fp_mad.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_fp_mad extends UnitTest {
-    private Resources mRes;
-
-    protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Fp_Mad", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_fp_mad s = new ScriptC_fp_mad(pRS, mRes, R.raw.fp_mad);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_fp_mad_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_math.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_math.java
deleted file mode 100644
index 7b135c4..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_math.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_math extends UnitTest {
-    private Resources mRes;
-
-    protected UT_math(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Math", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_math s = new ScriptC_math(pRS, mRes, R.raw.math);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_math_test(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_primitives.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_primitives.java
deleted file mode 100644
index d3c56f3..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_primitives.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_primitives extends UnitTest {
-    private Resources mRes;
-
-    protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Primitives", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_primitives s) {
-        float pF = s.get_floatTest();
-        if (pF != 1.99f) {
-            return false;
-        }
-        s.set_floatTest(2.99f);
-
-        double pD = s.get_doubleTest();
-        if (pD != 2.05) {
-            return false;
-        }
-        s.set_doubleTest(3.05);
-
-        byte pC = s.get_charTest();
-        if (pC != -8) {
-            return false;
-        }
-        s.set_charTest((byte)-16);
-
-        short pS = s.get_shortTest();
-        if (pS != -16) {
-            return false;
-        }
-        s.set_shortTest((short)-32);
-
-        int pI = s.get_intTest();
-        if (pI != -32) {
-            return false;
-        }
-        s.set_intTest(-64);
-
-        long pL = s.get_longTest();
-        if (pL != 17179869184l) {
-            return false;
-        }
-        s.set_longTest(17179869185l);
-
-        long puL = s.get_ulongTest();
-        if (puL != 4611686018427387904L) {
-            return false;
-        }
-        s.set_ulongTest(4611686018427387903L);
-
-
-        long pLL = s.get_longlongTest();
-        if (pLL != 68719476736L) {
-            return false;
-        }
-        s.set_longlongTest(68719476735L);
-
-        long pu64 = s.get_uint64_tTest();
-        if (pu64 != 117179869184l) {
-            return false;
-        }
-        s.set_uint64_tTest(117179869185l);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            // initializeGlobals failed
-            result = -1;
-        } else {
-            s.invoke_primitives_test(0, 0);
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_refcount.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_refcount.java
deleted file mode 100644
index 05a516b..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_refcount.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_refcount extends UnitTest {
-    private Resources mRes;
-
-    protected UT_refcount(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Refcount", ctx);
-        mRes = res;
-    }
-
-    private void initializeGlobals(RenderScript RS, ScriptC_refcount s) {
-        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
-        int X = 500;
-        int Y = 700;
-        typeBuilder.setX(X).setY(Y);
-        Allocation A = Allocation.createTyped(RS, typeBuilder.create());
-        s.set_globalA(A);
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        pRS.setMessageHandler(mRsMessage);
-        ScriptC_refcount s = new ScriptC_refcount(pRS, mRes, R.raw.refcount);
-        initializeGlobals(pRS, s);
-        s.invoke_refcount_test();
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rsdebug.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rsdebug.java
deleted file mode 100644
index 95e92ee..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rsdebug.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rsdebug extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsDebug", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rsdebug s = new ScriptC_rsdebug(pRS, mRes, R.raw.rsdebug);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rsdebug(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstime.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstime.java
deleted file mode 100644
index a72ede9..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstime.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstime extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstime(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTime", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstime s = new ScriptC_rstime(pRS, mRes, R.raw.rstime);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rstime(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstypes.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstypes.java
deleted file mode 100644
index ab96867..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_rstypes.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_rstypes extends UnitTest {
-    private Resources mRes;
-
-    protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "rsTypes", ctx);
-        mRes = res;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_rstypes s = new ScriptC_rstypes(pRS, mRes, R.raw.rstypes);
-        pRS.setMessageHandler(mRsMessage);
-        s.invoke_test_rstypes(0, 0);
-        pRS.finish();
-        waitForMessage();
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_vector.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_vector.java
deleted file mode 100644
index 657413e..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_vector.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Copyright (C) 2011 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.rs.test_v14;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.renderscript.*;
-
-public class UT_vector extends UnitTest {
-    private Resources mRes;
-
-    protected UT_vector(RSTestCore rstc, Resources res, Context ctx) {
-        super(rstc, "Vector", ctx);
-        mRes = res;
-    }
-
-    private boolean initializeGlobals(ScriptC_vector s) {
-        Float2 F2 = s.get_f2();
-        if (F2.x != 1.0f || F2.y != 2.0f) {
-            return false;
-        }
-        F2.x = 2.99f;
-        F2.y = 3.99f;
-        s.set_f2(F2);
-
-        Float3 F3 = s.get_f3();
-        if (F3.x != 1.0f || F3.y != 2.0f || F3.z != 3.0f) {
-            return false;
-        }
-        F3.x = 2.99f;
-        F3.y = 3.99f;
-        F3.z = 4.99f;
-        s.set_f3(F3);
-
-        Float4 F4 = s.get_f4();
-        if (F4.x != 1.0f || F4.y != 2.0f || F4.z != 3.0f || F4.w != 4.0f) {
-            return false;
-        }
-        F4.x = 2.99f;
-        F4.y = 3.99f;
-        F4.z = 4.99f;
-        F4.w = 5.99f;
-        s.set_f4(F4);
-
-        Double2 D2 = s.get_d2();
-        if (D2.x != 1.0 || D2.y != 2.0) {
-            return false;
-        }
-        D2.x = 2.99;
-        D2.y = 3.99;
-        s.set_d2(D2);
-
-        Double3 D3 = s.get_d3();
-        if (D3.x != 1.0 || D3.y != 2.0 || D3.z != 3.0) {
-            return false;
-        }
-        D3.x = 2.99;
-        D3.y = 3.99;
-        D3.z = 4.99;
-        s.set_d3(D3);
-
-        Double4 D4 = s.get_d4();
-        if (D4.x != 1.0 || D4.y != 2.0 || D4.z != 3.0 || D4.w != 4.0) {
-            return false;
-        }
-        D4.x = 2.99;
-        D4.y = 3.99;
-        D4.z = 4.99;
-        D4.w = 5.99;
-        s.set_d4(D4);
-
-        Byte2 B2 = s.get_i8_2();
-        if (B2.x != 1 || B2.y != 2) {
-            return false;
-        }
-        B2.x = 2;
-        B2.y = 3;
-        s.set_i8_2(B2);
-
-        Byte3 B3 = s.get_i8_3();
-        if (B3.x != 1 || B3.y != 2 || B3.z != 3) {
-            return false;
-        }
-        B3.x = 2;
-        B3.y = 3;
-        B3.z = 4;
-        s.set_i8_3(B3);
-
-        Byte4 B4 = s.get_i8_4();
-        if (B4.x != 1 || B4.y != 2 || B4.z != 3 || B4.w != 4) {
-            return false;
-        }
-        B4.x = 2;
-        B4.y = 3;
-        B4.z = 4;
-        B4.w = 5;
-        s.set_i8_4(B4);
-
-        Short2 S2 = s.get_u8_2();
-        if (S2.x != 1 || S2.y != 2) {
-            return false;
-        }
-        S2.x = 2;
-        S2.y = 3;
-        s.set_u8_2(S2);
-
-        Short3 S3 = s.get_u8_3();
-        if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
-            return false;
-        }
-        S3.x = 2;
-        S3.y = 3;
-        S3.z = 4;
-        s.set_u8_3(S3);
-
-        Short4 S4 = s.get_u8_4();
-        if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
-            return false;
-        }
-        S4.x = 2;
-        S4.y = 3;
-        S4.z = 4;
-        S4.w = 5;
-        s.set_u8_4(S4);
-
-        S2 = s.get_i16_2();
-        if (S2.x != 1 || S2.y != 2) {
-            return false;
-        }
-        S2.x = 2;
-        S2.y = 3;
-        s.set_i16_2(S2);
-
-        S3 = s.get_i16_3();
-        if (S3.x != 1 || S3.y != 2 || S3.z != 3) {
-            return false;
-        }
-        S3.x = 2;
-        S3.y = 3;
-        S3.z = 4;
-        s.set_i16_3(S3);
-
-        S4 = s.get_i16_4();
-        if (S4.x != 1 || S4.y != 2 || S4.z != 3 || S4.w != 4) {
-            return false;
-        }
-        S4.x = 2;
-        S4.y = 3;
-        S4.z = 4;
-        S4.w = 5;
-        s.set_i16_4(S4);
-
-        Int2 I2 = s.get_u16_2();
-        if (I2.x != 1 || I2.y != 2) {
-            return false;
-        }
-        I2.x = 2;
-        I2.y = 3;
-        s.set_u16_2(I2);
-
-        Int3 I3 = s.get_u16_3();
-        if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
-            return false;
-        }
-        I3.x = 2;
-        I3.y = 3;
-        I3.z = 4;
-        s.set_u16_3(I3);
-
-        Int4 I4 = s.get_u16_4();
-        if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
-            return false;
-        }
-        I4.x = 2;
-        I4.y = 3;
-        I4.z = 4;
-        I4.w = 5;
-        s.set_u16_4(I4);
-
-        I2 = s.get_i32_2();
-        if (I2.x != 1 || I2.y != 2) {
-            return false;
-        }
-        I2.x = 2;
-        I2.y = 3;
-        s.set_i32_2(I2);
-
-        I3 = s.get_i32_3();
-        if (I3.x != 1 || I3.y != 2 || I3.z != 3) {
-            return false;
-        }
-        I3.x = 2;
-        I3.y = 3;
-        I3.z = 4;
-        s.set_i32_3(I3);
-
-        I4 = s.get_i32_4();
-        if (I4.x != 1 || I4.y != 2 || I4.z != 3 || I4.w != 4) {
-            return false;
-        }
-        I4.x = 2;
-        I4.y = 3;
-        I4.z = 4;
-        I4.w = 5;
-        s.set_i32_4(I4);
-
-        Long2 L2 = s.get_u32_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_u32_2(L2);
-
-        Long3 L3 = s.get_u32_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_u32_3(L3);
-
-        Long4 L4 = s.get_u32_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_u32_4(L4);
-
-        L2 = s.get_i64_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_i64_2(L2);
-
-        L3 = s.get_i64_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_i64_3(L3);
-
-        L4 = s.get_i64_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_i64_4(L4);
-
-        L2 = s.get_u64_2();
-        if (L2.x != 1 || L2.y != 2) {
-            return false;
-        }
-        L2.x = 2;
-        L2.y = 3;
-        s.set_u64_2(L2);
-
-        L3 = s.get_u64_3();
-        if (L3.x != 1 || L3.y != 2 || L3.z != 3) {
-            return false;
-        }
-        L3.x = 2;
-        L3.y = 3;
-        L3.z = 4;
-        s.set_u64_3(L3);
-
-        L4 = s.get_u64_4();
-        if (L4.x != 1 || L4.y != 2 || L4.z != 3 || L4.w != 4) {
-            return false;
-        }
-        L4.x = 2;
-        L4.y = 3;
-        L4.z = 4;
-        L4.w = 5;
-        s.set_u64_4(L4);
-
-        return true;
-    }
-
-    public void run() {
-        RenderScript pRS = RenderScript.create(mCtx);
-        ScriptC_vector s = new ScriptC_vector(pRS, mRes, R.raw.vector);
-        pRS.setMessageHandler(mRsMessage);
-        if (!initializeGlobals(s)) {
-            result = -1;
-        } else {
-            s.invoke_vector_test();
-            pRS.finish();
-            waitForMessage();
-        }
-        pRS.destroy();
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UnitTest.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UnitTest.java
deleted file mode 100644
index 558a252..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UnitTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2010 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.rs.test_v14;
-import android.content.Context;
-import android.util.Log;
-import android.renderscript.RenderScript.RSMessageHandler;
-
-public class UnitTest extends Thread {
-    public String name;
-    public int result;
-    private ScriptField_ListAllocs_s.Item mItem;
-    private RSTestCore mRSTC;
-    private boolean msgHandled;
-    protected Context mCtx;
-
-    /* These constants must match those in shared.rsh */
-    public static final int RS_MSG_TEST_PASSED = 100;
-    public static final int RS_MSG_TEST_FAILED = 101;
-
-    private static int numTests = 0;
-    public int testID;
-
-    protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
-        super();
-        mRSTC = rstc;
-        name = n;
-        msgHandled = false;
-        mCtx = ctx;
-        result = initResult;
-        testID = numTests++;
-    }
-
-    protected UnitTest(RSTestCore rstc, String n, Context ctx) {
-        this(rstc, n, 0, ctx);
-    }
-
-    protected UnitTest(RSTestCore rstc, Context ctx) {
-        this (rstc, "<Unknown>", ctx);
-    }
-
-    protected UnitTest(Context ctx) {
-        this (null, ctx);
-    }
-
-    protected void _RS_ASSERT(String message, boolean b) {
-        if(b == false) {
-            result = -1;
-            Log.e(name, message + " FAILED");
-        }
-    }
-
-    protected void updateUI() {
-        if (mItem != null) {
-            mItem.result = result;
-            msgHandled = true;
-            try {
-                mRSTC.refreshTestResults();
-            }
-            catch (IllegalStateException e) {
-                /* Ignore the case where our message receiver has been
-                   disconnected. This happens when we leave the application
-                   before it finishes running all of the unit tests. */
-            }
-        }
-    }
-
-    protected RSMessageHandler mRsMessage = new RSMessageHandler() {
-        public void run() {
-            if (result == 0) {
-                switch (mID) {
-                    case RS_MSG_TEST_PASSED:
-                        result = 1;
-                        break;
-                    case RS_MSG_TEST_FAILED:
-                        result = -1;
-                        break;
-                    default:
-                        RSTest_v14.log("Unit test got unexpected message");
-                        return;
-                }
-            }
-
-            updateUI();
-        }
-    };
-
-    public void waitForMessage() {
-        while (!msgHandled) {
-            yield();
-        }
-    }
-
-    public void setItem(ScriptField_ListAllocs_s.Item item) {
-        mItem = item;
-    }
-
-    public void run() {
-        /* This method needs to be implemented for each subclass */
-        if (mRSTC != null) {
-            mRSTC.refreshTestResults();
-        }
-    }
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs
deleted file mode 100644
index 1b5e2ac..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "shared.rsh"
-
-int *a;
-int dimX;
-int dimY;
-int dimZ;
-
-rs_allocation aRaw;
-rs_allocation aFaces;
-rs_allocation aLOD;
-rs_allocation aFacesLOD;
-
-void root(int *o, uint32_t x, uint32_t y) {
-    *o = x + y * dimX;
-}
-
-static bool test_alloc_dims() {
-    bool failed = false;
-    int i, j;
-
-    _RS_ASSERT(rsAllocationGetDimX(aRaw) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aRaw) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aRaw) == dimZ);
-
-    // Test 2D addressing
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            rsDebug("Verifying ", i + j * dimX);
-            const void *p = rsGetElementAt(aRaw, i, j);
-            int val = *(const int *)p;
-            _RS_ASSERT(val == (i + j * dimX));
-        }
-    }
-
-    // Test 1D addressing
-    for (i = 0; i < dimX; i++) {
-        rsDebug("Verifying ", i);
-        const void *p = rsGetElementAt(aRaw, i);
-        int val = *(const int *)p;
-        _RS_ASSERT(val == i);
-    }
-
-    // Test 3D addressing
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            rsDebug("Verifying ", i + j * dimX);
-            const void *p = rsGetElementAt(aRaw, i, j, 0);
-            int val = *(const int *)p;
-            _RS_ASSERT(val == (i + j * dimX));
-        }
-    }
-
-    _RS_ASSERT(rsAllocationGetDimX(aFaces) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aFaces) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aFaces) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aFaces) != 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aFaces) == 0);
-
-    _RS_ASSERT(rsAllocationGetDimX(aLOD) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aLOD) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aLOD) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aLOD) == 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aLOD) != 0);
-
-    _RS_ASSERT(rsAllocationGetDimX(aFacesLOD) == dimX);
-    _RS_ASSERT(rsAllocationGetDimY(aFacesLOD) == dimY);
-    _RS_ASSERT(rsAllocationGetDimZ(aFacesLOD) == dimZ);
-    _RS_ASSERT(rsAllocationGetDimFaces(aFacesLOD) != 0);
-    _RS_ASSERT(rsAllocationGetDimLOD(aFacesLOD) != 0);
-
-    if (failed) {
-        rsDebug("test_alloc_dims FAILED", 0);
-    }
-    else {
-        rsDebug("test_alloc_dims PASSED", 0);
-    }
-
-    return failed;
-}
-
-void alloc_test() {
-    bool failed = false;
-    failed |= test_alloc_dims();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs
deleted file mode 100644
index 3fa8f85..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "shared.rsh"
-
-rs_allocation aRaw;
-int dimX;
-int dimY;
-static bool failed = false;
-
-void root(int *out, uint32_t x, uint32_t y) {
-    *out = x + y * dimX;
-}
-
-static bool test_root_output() {
-    bool failed = false;
-    int i, j;
-
-    for (j = 0; j < dimY; j++) {
-        for (i = 0; i < dimX; i++) {
-            int v = rsGetElementAt_int(aRaw, i, j);
-            _RS_ASSERT(v == (i + j * dimX));
-        }
-    }
-
-    if (failed) {
-        rsDebug("test_root_output FAILED", 0);
-    }
-    else {
-        rsDebug("test_root_output PASSED", 0);
-    }
-
-    return failed;
-}
-
-void verify_root() {
-    failed |= test_root_output();
-}
-
-void foreach_test() {
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/fp_mad.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/fp_mad.rs
deleted file mode 100644
index b6f2b2a6..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/fp_mad.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "shared.rsh"
-
-const int TEST_COUNT = 1;
-
-static float data_f1[1025];
-static float4 data_f4[1025];
-
-static void test_mad4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = (data_f4[i] * 0.02f +
-                          data_f4[i+1] * 0.04f +
-                          data_f4[i+2] * 0.05f +
-                          data_f4[i+3] * 0.1f +
-                          data_f4[i+4] * 0.2f +
-                          data_f4[i+5] * 0.2f +
-                          data_f4[i+6] * 0.1f +
-                          data_f4[i+7] * 0.05f +
-                          data_f4[i+8] * 0.04f +
-                          data_f4[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad4 M ops", 1000.f / time);
-}
-
-static void test_mad(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~1 billion ops
-    for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = (data_f1[i] * 0.02f +
-                          data_f1[i+1] * 0.04f +
-                          data_f1[i+2] * 0.05f +
-                          data_f1[i+3] * 0.1f +
-                          data_f1[i+4] * 0.2f +
-                          data_f1[i+5] * 0.2f +
-                          data_f1[i+6] * 0.1f +
-                          data_f1[i+7] * 0.05f +
-                          data_f1[i+8] * 0.04f +
-                          data_f1[i+9] * 0.02f + 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_mad M ops", 1000.f / time);
-}
-
-static void test_norm(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = normalize(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_norm M ops", 10.f / time);
-}
-
-static void test_sincos4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10 / 4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = sin(data_f4[i]) * cos(data_f4[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos4 M ops", 10.f / time);
-}
-
-static void test_sincos(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~10 M ops
-    for (int ct=0; ct < 1000 * 10; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = sin(data_f1[i]) * cos(data_f1[i]);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_sincos M ops", 10.f / time);
-}
-
-static void test_clamp(uint32_t index) {
-    start();
-
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f1[i] = clamp(data_f1[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp M ops", 100.f / time);
-
-    start();
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100; ct++) {
-        for (int i=0; i < (1000); i++) {
-            if (data_f1[i] < -1.f) data_f1[i] = -1.f;
-            if (data_f1[i] > -1.f) data_f1[i] = 1.f;
-        }
-    }
-
-    time = end(index);
-    rsDebug("fp_clamp ref M ops", 100.f / time);
-}
-
-static void test_clamp4(uint32_t index) {
-    start();
-
-    float total = 0;
-    // Do ~100 M ops
-    for (int ct=0; ct < 1000 * 100 /4; ct++) {
-        for (int i=0; i < (1000); i++) {
-            data_f4[i] = clamp(data_f4[i], -1.f, 1.f);
-        }
-    }
-
-    float time = end(index);
-    rsDebug("fp_clamp4 M ops", 100.f / time);
-}
-
-void fp_mad_test(uint32_t index, int test_num) {
-    int x;
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f;
-        data_f4[x].x = (x & 0xf) * 0.1f;
-        data_f4[x].y = (x & 0xf0) * 0.1f;
-        data_f4[x].z = (x & 0x33) * 0.1f;
-        data_f4[x].w = (x & 0x77) * 0.1f;
-    }
-
-    test_mad4(index);
-    test_mad(index);
-
-    for (x=0; x < 1025; x++) {
-        data_f1[x] = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].x = (x & 0xf) * 0.1f + 1.f;
-        data_f4[x].y = (x & 0xf0) * 0.1f + 1.f;
-        data_f4[x].z = (x & 0x33) * 0.1f + 1.f;
-        data_f4[x].w = (x & 0x77) * 0.1f + 1.f;
-    }
-
-    test_norm(index);
-    test_sincos4(index);
-    test_sincos(index);
-    test_clamp4(index);
-    test_clamp(index);
-
-    // TODO Actually verify test result accuracy
-    rsDebug("fp_mad_test PASSED", 0);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs
deleted file mode 100644
index e6b37f6..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs
+++ /dev/null
@@ -1,462 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define DECL_INT(prefix)            \
-volatile char prefix##_c_1 = 1;     \
-volatile char2 prefix##_c_2 = 1;    \
-volatile char3 prefix##_c_3 = 1;    \
-volatile char4 prefix##_c_4 = 1;    \
-volatile uchar prefix##_uc_1 = 1;   \
-volatile uchar2 prefix##_uc_2 = 1;  \
-volatile uchar3 prefix##_uc_3 = 1;  \
-volatile uchar4 prefix##_uc_4 = 1;  \
-volatile short prefix##_s_1 = 1;    \
-volatile short2 prefix##_s_2 = 1;   \
-volatile short3 prefix##_s_3 = 1;   \
-volatile short4 prefix##_s_4 = 1;   \
-volatile ushort prefix##_us_1 = 1;  \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1;      \
-volatile int2 prefix##_i_2 = 1;     \
-volatile int3 prefix##_i_3 = 1;     \
-volatile int4 prefix##_i_4 = 1;     \
-volatile uint prefix##_ui_1 = 1;    \
-volatile uint2 prefix##_ui_2 = 1;   \
-volatile uint3 prefix##_ui_3 = 1;   \
-volatile uint4 prefix##_ui_4 = 1;   \
-volatile long prefix##_l_1 = 1;     \
-volatile ulong prefix##_ul_1 = 1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-#define TEST_INT_OP_TYPE(op, type)                      \
-rsDebug("Testing " #op " for " #type "1", i++);         \
-res_##type##_1 = src1_##type##_1 op src2_##type##_1;    \
-rsDebug("Testing " #op " for " #type "2", i++);         \
-res_##type##_2 = src1_##type##_2 op src2_##type##_2;    \
-rsDebug("Testing " #op " for " #type "3", i++);         \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3;    \
-rsDebug("Testing " #op " for " #type "4", i++);         \
-res_##type##_4 = src1_##type##_4 op src2_##type##_4;
-
-#define TEST_INT_OP(op)                     \
-TEST_INT_OP_TYPE(op, c)                     \
-TEST_INT_OP_TYPE(op, uc)                    \
-TEST_INT_OP_TYPE(op, s)                     \
-TEST_INT_OP_TYPE(op, us)                    \
-TEST_INT_OP_TYPE(op, i)                     \
-TEST_INT_OP_TYPE(op, ui)                    \
-rsDebug("Testing " #op " for l1", i++);     \
-res_l_1 = src1_l_1 op src2_l_1;             \
-rsDebug("Testing " #op " for ul1", i++);    \
-res_ul_1 = src1_ul_1 op src2_ul_1;
-
-#define TEST_XN_FUNC_YN(typeout, fnc, typein)   \
-    res_##typeout##_1 = fnc(src1_##typein##_1); \
-    res_##typeout##_2 = fnc(src1_##typein##_2); \
-    res_##typeout##_3 = fnc(src1_##typein##_3); \
-    res_##typeout##_4 = fnc(src1_##typein##_4);
-
-#define TEST_XN_FUNC_XN_XN(type, fnc)                       \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
-    res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
-    res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
-    res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
-
-#define TEST_X_FUNC_X_X_X(type, fnc)    \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
-
-#define TEST_IN_FUNC_IN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, uc)    \
-    TEST_XN_FUNC_YN(c, fnc, c)      \
-    TEST_XN_FUNC_YN(us, fnc, us)    \
-    TEST_XN_FUNC_YN(s, fnc, s)      \
-    TEST_XN_FUNC_YN(ui, fnc, ui)    \
-    TEST_XN_FUNC_YN(i, fnc, i)
-
-#define TEST_UIN_FUNC_IN(fnc)       \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, c)     \
-    TEST_XN_FUNC_YN(us, fnc, s)     \
-    TEST_XN_FUNC_YN(ui, fnc, i)     \
-
-#define TEST_IN_FUNC_IN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_XN_XN(uc, fnc)     \
-    TEST_XN_FUNC_XN_XN(c, fnc)      \
-    TEST_XN_FUNC_XN_XN(us, fnc)     \
-    TEST_XN_FUNC_XN_XN(s, fnc)      \
-    TEST_XN_FUNC_XN_XN(ui, fnc)     \
-    TEST_XN_FUNC_XN_XN(i, fnc)
-
-#define TEST_I_FUNC_I_I_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_X_FUNC_X_X_X(uc, fnc)      \
-    TEST_X_FUNC_X_X_X(c, fnc)       \
-    TEST_X_FUNC_X_X_X(us, fnc)      \
-    TEST_X_FUNC_X_X_X(s, fnc)       \
-    TEST_X_FUNC_X_X_X(ui, fnc)      \
-    TEST_X_FUNC_X_X_X(i, fnc)
-
-#define TEST_FN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f2 = fnc(f2);                   \
-    f3 = fnc(f3);                   \
-    f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (float*) &f1);     \
-    f2 = fnc(f2, (float2*) &f2);    \
-    f3 = fnc(f3, (float3*) &f3);    \
-    f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f2);               \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_F34_FUNC_F34_F34(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f1);               \
-    f3 = fnc(f3, f1);               \
-    f4 = fnc(f4, f1);
-
-#define TEST_F_FUNC_FN(fnc)         \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f1 = fnc(f2);                   \
-    f1 = fnc(f3);                   \
-    f1 = fnc(f4);
-
-#define TEST_F_FUNC_FN_FN(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f1 = fnc(f2, f2);               \
-    f1 = fnc(f3, f3);               \
-    f1 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i2);               \
-    f3 = fnc(f3, i3);               \
-    f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i1);               \
-    f3 = fnc(f3, i1);               \
-    f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f2, f2);           \
-    f3 = fnc(f3, f3, f3);           \
-    f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_FN_F(fnc)   \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f1, f1);           \
-    f3 = fnc(f3, f1, f1);           \
-    f4 = fnc(f4, f1, f1);
-
-#define TEST_FN_FUNC_FN_PIN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (int*) &i1);       \
-    f2 = fnc(f2, (int2*) &i2);      \
-    f3 = fnc(f3, (int3*) &i3);      \
-    f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, (int*) &i1);   \
-    f2 = fnc(f2, f2, (int2*) &i2);  \
-    f3 = fnc(f3, f3, (int3*) &i3);  \
-    f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    i1 = fnc(f1);                   \
-    i2 = fnc(f2);                   \
-    i3 = fnc(f3);                   \
-    i4 = fnc(f4);
-
-static bool test_fp_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_FN_FUNC_FN(acos);
-    TEST_FN_FUNC_FN(acosh);
-    TEST_FN_FUNC_FN(acospi);
-    TEST_FN_FUNC_FN(asin);
-    TEST_FN_FUNC_FN(asinh);
-    TEST_FN_FUNC_FN(asinpi);
-    TEST_FN_FUNC_FN(atan);
-    TEST_FN_FUNC_FN_FN(atan2);
-    TEST_FN_FUNC_FN(atanh);
-    TEST_FN_FUNC_FN(atanpi);
-    TEST_FN_FUNC_FN_FN(atan2pi);
-    TEST_FN_FUNC_FN(cbrt);
-    TEST_FN_FUNC_FN(ceil);
-    TEST_FN_FUNC_FN_FN_FN(clamp);
-    TEST_FN_FUNC_FN_FN_F(clamp);
-    TEST_FN_FUNC_FN_FN(copysign);
-    TEST_FN_FUNC_FN(cos);
-    TEST_FN_FUNC_FN(cosh);
-    TEST_FN_FUNC_FN(cospi);
-    TEST_F34_FUNC_F34_F34(cross);
-    TEST_FN_FUNC_FN(degrees);
-    TEST_F_FUNC_FN_FN(distance);
-    TEST_F_FUNC_FN_FN(dot);
-    TEST_FN_FUNC_FN(erfc);
-    TEST_FN_FUNC_FN(erf);
-    TEST_FN_FUNC_FN(exp);
-    TEST_FN_FUNC_FN(exp2);
-    TEST_FN_FUNC_FN(exp10);
-    TEST_FN_FUNC_FN(expm1);
-    TEST_FN_FUNC_FN(fabs);
-    TEST_FN_FUNC_FN_FN(fdim);
-    TEST_FN_FUNC_FN(floor);
-    TEST_FN_FUNC_FN_FN_FN(fma);
-    TEST_FN_FUNC_FN_FN(fmax);
-    TEST_FN_FUNC_FN_F(fmax);
-    TEST_FN_FUNC_FN_FN(fmin);
-    TEST_FN_FUNC_FN_F(fmin);
-    TEST_FN_FUNC_FN_FN(fmod);
-    TEST_FN_FUNC_FN_PFN(fract);
-    TEST_FN_FUNC_FN_PIN(frexp);
-    TEST_FN_FUNC_FN_FN(hypot);
-    TEST_IN_FUNC_FN(ilogb);
-    TEST_FN_FUNC_FN_IN(ldexp);
-    TEST_FN_FUNC_FN_I(ldexp);
-    TEST_F_FUNC_FN(length);
-    TEST_FN_FUNC_FN(lgamma);
-    TEST_FN_FUNC_FN_PIN(lgamma);
-    TEST_FN_FUNC_FN(log);
-    TEST_FN_FUNC_FN(log2);
-    TEST_FN_FUNC_FN(log10);
-    TEST_FN_FUNC_FN(log1p);
-    TEST_FN_FUNC_FN(logb);
-    TEST_FN_FUNC_FN_FN_FN(mad);
-    TEST_FN_FUNC_FN_FN(max);
-    TEST_FN_FUNC_FN_F(max);
-    TEST_FN_FUNC_FN_FN(min);
-    TEST_FN_FUNC_FN_F(min);
-    TEST_FN_FUNC_FN_FN_FN(mix);
-    TEST_FN_FUNC_FN_FN_F(mix);
-    TEST_FN_FUNC_FN_PFN(modf);
-    // nan
-    TEST_FN_FUNC_FN_FN(nextafter);
-    TEST_FN_FUNC_FN(normalize);
-    TEST_FN_FUNC_FN_FN(pow);
-    TEST_FN_FUNC_FN_IN(pown);
-    TEST_FN_FUNC_FN_FN(powr);
-    TEST_FN_FUNC_FN(radians);
-    TEST_FN_FUNC_FN_FN(remainder);
-    TEST_FN_FUNC_FN_FN_PIN(remquo);
-    TEST_FN_FUNC_FN(rint);
-    TEST_FN_FUNC_FN_IN(rootn);
-    TEST_FN_FUNC_FN(round);
-    TEST_FN_FUNC_FN(rsqrt);
-    TEST_FN_FUNC_FN(sign);
-    TEST_FN_FUNC_FN(sin);
-    TEST_FN_FUNC_FN_PFN(sincos);
-    TEST_FN_FUNC_FN(sinh);
-    TEST_FN_FUNC_FN(sinpi);
-    TEST_FN_FUNC_FN(sqrt);
-    TEST_FN_FUNC_FN_FN(step);
-    TEST_FN_FUNC_FN_F(step);
-    TEST_FN_FUNC_FN(tan);
-    TEST_FN_FUNC_FN(tanh);
-    TEST_FN_FUNC_FN(tanpi);
-    TEST_FN_FUNC_FN(tgamma);
-    TEST_FN_FUNC_FN(trunc);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_fp_math FAILED", time);
-    }
-    else {
-        rsDebug("test_fp_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_int_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_UIN_FUNC_IN(abs);
-    TEST_IN_FUNC_IN(clz);
-    TEST_IN_FUNC_IN_IN(min);
-    TEST_IN_FUNC_IN_IN(max);
-    TEST_I_FUNC_I_I_I(rsClamp);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_int_math FAILED", time);
-    }
-    else {
-        rsDebug("test_int_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_basic_operators() {
-    bool failed = false;
-    int i = 0;
-
-    TEST_INT_OP(+);
-    TEST_INT_OP(-);
-    TEST_INT_OP(*);
-    TEST_INT_OP(/);
-    TEST_INT_OP(%);
-    TEST_INT_OP(<<);
-    TEST_INT_OP(>>);
-
-    if (failed) {
-        rsDebug("test_basic_operators FAILED", 0);
-    }
-    else {
-        rsDebug("test_basic_operators PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define TEST_CVT(to, from, type)                        \
-rsDebug("Testing convert from " #from " to " #to, 0);   \
-to##1 = from##1;                                        \
-to##2 = convert_##type##2(from##2);                     \
-to##3 = convert_##type##3(from##3);                     \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type)   \
-TEST_CVT(to, c, type);              \
-TEST_CVT(to, uc, type);             \
-TEST_CVT(to, s, type);              \
-TEST_CVT(to, us, type);             \
-TEST_CVT(to, i, type);              \
-TEST_CVT(to, ui, type);             \
-TEST_CVT(to, f, type);              \
-
-static bool test_convert() {
-    bool failed = false;
-
-    TEST_CVT_MATRIX(c, char);
-    TEST_CVT_MATRIX(uc, uchar);
-    TEST_CVT_MATRIX(s, short);
-    TEST_CVT_MATRIX(us, ushort);
-    TEST_CVT_MATRIX(i, int);
-    TEST_CVT_MATRIX(ui, uint);
-    TEST_CVT_MATRIX(f, float);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define INIT_PREFIX_TYPE(prefix, type)  \
-prefix##_##type##_1 = 1;                \
-prefix##_##type##_2.x = 1;              \
-prefix##_##type##_2.y = 1;              \
-prefix##_##type##_3.x = 1;              \
-prefix##_##type##_3.y = 1;              \
-prefix##_##type##_3.z = 1;              \
-prefix##_##type##_4.x = 1;              \
-prefix##_##type##_4.y = 1;              \
-prefix##_##type##_4.z = 1;              \
-prefix##_##type##_4.w = 1;
-
-#define INIT_TYPE(type)         \
-INIT_PREFIX_TYPE(src1, type)    \
-INIT_PREFIX_TYPE(src2, type)    \
-INIT_PREFIX_TYPE(res, type)
-
-#define INIT_ALL    \
-INIT_TYPE(c);       \
-INIT_TYPE(uc);      \
-INIT_TYPE(s);       \
-INIT_TYPE(us);      \
-INIT_TYPE(i);       \
-INIT_TYPE(ui);
-
-void math_test(uint32_t index, int test_num) {
-    bool failed = false;
-    INIT_ALL;
-    failed |= test_convert();
-    failed |= test_fp_math(index);
-    failed |= test_int_math(index);
-    failed |= test_basic_operators();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.bak b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.bak
deleted file mode 100644
index ad802ca..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.bak
+++ /dev/null
@@ -1,423 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define DECL_INT(prefix)            \
-volatile char prefix##_c_1 = 1;     \
-volatile char2 prefix##_c_2 = 1;    \
-volatile char3 prefix##_c_3 = 1;    \
-volatile char4 prefix##_c_4 = 1;    \
-volatile uchar prefix##_uc_1 = 1;   \
-volatile uchar2 prefix##_uc_2 = 1;  \
-volatile uchar3 prefix##_uc_3 = 1;  \
-volatile uchar4 prefix##_uc_4 = 1;  \
-volatile short prefix##_s_1 = 1;    \
-volatile short2 prefix##_s_2 = 1;   \
-volatile short3 prefix##_s_3 = 1;   \
-volatile short4 prefix##_s_4 = 1;   \
-volatile ushort prefix##_us_1 = 1;  \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1;      \
-volatile int2 prefix##_i_2 = 1;     \
-volatile int3 prefix##_i_3 = 1;     \
-volatile int4 prefix##_i_4 = 1;     \
-volatile uint prefix##_ui_1 = 1;    \
-volatile uint2 prefix##_ui_2 = 1;   \
-volatile uint3 prefix##_ui_3 = 1;   \
-volatile uint4 prefix##_ui_4 = 1;   \
-volatile long prefix##_l_1 = 1;     \
-volatile ulong prefix##_ul_1 = 1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-#define TEST_INT_OP_TYPE(op, type)                      \
-rsDebug("Testing " #op " for " #type "3", i++);         \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3;    \
-
-#define TEST_INT_OP(op)                     \
-TEST_INT_OP_TYPE(op, c)                     \
-TEST_INT_OP_TYPE(op, uc)                    \
-
-#define TEST_XN_FUNC_YN(typeout, fnc, typein)   \
-    res_##typeout##_1 = fnc(src1_##typein##_1); \
-    res_##typeout##_2 = fnc(src1_##typein##_2); \
-    res_##typeout##_3 = fnc(src1_##typein##_3); \
-    res_##typeout##_4 = fnc(src1_##typein##_4);
-
-#define TEST_XN_FUNC_XN_XN(type, fnc)                       \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
-    res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
-    res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
-    res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
-
-#define TEST_X_FUNC_X_X_X(type, fnc)    \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
-
-#define TEST_IN_FUNC_IN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, uc)    \
-    TEST_XN_FUNC_YN(c, fnc, c)      \
-    TEST_XN_FUNC_YN(us, fnc, us)    \
-    TEST_XN_FUNC_YN(s, fnc, s)      \
-    TEST_XN_FUNC_YN(ui, fnc, ui)    \
-    TEST_XN_FUNC_YN(i, fnc, i)
-
-#define TEST_UIN_FUNC_IN(fnc)       \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, c)     \
-    TEST_XN_FUNC_YN(us, fnc, s)     \
-    TEST_XN_FUNC_YN(ui, fnc, i)     \
-
-#define TEST_IN_FUNC_IN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_XN_XN(uc, fnc)     \
-    TEST_XN_FUNC_XN_XN(c, fnc)      \
-    TEST_XN_FUNC_XN_XN(us, fnc)     \
-    TEST_XN_FUNC_XN_XN(s, fnc)      \
-    TEST_XN_FUNC_XN_XN(ui, fnc)     \
-    TEST_XN_FUNC_XN_XN(i, fnc)
-
-#define TEST_I_FUNC_I_I_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_X_FUNC_X_X_X(uc, fnc)      \
-    TEST_X_FUNC_X_X_X(c, fnc)       \
-    TEST_X_FUNC_X_X_X(us, fnc)      \
-    TEST_X_FUNC_X_X_X(s, fnc)       \
-    TEST_X_FUNC_X_X_X(ui, fnc)      \
-    TEST_X_FUNC_X_X_X(i, fnc)
-
-#define TEST_FN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f2 = fnc(f2);                   \
-    f3 = fnc(f3);                   \
-    f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (float*) &f1);     \
-    f2 = fnc(f2, (float2*) &f2);    \
-    f3 = fnc(f3, (float3*) &f3);    \
-    f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f2);               \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_F34_FUNC_F34_F34(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f1);               \
-    f3 = fnc(f3, f1);               \
-    f4 = fnc(f4, f1);
-
-#define TEST_F_FUNC_FN(fnc)         \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f1 = fnc(f2);                   \
-    f1 = fnc(f3);                   \
-    f1 = fnc(f4);
-
-#define TEST_F_FUNC_FN_FN(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f1 = fnc(f2, f2);               \
-    f1 = fnc(f3, f3);               \
-    f1 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i2);               \
-    f3 = fnc(f3, i3);               \
-    f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i1);               \
-    f3 = fnc(f3, i1);               \
-    f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f2, f2);           \
-    f3 = fnc(f3, f3, f3);           \
-    f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_FN_F(fnc)   \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f1, f1);           \
-    f3 = fnc(f3, f1, f1);           \
-    f4 = fnc(f4, f1, f1);
-
-#define TEST_FN_FUNC_FN_PIN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (int*) &i1);       \
-    f2 = fnc(f2, (int2*) &i2);      \
-    f3 = fnc(f3, (int3*) &i3);      \
-    f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, (int*) &i1);   \
-    f2 = fnc(f2, f2, (int2*) &i2);  \
-    f3 = fnc(f3, f3, (int3*) &i3);  \
-    f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    i1 = fnc(f1);                   \
-    i2 = fnc(f2);                   \
-    i3 = fnc(f3);                   \
-    i4 = fnc(f4);
-
-static bool test_fp_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_FN_FUNC_FN(acos);
-    TEST_FN_FUNC_FN(acosh);
-    TEST_FN_FUNC_FN(acospi);
-    TEST_FN_FUNC_FN(asin);
-    TEST_FN_FUNC_FN(asinh);
-    TEST_FN_FUNC_FN(asinpi);
-    TEST_FN_FUNC_FN(atan);
-    TEST_FN_FUNC_FN_FN(atan2);
-    TEST_FN_FUNC_FN(atanh);
-    TEST_FN_FUNC_FN(atanpi);
-    TEST_FN_FUNC_FN_FN(atan2pi);
-    TEST_FN_FUNC_FN(cbrt);
-    TEST_FN_FUNC_FN(ceil);
-    TEST_FN_FUNC_FN_FN_FN(clamp);
-    TEST_FN_FUNC_FN_FN_F(clamp);
-    TEST_FN_FUNC_FN_FN(copysign);
-    TEST_FN_FUNC_FN(cos);
-    TEST_FN_FUNC_FN(cosh);
-    TEST_FN_FUNC_FN(cospi);
-    TEST_F34_FUNC_F34_F34(cross);
-    TEST_FN_FUNC_FN(degrees);
-    TEST_F_FUNC_FN_FN(distance);
-    TEST_F_FUNC_FN_FN(dot);
-    TEST_FN_FUNC_FN(erfc);
-    TEST_FN_FUNC_FN(erf);
-    TEST_FN_FUNC_FN(exp);
-    TEST_FN_FUNC_FN(exp2);
-    TEST_FN_FUNC_FN(exp10);
-    TEST_FN_FUNC_FN(expm1);
-    TEST_FN_FUNC_FN(fabs);
-    TEST_FN_FUNC_FN_FN(fdim);
-    TEST_FN_FUNC_FN(floor);
-    TEST_FN_FUNC_FN_FN_FN(fma);
-    TEST_FN_FUNC_FN_FN(fmax);
-    TEST_FN_FUNC_FN_F(fmax);
-    TEST_FN_FUNC_FN_FN(fmin);
-    TEST_FN_FUNC_FN_F(fmin);
-    TEST_FN_FUNC_FN_FN(fmod);
-    TEST_FN_FUNC_FN_PFN(fract);
-    TEST_FN_FUNC_FN_PIN(frexp);
-    TEST_FN_FUNC_FN_FN(hypot);
-    TEST_IN_FUNC_FN(ilogb);
-    TEST_FN_FUNC_FN_IN(ldexp);
-    TEST_FN_FUNC_FN_I(ldexp);
-    TEST_F_FUNC_FN(length);
-    TEST_FN_FUNC_FN(lgamma);
-    TEST_FN_FUNC_FN_PIN(lgamma);
-    TEST_FN_FUNC_FN(log);
-    TEST_FN_FUNC_FN(log2);
-    TEST_FN_FUNC_FN(log10);
-    TEST_FN_FUNC_FN(log1p);
-    TEST_FN_FUNC_FN(logb);
-    TEST_FN_FUNC_FN_FN_FN(mad);
-    TEST_FN_FUNC_FN_FN(max);
-    TEST_FN_FUNC_FN_F(max);
-    TEST_FN_FUNC_FN_FN(min);
-    TEST_FN_FUNC_FN_F(min);
-    TEST_FN_FUNC_FN_FN_FN(mix);
-    TEST_FN_FUNC_FN_FN_F(mix);
-    TEST_FN_FUNC_FN_PFN(modf);
-    // nan
-    TEST_FN_FUNC_FN_FN(nextafter);
-    TEST_FN_FUNC_FN(normalize);
-    TEST_FN_FUNC_FN_FN(pow);
-    TEST_FN_FUNC_FN_IN(pown);
-    TEST_FN_FUNC_FN_FN(powr);
-    TEST_FN_FUNC_FN(radians);
-    TEST_FN_FUNC_FN_FN(remainder);
-    TEST_FN_FUNC_FN_FN_PIN(remquo);
-    TEST_FN_FUNC_FN(rint);
-    TEST_FN_FUNC_FN_IN(rootn);
-    TEST_FN_FUNC_FN(round);
-    TEST_FN_FUNC_FN(rsqrt);
-    TEST_FN_FUNC_FN(sign);
-    TEST_FN_FUNC_FN(sin);
-    TEST_FN_FUNC_FN_PFN(sincos);
-    TEST_FN_FUNC_FN(sinh);
-    TEST_FN_FUNC_FN(sinpi);
-    TEST_FN_FUNC_FN(sqrt);
-    TEST_FN_FUNC_FN_FN(step);
-    TEST_FN_FUNC_FN_F(step);
-    TEST_FN_FUNC_FN(tan);
-    TEST_FN_FUNC_FN(tanh);
-    TEST_FN_FUNC_FN(tanpi);
-    TEST_FN_FUNC_FN(tgamma);
-    TEST_FN_FUNC_FN(trunc);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_fp_math FAILED", time);
-    }
-    else {
-        rsDebug("test_fp_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_int_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_UIN_FUNC_IN(abs);
-    TEST_IN_FUNC_IN(clz);
-    TEST_IN_FUNC_IN_IN(min);
-    TEST_IN_FUNC_IN_IN(max);
-    TEST_I_FUNC_I_I_I(rsClamp);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_int_math FAILED", time);
-    }
-    else {
-        rsDebug("test_int_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_basic_operators() {
-    bool failed = false;
-    int i = 0;
-
-    TEST_INT_OP(+);
-    TEST_INT_OP(-);
-    TEST_INT_OP(*);
-    TEST_INT_OP(/);
-    TEST_INT_OP(%);
-    TEST_INT_OP(<<);
-    TEST_INT_OP(>>);
-
-    if (failed) {
-        rsDebug("test_basic_operators FAILED", 0);
-    }
-    else {
-        rsDebug("test_basic_operators PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define TEST_CVT(to, from, type)                        \
-rsDebug("Testing convert from " #from " to " #to, 0);   \
-to##1 = from##1;                                        \
-to##2 = convert_##type##2(from##2);                     \
-to##3 = convert_##type##3(from##3);                     \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type)   \
-TEST_CVT(to, c, type);              \
-TEST_CVT(to, uc, type);             \
-TEST_CVT(to, s, type);              \
-TEST_CVT(to, us, type);             \
-TEST_CVT(to, i, type);              \
-TEST_CVT(to, ui, type);             \
-TEST_CVT(to, f, type);              \
-
-static bool test_convert() {
-    bool failed = false;
-
-    TEST_CVT_MATRIX(c, char);
-    TEST_CVT_MATRIX(uc, uchar);
-    TEST_CVT_MATRIX(s, short);
-    TEST_CVT_MATRIX(us, ushort);
-    TEST_CVT_MATRIX(i, int);
-    TEST_CVT_MATRIX(ui, uint);
-    TEST_CVT_MATRIX(f, float);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_test(uint32_t index, int test_num) {
-    bool failed = false;
-    rsDebug("Here ", 1);
-    res_uc_3 = src1_uc_3 / src2_uc_3;
-    rsDebug("Here ", 2);
-    failed |= test_basic_operators();
-    rsDebug("Here ", 3);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.orig b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.orig
deleted file mode 100644
index aae29a4..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/math.rs.orig
+++ /dev/null
@@ -1,436 +0,0 @@
-#include "shared.rsh"
-
-// Testing math library
-
-volatile float f1;
-volatile float2 f2;
-volatile float3 f3;
-volatile float4 f4;
-
-volatile int i1;
-volatile int2 i2;
-volatile int3 i3;
-volatile int4 i4;
-
-volatile uint ui1;
-volatile uint2 ui2;
-volatile uint3 ui3;
-volatile uint4 ui4;
-
-volatile short s1;
-volatile short2 s2;
-volatile short3 s3;
-volatile short4 s4;
-
-volatile ushort us1;
-volatile ushort2 us2;
-volatile ushort3 us3;
-volatile ushort4 us4;
-
-volatile char c1;
-volatile char2 c2;
-volatile char3 c3;
-volatile char4 c4;
-
-volatile uchar uc1;
-volatile uchar2 uc2;
-volatile uchar3 uc3;
-volatile uchar4 uc4;
-
-#define DECL_INT(prefix)            \
-volatile char prefix##_c_1 = 1;     \
-volatile char2 prefix##_c_2 = 1;    \
-volatile char3 prefix##_c_3 = 1;    \
-volatile char4 prefix##_c_4 = 1;    \
-volatile uchar prefix##_uc_1 = 1;   \
-volatile uchar2 prefix##_uc_2 = 1;  \
-volatile uchar3 prefix##_uc_3 = 1;  \
-volatile uchar4 prefix##_uc_4 = 1;  \
-volatile short prefix##_s_1 = 1;    \
-volatile short2 prefix##_s_2 = 1;   \
-volatile short3 prefix##_s_3 = 1;   \
-volatile short4 prefix##_s_4 = 1;   \
-volatile ushort prefix##_us_1 = 1;  \
-volatile ushort2 prefix##_us_2 = 1; \
-volatile ushort3 prefix##_us_3 = 1; \
-volatile ushort4 prefix##_us_4 = 1; \
-volatile int prefix##_i_1 = 1;      \
-volatile int2 prefix##_i_2 = 1;     \
-volatile int3 prefix##_i_3 = 1;     \
-volatile int4 prefix##_i_4 = 1;     \
-volatile uint prefix##_ui_1 = 1;    \
-volatile uint2 prefix##_ui_2 = 1;   \
-volatile uint3 prefix##_ui_3 = 1;   \
-volatile uint4 prefix##_ui_4 = 1;   \
-volatile long prefix##_l_1 = 1;     \
-volatile ulong prefix##_ul_1 = 1;
-
-DECL_INT(res)
-DECL_INT(src1)
-DECL_INT(src2)
-
-#define TEST_INT_OP_TYPE(op, type)                      \
-rsDebug("Testing " #op " for " #type "1", i++);         \
-res_##type##_1 = src1_##type##_1 op src2_##type##_1;    \
-rsDebug("Testing " #op " for " #type "2", i++);         \
-res_##type##_2 = src1_##type##_2 op src2_##type##_2;    \
-rsDebug("Testing " #op " for " #type "3", i++);         \
-res_##type##_3 = src1_##type##_3 op src2_##type##_3;    \
-rsDebug("Testing " #op " for " #type "4", i++);         \
-res_##type##_4 = src1_##type##_4 op src2_##type##_4;
-
-#define TEST_INT_OP(op)                     \
-TEST_INT_OP_TYPE(op, c)                     \
-TEST_INT_OP_TYPE(op, uc)                    \
-TEST_INT_OP_TYPE(op, s)                     \
-TEST_INT_OP_TYPE(op, us)                    \
-TEST_INT_OP_TYPE(op, i)                     \
-TEST_INT_OP_TYPE(op, ui)                    \
-rsDebug("Testing " #op " for l1", i++);     \
-res_l_1 = src1_l_1 op src2_l_1;             \
-rsDebug("Testing " #op " for ul1", i++);    \
-res_ul_1 = src1_ul_1 op src2_ul_1;
-
-#define TEST_XN_FUNC_YN(typeout, fnc, typein)   \
-    res_##typeout##_1 = fnc(src1_##typein##_1); \
-    res_##typeout##_2 = fnc(src1_##typein##_2); \
-    res_##typeout##_3 = fnc(src1_##typein##_3); \
-    res_##typeout##_4 = fnc(src1_##typein##_4);
-
-#define TEST_XN_FUNC_XN_XN(type, fnc)                       \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1); \
-    res_##type##_2 = fnc(src1_##type##_2, src2_##type##_2); \
-    res_##type##_3 = fnc(src1_##type##_3, src2_##type##_3); \
-    res_##type##_4 = fnc(src1_##type##_4, src2_##type##_4);
-
-#define TEST_X_FUNC_X_X_X(type, fnc)    \
-    res_##type##_1 = fnc(src1_##type##_1, src2_##type##_1, src2_##type##_1);
-
-#define TEST_IN_FUNC_IN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, uc)    \
-    TEST_XN_FUNC_YN(c, fnc, c)      \
-    TEST_XN_FUNC_YN(us, fnc, us)    \
-    TEST_XN_FUNC_YN(s, fnc, s)      \
-    TEST_XN_FUNC_YN(ui, fnc, ui)    \
-    TEST_XN_FUNC_YN(i, fnc, i)
-
-#define TEST_UIN_FUNC_IN(fnc)       \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_YN(uc, fnc, c)     \
-    TEST_XN_FUNC_YN(us, fnc, s)     \
-    TEST_XN_FUNC_YN(ui, fnc, i)     \
-
-#define TEST_IN_FUNC_IN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_XN_FUNC_XN_XN(uc, fnc)     \
-    TEST_XN_FUNC_XN_XN(c, fnc)      \
-    TEST_XN_FUNC_XN_XN(us, fnc)     \
-    TEST_XN_FUNC_XN_XN(s, fnc)      \
-    TEST_XN_FUNC_XN_XN(ui, fnc)     \
-    TEST_XN_FUNC_XN_XN(i, fnc)
-
-#define TEST_I_FUNC_I_I_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    TEST_X_FUNC_X_X_X(uc, fnc)      \
-    TEST_X_FUNC_X_X_X(c, fnc)       \
-    TEST_X_FUNC_X_X_X(us, fnc)      \
-    TEST_X_FUNC_X_X_X(s, fnc)       \
-    TEST_X_FUNC_X_X_X(ui, fnc)      \
-    TEST_X_FUNC_X_X_X(i, fnc)
-
-#define TEST_FN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f2 = fnc(f2);                   \
-    f3 = fnc(f3);                   \
-    f4 = fnc(f4);
-
-#define TEST_FN_FUNC_FN_PFN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (float*) &f1);     \
-    f2 = fnc(f2, (float2*) &f2);    \
-    f3 = fnc(f3, (float3*) &f3);    \
-    f4 = fnc(f4, (float4*) &f4);
-
-#define TEST_FN_FUNC_FN_FN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f2);               \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_F34_FUNC_F34_F34(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f3 = fnc(f3, f3);               \
-    f4 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_F(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f2 = fnc(f2, f1);               \
-    f3 = fnc(f3, f1);               \
-    f4 = fnc(f4, f1);
-
-#define TEST_F_FUNC_FN(fnc)         \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1);                   \
-    f1 = fnc(f2);                   \
-    f1 = fnc(f3);                   \
-    f1 = fnc(f4);
-
-#define TEST_F_FUNC_FN_FN(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1);               \
-    f1 = fnc(f2, f2);               \
-    f1 = fnc(f3, f3);               \
-    f1 = fnc(f4, f4);
-
-#define TEST_FN_FUNC_FN_IN(fnc)     \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i2);               \
-    f3 = fnc(f3, i3);               \
-    f4 = fnc(f4, i4);
-
-#define TEST_FN_FUNC_FN_I(fnc)      \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, i1);               \
-    f2 = fnc(f2, i1);               \
-    f3 = fnc(f3, i1);               \
-    f4 = fnc(f4, i1);
-
-#define TEST_FN_FUNC_FN_FN_FN(fnc)  \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f2, f2);           \
-    f3 = fnc(f3, f3, f3);           \
-    f4 = fnc(f4, f4, f4);
-
-#define TEST_FN_FUNC_FN_FN_F(fnc)   \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, f1);           \
-    f2 = fnc(f2, f1, f1);           \
-    f3 = fnc(f3, f1, f1);           \
-    f4 = fnc(f4, f1, f1);
-
-#define TEST_FN_FUNC_FN_PIN(fnc)    \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, (int*) &i1);       \
-    f2 = fnc(f2, (int2*) &i2);      \
-    f3 = fnc(f3, (int3*) &i3);      \
-    f4 = fnc(f4, (int4*) &i4);
-
-#define TEST_FN_FUNC_FN_FN_PIN(fnc) \
-    rsDebug("Testing " #fnc, 0);    \
-    f1 = fnc(f1, f1, (int*) &i1);   \
-    f2 = fnc(f2, f2, (int2*) &i2);  \
-    f3 = fnc(f3, f3, (int3*) &i3);  \
-    f4 = fnc(f4, f4, (int4*) &i4);
-
-#define TEST_IN_FUNC_FN(fnc)        \
-    rsDebug("Testing " #fnc, 0);    \
-    i1 = fnc(f1);                   \
-    i2 = fnc(f2);                   \
-    i3 = fnc(f3);                   \
-    i4 = fnc(f4);
-
-static bool test_fp_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_FN_FUNC_FN(acos);
-    TEST_FN_FUNC_FN(acosh);
-    TEST_FN_FUNC_FN(acospi);
-    TEST_FN_FUNC_FN(asin);
-    TEST_FN_FUNC_FN(asinh);
-    TEST_FN_FUNC_FN(asinpi);
-    TEST_FN_FUNC_FN(atan);
-    TEST_FN_FUNC_FN_FN(atan2);
-    TEST_FN_FUNC_FN(atanh);
-    TEST_FN_FUNC_FN(atanpi);
-    TEST_FN_FUNC_FN_FN(atan2pi);
-    TEST_FN_FUNC_FN(cbrt);
-    TEST_FN_FUNC_FN(ceil);
-    TEST_FN_FUNC_FN_FN_FN(clamp);
-    TEST_FN_FUNC_FN_FN_F(clamp);
-    TEST_FN_FUNC_FN_FN(copysign);
-    TEST_FN_FUNC_FN(cos);
-    TEST_FN_FUNC_FN(cosh);
-    TEST_FN_FUNC_FN(cospi);
-    TEST_F34_FUNC_F34_F34(cross);
-    TEST_FN_FUNC_FN(degrees);
-    TEST_F_FUNC_FN_FN(distance);
-    TEST_F_FUNC_FN_FN(dot);
-    TEST_FN_FUNC_FN(erfc);
-    TEST_FN_FUNC_FN(erf);
-    TEST_FN_FUNC_FN(exp);
-    TEST_FN_FUNC_FN(exp2);
-    TEST_FN_FUNC_FN(exp10);
-    TEST_FN_FUNC_FN(expm1);
-    TEST_FN_FUNC_FN(fabs);
-    TEST_FN_FUNC_FN_FN(fdim);
-    TEST_FN_FUNC_FN(floor);
-    TEST_FN_FUNC_FN_FN_FN(fma);
-    TEST_FN_FUNC_FN_FN(fmax);
-    TEST_FN_FUNC_FN_F(fmax);
-    TEST_FN_FUNC_FN_FN(fmin);
-    TEST_FN_FUNC_FN_F(fmin);
-    TEST_FN_FUNC_FN_FN(fmod);
-    TEST_FN_FUNC_FN_PFN(fract);
-    TEST_FN_FUNC_FN_PIN(frexp);
-    TEST_FN_FUNC_FN_FN(hypot);
-    TEST_IN_FUNC_FN(ilogb);
-    TEST_FN_FUNC_FN_IN(ldexp);
-    TEST_FN_FUNC_FN_I(ldexp);
-    TEST_F_FUNC_FN(length);
-    TEST_FN_FUNC_FN(lgamma);
-    TEST_FN_FUNC_FN_PIN(lgamma);
-    TEST_FN_FUNC_FN(log);
-    TEST_FN_FUNC_FN(log2);
-    TEST_FN_FUNC_FN(log10);
-    TEST_FN_FUNC_FN(log1p);
-    TEST_FN_FUNC_FN(logb);
-    TEST_FN_FUNC_FN_FN_FN(mad);
-    TEST_FN_FUNC_FN_FN(max);
-    TEST_FN_FUNC_FN_F(max);
-    TEST_FN_FUNC_FN_FN(min);
-    TEST_FN_FUNC_FN_F(min);
-    TEST_FN_FUNC_FN_FN_FN(mix);
-    TEST_FN_FUNC_FN_FN_F(mix);
-    TEST_FN_FUNC_FN_PFN(modf);
-    // nan
-    TEST_FN_FUNC_FN_FN(nextafter);
-    TEST_FN_FUNC_FN(normalize);
-    TEST_FN_FUNC_FN_FN(pow);
-    TEST_FN_FUNC_FN_IN(pown);
-    TEST_FN_FUNC_FN_FN(powr);
-    TEST_FN_FUNC_FN(radians);
-    TEST_FN_FUNC_FN_FN(remainder);
-    TEST_FN_FUNC_FN_FN_PIN(remquo);
-    TEST_FN_FUNC_FN(rint);
-    TEST_FN_FUNC_FN_IN(rootn);
-    TEST_FN_FUNC_FN(round);
-    TEST_FN_FUNC_FN(rsqrt);
-    TEST_FN_FUNC_FN(sign);
-    TEST_FN_FUNC_FN(sin);
-    TEST_FN_FUNC_FN_PFN(sincos);
-    TEST_FN_FUNC_FN(sinh);
-    TEST_FN_FUNC_FN(sinpi);
-    TEST_FN_FUNC_FN(sqrt);
-    TEST_FN_FUNC_FN_FN(step);
-    TEST_FN_FUNC_FN_F(step);
-    TEST_FN_FUNC_FN(tan);
-    TEST_FN_FUNC_FN(tanh);
-    TEST_FN_FUNC_FN(tanpi);
-    TEST_FN_FUNC_FN(tgamma);
-    TEST_FN_FUNC_FN(trunc);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_fp_math FAILED", time);
-    }
-    else {
-        rsDebug("test_fp_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_int_math(uint32_t index) {
-    bool failed = false;
-    start();
-
-    TEST_UIN_FUNC_IN(abs);
-    TEST_IN_FUNC_IN(clz);
-    TEST_IN_FUNC_IN_IN(min);
-    TEST_IN_FUNC_IN_IN(max);
-    TEST_I_FUNC_I_I_I(rsClamp);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_int_math FAILED", time);
-    }
-    else {
-        rsDebug("test_int_math PASSED", time);
-    }
-
-    return failed;
-}
-
-static bool test_basic_operators() {
-    bool failed = false;
-    int i = 0;
-
-    TEST_INT_OP(+);
-    TEST_INT_OP(-);
-    TEST_INT_OP(*);
-    TEST_INT_OP(/);
-    TEST_INT_OP(%);
-    TEST_INT_OP(<<);
-    TEST_INT_OP(>>);
-
-    if (failed) {
-        rsDebug("test_basic_operators FAILED", 0);
-    }
-    else {
-        rsDebug("test_basic_operators PASSED", 0);
-    }
-
-    return failed;
-}
-
-#define TEST_CVT(to, from, type)                        \
-rsDebug("Testing convert from " #from " to " #to, 0);   \
-to##1 = from##1;                                        \
-to##2 = convert_##type##2(from##2);                     \
-to##3 = convert_##type##3(from##3);                     \
-to##4 = convert_##type##4(from##4);
-
-#define TEST_CVT_MATRIX(to, type)   \
-TEST_CVT(to, c, type);              \
-TEST_CVT(to, uc, type);             \
-TEST_CVT(to, s, type);              \
-TEST_CVT(to, us, type);             \
-TEST_CVT(to, i, type);              \
-TEST_CVT(to, ui, type);             \
-TEST_CVT(to, f, type);              \
-
-static bool test_convert() {
-    bool failed = false;
-
-    TEST_CVT_MATRIX(c, char);
-    TEST_CVT_MATRIX(uc, uchar);
-    TEST_CVT_MATRIX(s, short);
-    TEST_CVT_MATRIX(us, ushort);
-    TEST_CVT_MATRIX(i, int);
-    TEST_CVT_MATRIX(ui, uint);
-    TEST_CVT_MATRIX(f, float);
-
-    if (failed) {
-        rsDebug("test_convert FAILED", 0);
-    }
-    else {
-        rsDebug("test_convert PASSED", 0);
-    }
-
-    return failed;
-}
-
-void math_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_convert();
-    failed |= test_fp_math(index);
-    failed |= test_int_math(index);
-    failed |= test_basic_operators();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/primitives.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/primitives.rs
deleted file mode 100644
index ce451da..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/primitives.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool test_primitive_types(uint32_t index) {
-    bool failed = false;
-    start();
-
-    _RS_ASSERT(floatTest == 2.99f);
-    _RS_ASSERT(doubleTest == 3.05);
-    _RS_ASSERT(charTest == -16);
-    _RS_ASSERT(shortTest == -32);
-    _RS_ASSERT(intTest == -64);
-    _RS_ASSERT(longTest == 17179869185l);
-    _RS_ASSERT(longlongTest == 68719476735l);
-
-    _RS_ASSERT(ucharTest == 8);
-    _RS_ASSERT(ushortTest == 16);
-    _RS_ASSERT(uintTest == 32);
-    _RS_ASSERT(ulongTest == 4611686018427387903L);
-    _RS_ASSERT(int64_tTest == -17179869184l);
-    _RS_ASSERT(uint64_tTest == 117179869185l);
-
-    float time = end(index);
-
-    if (failed) {
-        rsDebug("test_primitives FAILED", time);
-    }
-    else {
-        rsDebug("test_primitives PASSED", time);
-    }
-
-    return failed;
-}
-
-void primitives_test(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= test_primitive_types(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/refcount.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/refcount.rs
deleted file mode 100644
index 4ea70e2..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/refcount.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "shared.rsh"
-
-// Testing reference counting of RS object types
-
-rs_allocation globalA;
-static rs_allocation staticGlobalA;
-
-void refcount_test() {
-    staticGlobalA = globalA;
-    rsClearObject(&globalA);
-    rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rsdebug.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rsdebug.rs
deleted file mode 100644
index f7942a5..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rsdebug.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "shared.rsh"
-
-// Testing primitive types
-float floatTest = 1.99f;
-double doubleTest = 2.05;
-char charTest = -8;
-short shortTest = -16;
-int intTest = -32;
-long longTest = 17179869184l; // 1 << 34
-long long longlongTest = 68719476736l; // 1 << 36
-
-uchar ucharTest = 8;
-ushort ushortTest = 16;
-uint uintTest = 32;
-ulong ulongTest = 4611686018427387904L;
-int64_t int64_tTest = -17179869184l; // - 1 << 34
-uint64_t uint64_tTest = 117179869184l;
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    // For this reason, none of the outputs are actually checked.
-
-    rsDebug("floatTest", floatTest);
-    rsDebug("doubleTest", doubleTest);
-    rsDebug("charTest", charTest);
-    rsDebug("shortTest", shortTest);
-    rsDebug("intTest", intTest);
-    rsDebug("longTest", longTest);
-    rsDebug("longlongTest", longlongTest);
-
-    rsDebug("ucharTest", ucharTest);
-    rsDebug("ushortTest", ushortTest);
-    rsDebug("uintTest", uintTest);
-    rsDebug("ulongTest", ulongTest);
-    rsDebug("int64_tTest", int64_tTest);
-    rsDebug("uint64_tTest", uint64_tTest);
-
-    return failed;
-}
-
-void test_rsdebug(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rsdebug_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rsdebug_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rslist.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rslist.rs
deleted file mode 100644
index b3d8b9e..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rslist.rs
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2009 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.
-
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_v14)
-
-#include "rs_graphics.rsh"
-
-float gDY;
-
-rs_font gFont;
-
-typedef struct ListAllocs_s {
-    rs_allocation text;
-    int result;
-} ListAllocs;
-
-ListAllocs *gList;
-
-void init() {
-    gDY = 0.0f;
-}
-
-int textPos = 0;
-
-int root(void) {
-
-    rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-    rsgClearDepth(1.0f);
-
-    textPos -= (int)gDY*2;
-    gDY *= 0.95;
-
-    rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
-    rsgBindFont(gFont);
-
-    rs_allocation listAlloc;
-    listAlloc = rsGetAllocation(gList);
-    int allocSize = rsAllocationGetDimX(listAlloc);
-
-    int width = rsgGetWidth();
-    int height = rsgGetHeight();
-
-    int itemHeight = 80;
-    int totalItemHeight = itemHeight * allocSize;
-
-    /* Prevent scrolling above the top of the list */
-    int firstItem = height - totalItemHeight;
-    if (firstItem < 0) {
-        firstItem = 0;
-    }
-
-    /* Prevent scrolling past the last line of the list */
-    int lastItem = -1 * (totalItemHeight - height);
-    if (lastItem > 0) {
-        lastItem = 0;
-    }
-
-    if (textPos > firstItem) {
-        textPos = firstItem;
-    }
-    else if (textPos < lastItem) {
-        textPos = lastItem;
-    }
-
-    int currentYPos = itemHeight + textPos;
-
-    for(int i = 0; i < allocSize; i ++) {
-        if(currentYPos - itemHeight > height) {
-            break;
-        }
-
-        if(currentYPos > 0) {
-            switch(gList[i].result) {
-                case 1: /* Passed */
-                    rsgFontColor(0.5f, 0.9f, 0.5f, 1.0f);
-                    break;
-                case -1: /* Failed */
-                    rsgFontColor(0.9f, 0.5f, 0.5f, 1.0f);
-                    break;
-                case 0: /* Still Testing */
-                    rsgFontColor(0.9f, 0.9f, 0.5f, 1.0f);
-                    break;
-                default: /* Unknown */
-                    rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f);
-                    break;
-            }
-            rsgDrawRect(0, currentYPos - 1, width, currentYPos, 0);
-            rsgDrawText(gList[i].text, 30, currentYPos - 32);
-        }
-        currentYPos += itemHeight;
-    }
-
-    return 10;
-}
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstime.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstime.rs
deleted file mode 100644
index 5e3e078..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstime.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "shared.rsh"
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_time_t curTime = rsTime(0);
-    rs_tm tm;
-    rsDebug("curTime", curTime);
-
-    rsLocaltime(&tm, &curTime);
-
-    rsDebug("tm.tm_sec", tm.tm_sec);
-    rsDebug("tm.tm_min", tm.tm_min);
-    rsDebug("tm.tm_hour", tm.tm_hour);
-    rsDebug("tm.tm_mday", tm.tm_mday);
-    rsDebug("tm.tm_mon", tm.tm_mon);
-    rsDebug("tm.tm_year", tm.tm_year);
-    rsDebug("tm.tm_wday", tm.tm_wday);
-    rsDebug("tm.tm_yday", tm.tm_yday);
-    rsDebug("tm.tm_isdst", tm.tm_isdst);
-
-    // Test a specific time (only valid for PST localtime)
-    curTime = 1294438893;
-    rsLocaltime(&tm, &curTime);
-
-    _RS_ASSERT(tm.tm_sec == 33);
-    _RS_ASSERT(tm.tm_min == 21);
-    _RS_ASSERT(tm.tm_hour == 14);
-    _RS_ASSERT(tm.tm_mday == 7);
-    _RS_ASSERT(tm.tm_mon == 0);
-    _RS_ASSERT(tm.tm_year == 111);
-    _RS_ASSERT(tm.tm_wday == 5);
-    _RS_ASSERT(tm.tm_yday == 6);
-    _RS_ASSERT(tm.tm_isdst == 0);
-
-    return failed;
-}
-
-void test_rstime(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstime_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstime_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstypes.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstypes.rs
deleted file mode 100644
index 22d9c13..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/rstypes.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "shared.rsh"
-#include "rs_graphics.rsh"
-
-rs_element elementTest;
-rs_type typeTest;
-rs_allocation allocationTest;
-rs_sampler samplerTest;
-rs_script scriptTest;
-rs_mesh meshTest;
-rs_program_fragment program_fragmentTest;
-rs_program_vertex program_vertexTest;
-rs_program_raster program_rasterTest;
-rs_program_store program_storeTest;
-rs_font fontTest;
-
-rs_matrix4x4 matrix4x4Test;
-rs_matrix3x3 matrix3x3Test;
-rs_matrix2x2 matrix2x2Test;
-
-struct my_struct {
-    int i;
-    rs_font fontTestStruct;
-};
-
-static bool basic_test(uint32_t index) {
-    bool failed = false;
-
-    rs_matrix4x4 matrix4x4TestLocal;
-    rs_matrix3x3 matrix3x3TestLocal;
-    rs_matrix2x2 matrix2x2TestLocal;
-
-    // This test focuses primarily on compilation-time, not run-time.
-    rs_element elementTestLocal;
-    rs_type typeTestLocal;
-    rs_allocation allocationTestLocal;
-    rs_sampler samplerTestLocal;
-    rs_script scriptTestLocal;
-    rs_mesh meshTestLocal;
-    rs_program_fragment program_fragmentTestLocal;
-    rs_program_vertex program_vertexTestLocal;
-    rs_program_raster program_rasterTestLocal;
-    rs_program_store program_storeTestLocal;
-    rs_font fontTestLocal;
-
-    rs_font fontTestLocalArray[4];
-
-    rs_font fontTestLocalPreInit = fontTest;
-
-    struct my_struct structTest;
-
-    fontTestLocal = fontTest;
-    //allocationTestLocal = allocationTest;
-
-    fontTest = fontTestLocal;
-    //allocationTest = allocationTestLocal;
-
-    /*for (int i = 0; i < 4; i++) {
-        fontTestLocalArray[i] = fontTestLocal;
-    }*/
-
-    /*fontTest = fontTestLocalArray[3];*/
-
-    return failed;
-}
-
-void test_rstypes(uint32_t index, int test_num) {
-    bool failed = false;
-    failed |= basic_test(index);
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-        rsDebug("rstypes_test FAILED", -1);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-        rsDebug("rstypes_test PASSED", 0);
-    }
-}
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/shared.rsh b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/shared.rsh
deleted file mode 100644
index 4a7151f..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/shared.rsh
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_v14)
-
-typedef struct TestResult_s {
-    rs_allocation name;
-    bool pass;
-    float score;
-    int64_t time;
-} TestResult;
-//TestResult *g_results;
-
-static int64_t g_time;
-
-static void start(void) {
-    g_time = rsUptimeMillis();
-}
-
-static float end(uint32_t idx) {
-    int64_t t = rsUptimeMillis() - g_time;
-    //g_results[idx].time = t;
-    //rsDebug("test time", (int)t);
-    return ((float)t) / 1000.f;
-}
-
-#define _RS_ASSERT(b) \
-do { \
-    if (!(b)) { \
-        failed = true; \
-        rsDebug(#b " FAILED", 0); \
-    } \
-\
-} while (0)
-
-/* These constants must match those in UnitTest.java */
-static const int RS_MSG_TEST_PASSED = 100;
-static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/test_root.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/test_root.rs
deleted file mode 100644
index 88fe34a..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/test_root.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Fountain test script
-#pragma version(1)
-
-#pragma rs java_package_name(com.android.rs.test_v14)
-
-#pragma stateFragment(parent)
-
-#include "rs_graphics.rsh"
-
-
-typedef struct TestResult {
-    rs_allocation name;
-    bool pass;
-    float score;
-} TestResult_t;
-TestResult_t *results;
-
-int root() {
-
-    return 0;
-}
-
-
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/vector.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/vector.rs
deleted file mode 100644
index 0430a2f..0000000
--- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/vector.rs
+++ /dev/null
@@ -1,198 +0,0 @@
-#include "shared.rsh"
-
-// Testing vector types
-float2 f2 = { 1.0f, 2.0f };
-float3 f3 = { 1.0f, 2.0f, 3.0f };
-float4 f4 = { 1.0f, 2.0f, 3.0f, 4.0f };
-
-double2 d2 = { 1.0, 2.0 };
-double3 d3 = { 1.0, 2.0, 3.0 };
-double4 d4 = { 1.0, 2.0, 3.0, 4.0 };
-
-char2 i8_2 = { 1, 2 };
-char3 i8_3 = { 1, 2, 3 };
-char4 i8_4 = { 1, 2, 3, 4 };
-
-uchar2 u8_2 = { 1, 2 };
-uchar3 u8_3 = { 1, 2, 3 };
-uchar4 u8_4 = { 1, 2, 3, 4 };
-
-short2 i16_2 = { 1, 2 };
-short3 i16_3 = { 1, 2, 3 };
-short4 i16_4 = { 1, 2, 3, 4 };
-
-ushort2 u16_2 = { 1, 2 };
-ushort3 u16_3 = { 1, 2, 3 };
-ushort4 u16_4 = { 1, 2, 3, 4 };
-
-int2 i32_2 = { 1, 2 };
-int3 i32_3 = { 1, 2, 3 };
-int4 i32_4 = { 1, 2, 3, 4 };
-
-uint2 u32_2 = { 1, 2 };
-uint3 u32_3 = { 1, 2, 3 };
-uint4 u32_4 = { 1, 2, 3, 4 };
-
-long2 i64_2 = { 1, 2 };
-long3 i64_3 = { 1, 2, 3 };
-long4 i64_4 = { 1, 2, 3, 4 };
-
-ulong2 u64_2 = { 1, 2 };
-ulong3 u64_3 = { 1, 2, 3 };
-ulong4 u64_4 = { 1, 2, 3, 4 };
-
-static bool test_vector_types() {
-    bool failed = false;
-
-    rsDebug("Testing F32", 0);
-    _RS_ASSERT(f2.x == 2.99f);
-    _RS_ASSERT(f2.y == 3.99f);
-
-    _RS_ASSERT(f3.x == 2.99f);
-    _RS_ASSERT(f3.y == 3.99f);
-    _RS_ASSERT(f3.z == 4.99f);
-
-    _RS_ASSERT(f4.x == 2.99f);
-    _RS_ASSERT(f4.y == 3.99f);
-    _RS_ASSERT(f4.z == 4.99f);
-    _RS_ASSERT(f4.w == 5.99f);
-
-    rsDebug("Testing F64", 0);
-    _RS_ASSERT(d2.x == 2.99);
-    _RS_ASSERT(d2.y == 3.99);
-
-    _RS_ASSERT(d3.x == 2.99);
-    _RS_ASSERT(d3.y == 3.99);
-    _RS_ASSERT(d3.z == 4.99);
-
-    _RS_ASSERT(d4.x == 2.99);
-    _RS_ASSERT(d4.y == 3.99);
-    _RS_ASSERT(d4.z == 4.99);
-    _RS_ASSERT(d4.w == 5.99);
-
-    rsDebug("Testing I8", 0);
-    _RS_ASSERT(i8_2.x == 2);
-    _RS_ASSERT(i8_2.y == 3);
-
-    _RS_ASSERT(i8_3.x == 2);
-    _RS_ASSERT(i8_3.y == 3);
-    _RS_ASSERT(i8_3.z == 4);
-
-    _RS_ASSERT(i8_4.x == 2);
-    _RS_ASSERT(i8_4.y == 3);
-    _RS_ASSERT(i8_4.z == 4);
-    _RS_ASSERT(i8_4.w == 5);
-
-    rsDebug("Testing U8", 0);
-    _RS_ASSERT(u8_2.x == 2);
-    _RS_ASSERT(u8_2.y == 3);
-
-    _RS_ASSERT(u8_3.x == 2);
-    _RS_ASSERT(u8_3.y == 3);
-    _RS_ASSERT(u8_3.z == 4);
-
-    _RS_ASSERT(u8_4.x == 2);
-    _RS_ASSERT(u8_4.y == 3);
-    _RS_ASSERT(u8_4.z == 4);
-    _RS_ASSERT(u8_4.w == 5);
-
-    rsDebug("Testing I16", 0);
-    _RS_ASSERT(i16_2.x == 2);
-    _RS_ASSERT(i16_2.y == 3);
-
-    _RS_ASSERT(i16_3.x == 2);
-    _RS_ASSERT(i16_3.y == 3);
-    _RS_ASSERT(i16_3.z == 4);
-
-    _RS_ASSERT(i16_4.x == 2);
-    _RS_ASSERT(i16_4.y == 3);
-    _RS_ASSERT(i16_4.z == 4);
-    _RS_ASSERT(i16_4.w == 5);
-
-    rsDebug("Testing U16", 0);
-    _RS_ASSERT(u16_2.x == 2);
-    _RS_ASSERT(u16_2.y == 3);
-
-    _RS_ASSERT(u16_3.x == 2);
-    _RS_ASSERT(u16_3.y == 3);
-    _RS_ASSERT(u16_3.z == 4);
-
-    _RS_ASSERT(u16_4.x == 2);
-    _RS_ASSERT(u16_4.y == 3);
-    _RS_ASSERT(u16_4.z == 4);
-    _RS_ASSERT(u16_4.w == 5);
-
-    rsDebug("Testing I32", 0);
-    _RS_ASSERT(i32_2.x == 2);
-    _RS_ASSERT(i32_2.y == 3);
-
-    _RS_ASSERT(i32_3.x == 2);
-    _RS_ASSERT(i32_3.y == 3);
-    _RS_ASSERT(i32_3.z == 4);
-
-    _RS_ASSERT(i32_4.x == 2);
-    _RS_ASSERT(i32_4.y == 3);
-    _RS_ASSERT(i32_4.z == 4);
-    _RS_ASSERT(i32_4.w == 5);
-
-    rsDebug("Testing U32", 0);
-    _RS_ASSERT(u32_2.x == 2);
-    _RS_ASSERT(u32_2.y == 3);
-
-    _RS_ASSERT(u32_3.x == 2);
-    _RS_ASSERT(u32_3.y == 3);
-    _RS_ASSERT(u32_3.z == 4);
-
-    _RS_ASSERT(u32_4.x == 2);
-    _RS_ASSERT(u32_4.y == 3);
-    _RS_ASSERT(u32_4.z == 4);
-    _RS_ASSERT(u32_4.w == 5);
-
-    rsDebug("Testing I64", 0);
-    _RS_ASSERT(i64_2.x == 2);
-    _RS_ASSERT(i64_2.y == 3);
-
-    _RS_ASSERT(i64_3.x == 2);
-    _RS_ASSERT(i64_3.y == 3);
-    _RS_ASSERT(i64_3.z == 4);
-
-    _RS_ASSERT(i64_4.x == 2);
-    _RS_ASSERT(i64_4.y == 3);
-    _RS_ASSERT(i64_4.z == 4);
-    _RS_ASSERT(i64_4.w == 5);
-
-    rsDebug("Testing U64", 0);
-    _RS_ASSERT(u64_2.x == 2);
-    _RS_ASSERT(u64_2.y == 3);
-
-    _RS_ASSERT(u64_3.x == 2);
-    _RS_ASSERT(u64_3.y == 3);
-    _RS_ASSERT(u64_3.z == 4);
-
-    _RS_ASSERT(u64_4.x == 2);
-    _RS_ASSERT(u64_4.y == 3);
-    _RS_ASSERT(u64_4.z == 4);
-    _RS_ASSERT(u64_4.w == 5);
-
-    if (failed) {
-        rsDebug("test_vector FAILED", 0);
-    }
-    else {
-        rsDebug("test_vector PASSED", 0);
-    }
-
-    return failed;
-}
-
-void vector_test() {
-    bool failed = false;
-    failed |= test_vector_types();
-
-    if (failed) {
-        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
-    }
-    else {
-        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
-    }
-}
-
diff --git a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
index 59ae1a1..6fbe32f 100644
--- a/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
+++ b/tools/layoutlib/bridge/src/android/view/IWindowManagerImpl.java
@@ -16,6 +16,7 @@
 
 package android.view;
 
+import android.graphics.Point;
 import com.android.internal.view.IInputContext;
 import com.android.internal.view.IInputMethodClient;
 
@@ -348,11 +349,31 @@
     }
 
     @Override
+    public void getInitialDisplaySize(int displayId, Point size) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void getBaseDisplaySize(int displayId, Point size) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
     public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
         // TODO Auto-generated method stub
     }
 
     @Override
+    public int getInitialDisplayDensity(int displayId) {
+        return -1;
+    }
+
+    @Override
+    public int getBaseDisplayDensity(int displayId) {
+        return -1;
+    }
+
+    @Override
     public void setForcedDisplayDensity(int displayId, int density) throws RemoteException {
         // TODO Auto-generated method stub
     }
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index e0684fb..f093b52 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -73,8 +73,6 @@
 
     boolean isScanningAlwaysAvailable();
 
-    void setScanningAlwaysAvailable(boolean enable);
-
     boolean acquireWifiLock(IBinder lock, int lockType, String tag, in WorkSource ws);
 
     void updateWifiLockWorkSource(IBinder lock, in WorkSource ws);
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index a2df64b..0c0a144 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -393,6 +393,30 @@
     public static final String NETWORK_IDS_CHANGED_ACTION = "android.net.wifi.NETWORK_IDS_CHANGED";
 
     /**
+     * Activity Action: Show a system activity that allows the user to enable
+     * scans to be available even with Wi-Fi turned off.
+     *
+     * <p>Notification of the result of this activity is posted using the
+     * {@link android.app.Activity#onActivityResult} callback. The
+     * <code>resultCode</code>
+     * will be {@link android.app.Activity#RESULT_OK} if scan always mode has
+     * been turned on or {@link android.app.Activity#RESULT_CANCELED} if the user
+     * has rejected the request or an error has occurred.
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE =
+            "android.net.wifi.action.REQUEST_SCAN_ALWAYS_AVAILABLE";
+
+    /**
+     * Activity Action: Show a system activity that notifies the user that
+     * scanning is still available when Wi-Fi is turned off
+     * @hide
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_NOTIFY_SCAN_ALWAYS_AVAILABLE =
+            "android.net.wifi.action.NOTIFY_SCAN_ALWAYS_AVAILABLE";
+
+    /**
      * Activity Action: Pick a Wi-Fi network to connect to.
      * <p>Input: Nothing.
      * <p>Output: Nothing.
@@ -763,6 +787,22 @@
     }
 
     /**
+     * Check if scanning is always available.
+     *
+     * If this return {@code true}, apps can issue {@link #startScan} and fetch scan results
+     * even when Wi-Fi is turned off.
+     *
+     * To change this setting, see {@link #ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE}.
+     */
+    public boolean isScanningAlwaysAvailable() {
+        try {
+            return mService.isScanningAlwaysAvailable();
+        } catch (RemoteException e) {
+            return false;
+        }
+    }
+
+    /**
      * Tell the supplicant to persist the current list of configured networks.
      * <p>
      * Note: It is possible for this method to change the network IDs of
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index b57910f5..c0a3bc1 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1677,12 +1677,12 @@
         setNetworkDetailedState(DetailedState.DISCONNECTED);
         mWifiConfigStore.updateStatus(mLastNetworkId, DetailedState.DISCONNECTED);
 
-        /* send event to CM & network change broadcast */
-        sendNetworkStateChangeBroadcast(mLastBssid);
-
         /* Clear network properties */
         mLinkProperties.clear();
 
+        /* send event to CM & network change broadcast */
+        sendNetworkStateChangeBroadcast(mLastBssid);
+
         /* Clear IP settings if the network used DHCP */
         if (!mWifiConfigStore.isUsingStaticIp(mLastNetworkId)) {
             mWifiConfigStore.clearLinkProperties(mLastNetworkId);