Merge change 8931

* changes:
  fix [1985856] Seg fault when using the soft keyboard in the Messaging app
diff --git a/core/java/android/preference/VolumePreference.java b/core/java/android/preference/VolumePreference.java
index abdcd93..db25cfa 100644
--- a/core/java/android/preference/VolumePreference.java
+++ b/core/java/android/preference/VolumePreference.java
@@ -28,6 +28,7 @@
 import android.provider.Settings;
 import android.provider.Settings.System;
 import android.util.AttributeSet;
+import android.view.KeyEvent;
 import android.view.View;
 import android.widget.SeekBar;
 import android.widget.SeekBar.OnSeekBarChangeListener;
@@ -36,7 +37,7 @@
  * @hide
  */
 public class VolumePreference extends SeekBarPreference implements 
-        PreferenceManager.OnActivityStopListener {
+        PreferenceManager.OnActivityStopListener, View.OnKeyListener {
 
     private static final String TAG = "VolumePreference";
     
@@ -66,6 +67,30 @@
         mSeekBarVolumizer = new SeekBarVolumizer(getContext(), seekBar, mStreamType);
         
         getPreferenceManager().registerOnActivityStopListener(this);
+
+        // grab focus and key events so that pressing the volume buttons in the
+        // dialog doesn't also show the normal volume adjust toast.
+        view.setOnKeyListener(this);
+        view.setFocusableInTouchMode(true);
+        view.requestFocus();
+    }
+
+    public boolean onKey(View v, int keyCode, KeyEvent event) {
+        boolean isdown = (event.getAction() == KeyEvent.ACTION_DOWN);
+        switch (keyCode) {
+            case KeyEvent.KEYCODE_VOLUME_DOWN:
+                if (isdown) {
+                    mSeekBarVolumizer.changeVolumeBy(-1);
+                }
+                return true;
+            case KeyEvent.KEYCODE_VOLUME_UP:
+                if (isdown) {
+                    mSeekBarVolumizer.changeVolumeBy(1);
+                }
+                return true;
+            default:
+                return false;
+        }
     }
 
     @Override
@@ -158,7 +183,9 @@
             }
 
             mRingtone = RingtoneManager.getRingtone(mContext, defaultUri);
-            mRingtone.setStreamType(mStreamType);
+            if (mRingtone != null) {
+                mRingtone.setStreamType(mStreamType);
+            }
         }
         
         public void stop() {
@@ -215,5 +242,12 @@
             return mSeekBar;
         }
         
+        public void changeVolumeBy(int amount) {
+            mSeekBar.incrementProgressBy(amount);
+            if (mRingtone != null && !mRingtone.isPlaying()) {
+                sample();
+            }
+            postSetVolume(mSeekBar.getProgress());
+        }
     }
 }
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 46aea02..4baf612 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -16,6 +16,7 @@
 
 package android.view;
 
+import android.util.Config;
 import android.util.Log;
 import android.util.DisplayMetrics;
 import android.content.res.Resources;
@@ -140,7 +141,9 @@
     public static boolean consistencyCheckEnabled = false;
 
     static {
-        Debug.setFieldsOn(ViewDebug.class, true);
+        if (Config.DEBUG) {        
+	        Debug.setFieldsOn(ViewDebug.class, true);
+	    }
     }
 
     /**
diff --git a/core/java/android/view/VolumePanel.java b/core/java/android/view/VolumePanel.java
index a573983..e21824e 100644
--- a/core/java/android/view/VolumePanel.java
+++ b/core/java/android/view/VolumePanel.java
@@ -23,7 +23,9 @@
 import android.media.AudioManager;
 import android.media.AudioService;
 import android.media.AudioSystem;
+import android.media.RingtoneManager;
 import android.media.ToneGenerator;
+import android.net.Uri;
 import android.os.Handler;
 import android.os.Message;
 import android.os.Vibrator;
@@ -44,7 +46,7 @@
 public class VolumePanel extends Handler
 {
     private static final String TAG = "VolumePanel";
-    private static boolean LOGD = false || Config.LOGD;
+    private static boolean LOGD = false;
 
     /**
      * The delay before playing a sound. This small period exists so the user
@@ -86,6 +88,7 @@
     protected Context mContext;
     private AudioManager mAudioManager;
     protected AudioService mAudioService;
+    private boolean mRingIsSilent;
 
     private final Toast mToast;
     private final View mView;
@@ -138,7 +141,7 @@
             onShowVolumeChanged(streamType, flags);
         }
 
-        if ((flags & AudioManager.FLAG_PLAY_SOUND) != 0) {
+        if ((flags & AudioManager.FLAG_PLAY_SOUND) != 0 && ! mRingIsSilent) {
             removeMessages(MSG_PLAY_SOUND);
             sendMessageDelayed(obtainMessage(MSG_PLAY_SOUND, streamType, flags), PLAY_SOUND_DELAY);
         }
@@ -157,6 +160,7 @@
         int index = mAudioService.getStreamVolume(streamType);
         int message = UNKNOWN_VOLUME_TEXT;
         int additionalMessage = 0;
+        mRingIsSilent = false;
 
         if (LOGD) {
             Log.d(TAG, "onShowVolumeChanged(streamType: " + streamType
@@ -169,8 +173,15 @@
         switch (streamType) {
 
             case AudioManager.STREAM_RING: {
+                setRingerIcon();
                 message = RINGTONE_VOLUME_TEXT;
-                setRingerIcon(index);
+                Uri ringuri = RingtoneManager.getActualDefaultRingtoneUri(
+                        mContext, RingtoneManager.TYPE_RINGTONE);
+                if (ringuri == null) {
+                    additionalMessage =
+                        com.android.internal.R.string.volume_music_hint_silent_ringtone_selected;
+                    mRingIsSilent = true;
+                }
                 break;
             }
 
@@ -208,6 +219,13 @@
             case AudioManager.STREAM_NOTIFICATION: {
                 message = NOTIFICATION_VOLUME_TEXT;
                 setSmallIcon(index);
+                Uri ringuri = RingtoneManager.getActualDefaultRingtoneUri(
+                        mContext, RingtoneManager.TYPE_NOTIFICATION);
+                if (ringuri == null) {
+                    additionalMessage =
+                        com.android.internal.R.string.volume_music_hint_silent_ringtone_selected;
+                    mRingIsSilent = true;
+                }
                 break;
             }
 
@@ -254,7 +272,6 @@
                 mAudioService.shouldVibrate(AudioManager.VIBRATE_TYPE_RINGER)) {
             sendMessageDelayed(obtainMessage(MSG_VIBRATE), VIBRATE_DELAY);
         }
-
     }
 
     protected void onPlaySound(int streamType, int flags) {
@@ -337,17 +354,15 @@
     /**
      * Makes the ringer icon visible with an icon that is chosen
      * based on the current ringer mode.
-     *
-     * @param index
      */
-    private void setRingerIcon(int index) {
+    private void setRingerIcon() {
         mSmallStreamIcon.setVisibility(View.GONE);
         mLargeStreamIcon.setVisibility(View.VISIBLE);
 
         int ringerMode = mAudioService.getRingerMode();
         int icon;
 
-        if (LOGD) Log.d(TAG, "setRingerIcon(index: " + index+ "), ringerMode: " + ringerMode);
+        if (LOGD) Log.d(TAG, "setRingerIcon(), ringerMode: " + ringerMode);
 
         if (ringerMode == AudioManager.RINGER_MODE_SILENT) {
             icon = com.android.internal.R.drawable.ic_volume_off;
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 0e848398..549b668 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1709,6 +1709,8 @@
     <string name="volume_music">Media volume</string>
     <!-- Hint shown in the volume toast to inform the user that the media audio is playing through Bluetooth. -->
     <string name="volume_music_hint_playing_through_bluetooth">Playing through Bluetooth</string>
+    <!-- Hint shown in the volume toast to inform the user that the current ringtone is the silent ringtone. -->
+    <string name="volume_music_hint_silent_ringtone_selected">Silent ringtone selected</string>
     <!-- Title of the dialog where the user is adjusting the phone call volume -->
     <string name="volume_call">In-call volume</string>
     <!-- Title of the dialog where the user is adjusting the phone call volume when connected on bluetooth-->
diff --git a/libs/rs/java/Rollo/res/raw/calendar.png b/libs/rs/java/Rollo/res/raw/calendar.png
new file mode 100644
index 0000000..030ae73
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/calendar.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/g1155.png b/libs/rs/java/Rollo/res/raw/g1155.png
new file mode 100644
index 0000000..68e1843
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/g1155.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/g2140.png b/libs/rs/java/Rollo/res/raw/g2140.png
new file mode 100644
index 0000000..8c4e853
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/g2140.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path1920.png b/libs/rs/java/Rollo/res/raw/path1920.png
new file mode 100644
index 0000000..3510665
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path1920.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path1927.png b/libs/rs/java/Rollo/res/raw/path1927.png
new file mode 100644
index 0000000..fccc846
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path1927.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path3099.png b/libs/rs/java/Rollo/res/raw/path3099.png
new file mode 100644
index 0000000..527ebf6
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path3099.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path3950.png b/libs/rs/java/Rollo/res/raw/path3950.png
new file mode 100644
index 0000000..59a646a
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path3950.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path431.png b/libs/rs/java/Rollo/res/raw/path431.png
new file mode 100644
index 0000000..5d2ed75
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path431.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path4481.png b/libs/rs/java/Rollo/res/raw/path4481.png
new file mode 100644
index 0000000..78be0fc
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path4481.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path5168.png b/libs/rs/java/Rollo/res/raw/path5168.png
new file mode 100644
index 0000000..a7c3a19
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path5168.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path676.png b/libs/rs/java/Rollo/res/raw/path676.png
new file mode 100644
index 0000000..2099690
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path676.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path754.png b/libs/rs/java/Rollo/res/raw/path754.png
new file mode 100644
index 0000000..88aed5b
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path754.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/path815.png b/libs/rs/java/Rollo/res/raw/path815.png
new file mode 100644
index 0000000..407570f
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/path815.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/polygon2408.png b/libs/rs/java/Rollo/res/raw/polygon2408.png
new file mode 100644
index 0000000..4413954
--- /dev/null
+++ b/libs/rs/java/Rollo/res/raw/polygon2408.png
Binary files differ
diff --git a/libs/rs/java/Rollo/res/raw/rollo.c b/libs/rs/java/Rollo/res/raw/rollo.c
index 960fdf0..9e03a44 100644
--- a/libs/rs/java/Rollo/res/raw/rollo.c
+++ b/libs/rs/java/Rollo/res/raw/rollo.c
@@ -19,6 +19,7 @@
 #define STATE_COUNT             8
 #define STATE_TOUCH             9
 
+
 float filter(float val, float target, float str)
 {
     float delta = (target - val);
@@ -63,7 +64,7 @@
     float drawRot = filter(loadF(2, SCRATCH_ROT), targetRot, 0.1f * touchCut);
     storeF(2, SCRATCH_ROT, drawRot);
 
-    float diam = 10.f;
+    float diam = 8.f;
     float scale = 1.0f / zoom;
 
     // Bug makes 1.0f alpha fail.
@@ -77,6 +78,7 @@
     while (iconCount) {
         float tmpSin = sinf(rot);
         float tmpCos = cosf(rot);
+            //debugF("rot", rot);
 
         float tx1 = tmpSin * diam - (tmpCos * scale);
         float tx2 = tx1 + (tmpCos * scale * 2.f);
@@ -85,7 +87,7 @@
 
         int y;
         for (y = rowCount -1; (y >= 0) && iconCount; y--) {
-            float ty1 = ((y * 3.5f) - 6.f) * scale;
+            float ty1 = ((y * 3.1f) - 5.f) * scale;
             float ty2 = ty1 + scale * 2.f;
             bindTexture(NAMED_PF, 0, loadI32(1, index));
             //if (done && (index != selectedID)) {
@@ -102,6 +104,51 @@
         rot = rot + rotStep;
     }
 
+    if ((zoom < 1.1f) && (zoom > 0.9f)) {
+        bindProgramVertex(NAMED_PVOrtho);
+        bindProgramFragment(NAMED_PFText);
+        bindProgramFragmentStore(NAMED_PFSText);
+
+        rot = drawRot * scale;
+        index = 0;
+        iconCount = loadI32(0, STATE_COUNT);
+        while (iconCount) {
+            int y;
+
+            float tx = 240.f + floorf(sinf(rot) * 430.f) - 64.f + 16.f;
+
+            float alpha = 2.4f - (fabsf(tx - 240.f + 48.f) / 76.f);
+            if (alpha > 0.99f) {
+                alpha = 0.99f;
+            }
+            alpha = alpha * (1.f - (fabsf(zoom - 1.f) * 10.f));
+
+            tx = tx + 0.25f;
+
+            for (y = rowCount -1; (y >= 0) && iconCount; y--) {
+
+                if (alpha > 0) {
+                    color(1.0f, 1.0f, 1.0f, alpha);
+
+                    float ty = 605.f - y * 150.f;
+
+                    ty = ty + 0.25f;
+
+                    bindTexture(NAMED_PFText, 0, loadI32(3, index));
+                    drawRect(tx, ty, tx + 128.f, ty + 32.f, 0.5f);
+                }
+                iconCount--;
+                index++;
+            }
+            rot = rot + rotStep;
+        }
+
+
+        bindProgramVertex(NAMED_PV);
+        bindProgramFragment(NAMED_PF);
+        bindProgramFragmentStore(NAMED_PFS);
+    }
+
     // Draw the selected icon
     color(1.0f, 1.0f, 1.0f, 0.9f);
     rot = drawRot * scale;
@@ -119,7 +166,7 @@
                 float tz1 = tmpCos * diam * 0.9f + tmpSin * 2.f;
                 float tz2 = tz1 - (tmpSin * 4.f);
 
-                float ty1 = ((y * 3.5f) - 5.f) * scale;
+                float ty1 = ((y * 3.1f) - 4.5f) * scale;
                 float ty2 = ty1 + scale * 4.f;
                 bindTexture(NAMED_PF, 0, loadI32(1, index));
                 drawQuad(tx1, ty1, tz1,
diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java
index 14afaf8..520e3e4 100644
--- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java
+++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java
@@ -26,8 +26,11 @@
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
+import android.graphics.Canvas;
+import android.graphics.Paint;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
+import android.graphics.Typeface;
 import android.os.Handler;
 import android.os.Message;
 import android.util.AttributeSet;
@@ -57,6 +60,8 @@
     public void init(RenderScript rs, Resources res, int width, int height) {
         mRS = rs;
         mRes = res;
+        mWidth = width;
+        mHeight = height;
         initNamed();
         initRS();
     }
@@ -79,26 +84,32 @@
     }
 
     public void setSelected(int index) {
-        Log.e("rs",  "setSelected " + Integer.toString(index));
+        //Log.e("rs",  "setSelected " + Integer.toString(index));
 
         mAllocStateBuf[STATE_SELECTION] = index;
         mAllocStateBuf[STATE_DONE] = 1;
         mAllocState.data(mAllocStateBuf);
     }
 
+    private int mWidth;
+    private int mHeight;
 
     private Resources mRes;
     private RenderScript mRS;
     private RenderScript.Script mScript;
     private RenderScript.Sampler mSampler;
+    private RenderScript.Sampler mSamplerText;
     private RenderScript.ProgramFragmentStore mPFSBackground;
+    private RenderScript.ProgramFragmentStore mPFSText;
     private RenderScript.ProgramFragment mPFBackground;
     private RenderScript.ProgramFragment mPFImages;
+    private RenderScript.ProgramFragment mPFText;
     private RenderScript.ProgramVertex mPV;
     private ProgramVertexAlloc mPVAlloc;
     private RenderScript.ProgramVertex mPVOrtho;
     private ProgramVertexAlloc mPVOrthoAlloc;
     private RenderScript.Allocation[] mIcons;
+    private RenderScript.Allocation[] mLabels;
     private RenderScript.Allocation mIconPlate;
     private RenderScript.Allocation mBackground;
 
@@ -108,6 +119,9 @@
     private int[] mAllocIconIDBuf;
     private RenderScript.Allocation mAllocIconID;
 
+    private int[] mAllocLabelIDBuf;
+    private RenderScript.Allocation mAllocLabelID;
+
     private int[] mAllocScratchBuf;
     private RenderScript.Allocation mAllocScratch;
 
@@ -123,6 +137,17 @@
                        RenderScript.SamplerValue.CLAMP);
         mSampler = mRS.samplerCreate();
 
+        mRS.samplerBegin();
+        mRS.samplerSet(RenderScript.SamplerParam.FILTER_MIN,
+                       RenderScript.SamplerValue.NEAREST);
+        mRS.samplerSet(RenderScript.SamplerParam.FILTER_MAG,
+                       RenderScript.SamplerValue.NEAREST);
+        mRS.samplerSet(RenderScript.SamplerParam.WRAP_MODE_S,
+                       RenderScript.SamplerValue.CLAMP);
+        mRS.samplerSet(RenderScript.SamplerParam.WRAP_MODE_T,
+                       RenderScript.SamplerValue.CLAMP);
+        mSamplerText = mRS.samplerCreate();
+
 
         mRS.programFragmentBegin(null, null);
         mRS.programFragmentSetTexEnable(0, true);
@@ -131,6 +156,13 @@
         mPFImages.setName("PF");
         mPFImages.bindSampler(mSampler, 0);
 
+        mRS.programFragmentBegin(null, null);
+        mRS.programFragmentSetTexEnable(0, true);
+        mRS.programFragmentSetTexEnvMode(0, RenderScript.EnvMode.MODULATE);
+        mPFText = mRS.programFragmentCreate();
+        mPFText.setName("PFText");
+        mPFText.bindSampler(mSamplerText, 0);
+
         mRS.programFragmentStoreBegin(null, null);
         mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.LESS);
         mRS.programFragmentStoreDitherEnable(false);
@@ -140,13 +172,22 @@
         mPFSBackground = mRS.programFragmentStoreCreate();
         mPFSBackground.setName("PFS");
 
+        mRS.programFragmentStoreBegin(null, null);
+        mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS);
+        mRS.programFragmentStoreDitherEnable(false);
+        mRS.programFragmentStoreDepthMask(false);
+        mRS.programFragmentStoreBlendFunc(RenderScript.BlendSrcFunc.SRC_ALPHA,
+                                          RenderScript.BlendDstFunc.ONE_MINUS_SRC_ALPHA);
+        mPFSText = mRS.programFragmentStoreCreate();
+        mPFSText.setName("PFSText");
+
         mPVAlloc = new ProgramVertexAlloc(mRS);
         mRS.programVertexBegin(null, null);
         mRS.programVertexSetTextureMatrixEnable(false);
         mPV = mRS.programVertexCreate();
         mPV.setName("PV");
         mPV.bindAllocation(0, mPVAlloc.mAlloc);
-        mPVAlloc.setupProjectionNormalized(320, 480);
+        mPVAlloc.setupProjectionNormalized(mWidth, mHeight);
 
         mPVOrthoAlloc = new ProgramVertexAlloc(mRS);
         mRS.programVertexBegin(null, null);
@@ -154,7 +195,7 @@
         mPVOrtho = mRS.programVertexCreate();
         mPVOrtho.setName("PVOrtho");
         mPVOrtho.bindAllocation(0, mPVOrthoAlloc.mAlloc);
-        mPVOrthoAlloc.setupOrthoWindow(320, 480);
+        mPVOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
 
         mRS.contextBindProgramVertex(mPV);
 
@@ -176,6 +217,11 @@
             mAllocIconID = mRS.allocationCreatePredefSized(
                 RenderScript.ElementPredefined.USER_I32, mAllocIconIDBuf.length);
 
+            mLabels = new RenderScript.Allocation[29];
+            mAllocLabelIDBuf = new int[mLabels.length];
+            mAllocLabelID = mRS.allocationCreatePredefSized(
+                RenderScript.ElementPredefined.USER_I32, mLabels.length);
+
 
             Bitmap b;
             BitmapFactory.Options opts = new BitmapFactory.Options();
@@ -187,110 +233,123 @@
 
 
             b = BitmapFactory.decodeResource(mRes, R.raw.browser, opts);
-            mIcons[0] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mIcons[0] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true);
+            mLabels[0] = makeTextBitmap("browser");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.market, opts);
-            mIcons[1] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mIcons[1] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true);
+            mLabels[1] = makeTextBitmap("market");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.photos, opts);
-            mIcons[2] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mIcons[2] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true);
+            mLabels[2] = makeTextBitmap("photos");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.settings, opts);
-            mIcons[3] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mIcons[3] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true);
+            mLabels[3] = makeTextBitmap("settings");
 
-/*
-            b = BitmapFactory.decodeResource(mRes, R.raw.assasins_creed, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.calendar, opts);
             mIcons[4] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[4] = makeTextBitmap("creed");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.bankofamerica, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.g1155, opts);
             mIcons[5] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[5] = makeTextBitmap("BOA");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.chess, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.g2140, opts);
             mIcons[6] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[6] = makeTextBitmap("chess");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.dictionary, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.maps, opts);
             mIcons[7] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[7] = makeTextBitmap("Dictionary");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.facebook, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path431, opts);
             mIcons[8] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[8] = makeTextBitmap("facebook");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.flashlight, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path676, opts);
             mIcons[9] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[9] = makeTextBitmap("Flash Light");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.flight_control, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path754, opts);
             mIcons[10] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[10] = makeTextBitmap("Flight Control");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.google_earth, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path815, opts);
             mIcons[11] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[11] = makeTextBitmap("google earth");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.harry_potter, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path1920, opts);
             mIcons[12] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[12] = makeTextBitmap("Harry Potter");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.movies, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path1927, opts);
             mIcons[13] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[13] = makeTextBitmap("Movies");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.nytimes, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path3099, opts);
             mIcons[14] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[14] = makeTextBitmap("NY Times");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.pandora, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path3950, opts);
             mIcons[15] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[15] = makeTextBitmap("Pandora");
 
-
-
-            b = BitmapFactory.decodeResource(mRes, R.raw.public_radio, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path4481, opts);
             mIcons[16] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[16] = makeTextBitmap("Public Radio");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.shazam, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.path5168, opts);
             mIcons[17] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[17] = makeTextBitmap("Public Radio");
 
-            b = BitmapFactory.decodeResource(mRes, R.raw.skype, opts);
+            b = BitmapFactory.decodeResource(mRes, R.raw.polygon2408, opts);
             mIcons[18] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[18] = makeTextBitmap("Public Radio");
 
+            /*
             b = BitmapFactory.decodeResource(mRes, R.raw.solitaire, opts);
             mIcons[19] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[19] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.sudoku, opts);
             mIcons[20] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[20] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.taptaprevenge, opts);
             mIcons[21] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[21] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.tetris, opts);
             mIcons[22] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[22] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.tictactoe, opts);
             mIcons[23] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[23] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.tweetie, opts);
             mIcons[24] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[24] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.urbanspoon, opts);
             mIcons[25] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[25] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.waterslide_extreme, opts);
             mIcons[26] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[26] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.weather_channel, opts);
             mIcons[27] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[27] = makeTextBitmap("Public Radio");
 
             b = BitmapFactory.decodeResource(mRes, R.raw.zippo, opts);
             mIcons[28] = mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGB_565, true);
+            mLabels[28] = makeTextBitmap("Public Radio");
 */
-            mIcons[4] =  mIcons[3];
-            mIcons[5] =  mIcons[2];
-            mIcons[6] =  mIcons[1];
-            mIcons[7] =  mIcons[0];
-            mIcons[8] =  mIcons[1];
-            mIcons[9] =  mIcons[2];
-            mIcons[10] = mIcons[3];
-            mIcons[11] = mIcons[2];
-            mIcons[12] = mIcons[1];
-            mIcons[13] = mIcons[0];
-            mIcons[14] = mIcons[1];
-            mIcons[15] = mIcons[2];
-            mIcons[16] = mIcons[3];
-            mIcons[17] = mIcons[2];
-            mIcons[18] = mIcons[1];
+
             mIcons[19] = mIcons[0];
             mIcons[20] = mIcons[1];
             mIcons[21] = mIcons[2];
@@ -302,13 +361,26 @@
             mIcons[27] = mIcons[2];
             mIcons[28] = mIcons[3];
 
+            mLabels[19] = mLabels[0];
+            mLabels[20] = mLabels[1];
+            mLabels[21] = mLabels[2];
+            mLabels[22] = mLabels[3];
+            mLabels[23] = mLabels[2];
+            mLabels[24] = mLabels[1];
+            mLabels[25] = mLabels[0];
+            mLabels[26] = mLabels[1];
+            mLabels[27] = mLabels[2];
+            mLabels[28] = mLabels[3];
 
 
             for(int ct=0; ct < mIcons.length; ct++) {
                 mIcons[ct].uploadToTexture(0);
+                mLabels[ct].uploadToTexture(0);
                 mAllocIconIDBuf[ct] = mIcons[ct].getID();
+                mAllocLabelIDBuf[ct] = mLabels[ct].getID();
             }
             mAllocIconID.data(mAllocIconIDBuf);
+            mAllocLabelID.data(mAllocLabelIDBuf);
 
             RenderScript.Element e = mRS.elementGetPredefined(RenderScript.ElementPredefined.RGB_565);
             mRS.typeBegin(e);
@@ -341,10 +413,15 @@
 
     }
 
-    private void makeTextBitmap() {
-        //Bitmap.createBitmap(width, height, Bitmap.Config);
-        //new Canvas(theBitmap);
-        //canvas.drawText();
+    RenderScript.Allocation makeTextBitmap(String t) {
+        Bitmap b = Bitmap.createBitmap(128, 32, Bitmap.Config.ARGB_8888);
+        Canvas c = new Canvas(b);
+        Paint p = new Paint();
+        p.setTypeface(Typeface.DEFAULT_BOLD);
+        p.setTextSize(16);
+        p.setColor(0xffffffff);
+        c.drawText(t, 2, 20, p);
+        return mRS.allocationCreateFromBitmap(b, RenderScript.ElementPredefined.RGBA_8888, true);
     }
 
 
@@ -363,6 +440,7 @@
         mScript.bindAllocation(mAllocState, 0);
         mScript.bindAllocation(mAllocIconID, 1);
         mScript.bindAllocation(mAllocScratch, 2);
+        mScript.bindAllocation(mAllocLabelID, 3);
         setPosition(0);
         setZoom(1);
 
diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java
index 27f1584..71d6c7e 100644
--- a/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java
+++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloView.java
@@ -90,8 +90,8 @@
         if(c > (mColumns -2)) {
             c = (mColumns -2);
         }
-        if(c < 1) {
-            c = 1;
+        if(c < 0) {
+            c = 0;
         }
         mRender.setPosition(c);
         if(clamp) {
@@ -101,11 +101,11 @@
 
     void computeSelection(float x, float y)
     {
-        float col = mColumn + (x - 0.5f) * 4 + 1;
+        float col = mColumn + (x - 0.5f) * 4 + 1.25f;
         int iCol = (int)(col + 0.25f);
 
         float row = (y / 0.8f) * mRows;
-        int iRow = (int)(row - 0.25f);
+        int iRow = (int)(row - 0.5f);
 
         mRender.setSelected(iCol * mRows + iRow);
     }
@@ -122,6 +122,9 @@
         float nx = ev.getX() / getWidth();
         float ny = ev.getY() / getHeight();
 
+        //Log.e("rs", "width=" + Float.toString(getWidth()));
+        //Log.e("rs", "height=" + Float.toString(getHeight()));
+
         mRender.setTouch(ret);
 
         if((ny > 0.85f) || mControlMode) {
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index a2e3babc..c6a9149 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -204,12 +204,12 @@
     uint32_t w = out.getDimX();
     uint32_t h = out.getDimY();
 
-    for (uint32_t y=0; y < w; y++) {
+    for (uint32_t y=0; y < h; y++) {
         uint16_t *oPtr = static_cast<uint16_t *>(out.getElement(0, y));
         const uint16_t *i1 = static_cast<uint16_t *>(in.getElement(0, y*2));
         const uint16_t *i2 = static_cast<uint16_t *>(in.getElement(0, y*2+1));
 
-        for (uint32_t x=0; x < h; x++) {
+        for (uint32_t x=0; x < w; x++) {
             *oPtr = rsBoxFilter565(i1[0], i1[1], i2[0], i2[1]);
             oPtr ++;
             i1 += 2;
@@ -223,21 +223,33 @@
     uint32_t w = out.getDimX();
     uint32_t h = out.getDimY();
 
-    for (uint32_t y=0; y < w; y++) {
+    for (uint32_t y=0; y < h; y++) {
         uint32_t *oPtr = static_cast<uint32_t *>(out.getElement(0, y));
         const uint32_t *i1 = static_cast<uint32_t *>(in.getElement(0, y*2));
         const uint32_t *i2 = static_cast<uint32_t *>(in.getElement(0, y*2+1));
 
-        for (uint32_t x=0; x < h; x++) {
+        for (uint32_t x=0; x < w; x++) {
             *oPtr = rsBoxFilter8888(i1[0], i1[1], i2[0], i2[1]);
             oPtr ++;
             i1 += 2;
             i2 += 2;
         }
     }
-
 }
 
+static void mip(const Adapter2D &out, const Adapter2D &in)
+{
+    switch(out.getBaseType()->getElement()->getSizeBits()) {
+    case 32:
+        mip8888(out, in);
+        break;
+    case 16:
+        mip565(out, in);
+        break;
+
+    }
+
+}
 
 typedef void (*ElementConverter_t)(void *dst, const void *src, uint32_t count);
 
@@ -337,7 +349,7 @@
         for(uint32_t lod=0; lod < (texAlloc->getType()->getLODCount() -1); lod++) {
             adapt.setLOD(lod);
             adapt2.setLOD(lod + 1);
-            mip565(adapt2, adapt);
+            mip(adapt2, adapt);
         }
     }
 
@@ -482,11 +494,7 @@
         for(uint32_t lod=0; lod < (texAlloc->getType()->getLODCount() -1); lod++) {
             adapt.setLOD(lod);
             adapt2.setLOD(lod + 1);
-            if (use32bpp) {
-                mip8888(adapt2, adapt);
-            } else {
-                mip565(adapt2, adapt);
-            }
+            mip(adapt2, adapt);
         }
     }
 
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 10d1120..41219064 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -356,6 +356,15 @@
     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
 }
 
+static void SC_drawRect(float x1, float y1,
+                        float x2, float y2, float z)
+{
+    SC_drawQuad(x1, y2, z,
+                x2, y2, z,
+                x2, y1, z,
+                x1, y1, z);
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -442,7 +451,7 @@
         "float", "(float)" },
     { "cosf", (void *)&cosf,
         "float", "(float)" },
-    { "fabs", (void *)&fabs,
+    { "fabsf", (void *)&fabsf,
         "float", "(float)" },
     { "randf", (void *)&SC_randf,
         "float", "(float)" },
@@ -496,6 +505,8 @@
 
 
     // drawing
+    { "drawRect", (void *)&SC_drawRect,
+        "void", "(float x1, float y1, float x2, float y2, float z)" },
     { "drawQuad", (void *)&SC_drawQuad,
         "void", "(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" },
     { "drawTriangleArray", (void *)&SC_drawTriangleArray,
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java
index 9e1a72c..aaac192 100755
--- a/location/java/com/android/internal/location/GpsLocationProvider.java
+++ b/location/java/com/android/internal/location/GpsLocationProvider.java
@@ -197,6 +197,10 @@
     // properties loaded from PROPERTIES_FILE
     private Properties mProperties;
     private String mNtpServer;
+    private String mSuplServerHost;
+    private int mSuplServerPort;
+    private String mC2KServerHost;
+    private int mC2KServerPort;
 
     private final Context mContext;
     private final ILocationManager mLocationManager;
@@ -348,23 +352,21 @@
             stream.close();
             mNtpServer = mProperties.getProperty("NTP_SERVER", null);
 
-            String host = mProperties.getProperty("SUPL_HOST");
+            mSuplServerHost = mProperties.getProperty("SUPL_HOST");
             String portString = mProperties.getProperty("SUPL_PORT");
-            if (host != null && portString != null) {
+            if (mSuplServerHost != null && portString != null) {
                 try {
-                    int port = Integer.parseInt(portString);
-                    native_set_agps_server(AGPS_TYPE_SUPL, host, port);
+                    mSuplServerPort = Integer.parseInt(portString);
                 } catch (NumberFormatException e) {
                     Log.e(TAG, "unable to parse SUPL_PORT: " + portString);
                 }
             }
 
-            host = mProperties.getProperty("C2K_HOST");
+            mC2KServerHost = mProperties.getProperty("C2K_HOST");
             portString = mProperties.getProperty("C2K_PORT");
-            if (host != null && portString != null) {
+            if (mC2KServerHost != null && portString != null) {
                 try {
-                    int port = Integer.parseInt(portString);
-                    native_set_agps_server(AGPS_TYPE_C2K, host, port);
+                    mC2KServerPort = Integer.parseInt(portString);
                 } catch (NumberFormatException e) {
                     Log.e(TAG, "unable to parse C2K_PORT: " + portString);
                 }
@@ -494,6 +496,13 @@
         mEnabled = native_init();
 
         if (mEnabled) {
+            if (mSuplServerHost != null) {
+                native_set_agps_server(AGPS_TYPE_SUPL, mSuplServerHost, mSuplServerPort);
+            }
+            if (mC2KServerHost != null) {
+                native_set_agps_server(AGPS_TYPE_C2K, mC2KServerHost, mC2KServerPort);
+            }
+
             // run event listener thread while we are enabled
             mEventThread = new GpsEventThread();
             mEventThread.start();
diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java
index 44026e4..8481410 100644
--- a/media/java/android/media/RingtoneManager.java
+++ b/media/java/android/media/RingtoneManager.java
@@ -605,21 +605,6 @@
             Log.e(TAG, "Failed to open ringtone " + ringtoneUri);
         }
 
-        // Ringtone doesn't exist, use the fallback ringtone.
-        try {
-            AssetFileDescriptor afd = context.getResources().openRawResourceFd(
-                    com.android.internal.R.raw.fallbackring);
-            if (afd != null) {
-                Ringtone r = new Ringtone(context);
-                r.open(afd);
-                afd.close();
-                return r;
-            }
-        } catch (Exception ex) {
-        }
-        
-        // we should never get here
-        Log.e(TAG, "unable to find a usable ringtone");
         return null;
     }
     
@@ -638,8 +623,8 @@
     public static Uri getActualDefaultRingtoneUri(Context context, int type) {
         String setting = getSettingForType(type);
         if (setting == null) return null;
-        final String uriString = Settings.System.getString(context.getContentResolver(), setting); 
-        return uriString != null ? Uri.parse(uriString) : getValidRingtoneUri(context);
+        final String uriString = Settings.System.getString(context.getContentResolver(), setting);
+        return uriString != null ? Uri.parse(uriString) : null;
     }
     
     /**
@@ -655,7 +640,8 @@
     public static void setActualDefaultRingtoneUri(Context context, int type, Uri ringtoneUri) {
         String setting = getSettingForType(type);
         if (setting == null) return;
-        Settings.System.putString(context.getContentResolver(), setting, ringtoneUri.toString());
+        Settings.System.putString(context.getContentResolver(), setting,
+                ringtoneUri != null ? ringtoneUri.toString() : null);
     }
     
     private static String getSettingForType(int type) {
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 1451682..9877342 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -24,9 +24,11 @@
 import android.content.ContentValues;
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.content.res.AssetFileDescriptor;
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
 import android.database.sqlite.SQLiteQueryBuilder;
+import android.media.Ringtone;
 import android.media.RingtoneManager;
 import android.net.Uri;
 import android.os.ParcelFileDescriptor;
@@ -397,12 +399,8 @@
             
             // Get the current value for the default sound
             Uri soundUri = RingtoneManager.getActualDefaultRingtoneUri(context, ringtoneType);
-            if (soundUri == null) {
-                // Fallback on any valid ringtone Uri
-                soundUri = RingtoneManager.getValidRingtoneUri(context);
-            }
 
-            if (soundUri != null) { 
+            if (soundUri != null) {
                 // Only proxy the openFile call to drm or media providers
                 String authority = soundUri.getAuthority();
                 boolean isDrmAuthority = authority.equals(DrmStore.AUTHORITY);
@@ -426,4 +424,64 @@
 
         return super.openFile(uri, mode);
     }
+
+    @Override
+    public AssetFileDescriptor openAssetFile(Uri uri, String mode) throws FileNotFoundException {
+
+        /*
+         * When a client attempts to openFile the default ringtone or
+         * notification setting Uri, we will proxy the call to the current
+         * default ringtone's Uri (if it is in the DRM or media provider).
+         */
+        int ringtoneType = RingtoneManager.getDefaultType(uri);
+        // Above call returns -1 if the Uri doesn't match a default type
+        if (ringtoneType != -1) {
+            Context context = getContext();
+
+            // Get the current value for the default sound
+            Uri soundUri = RingtoneManager.getActualDefaultRingtoneUri(context, ringtoneType);
+
+            if (soundUri != null) {
+                // Only proxy the openFile call to drm or media providers
+                String authority = soundUri.getAuthority();
+                boolean isDrmAuthority = authority.equals(DrmStore.AUTHORITY);
+                if (isDrmAuthority || authority.equals(MediaStore.AUTHORITY)) {
+
+                    if (isDrmAuthority) {
+                        try {
+                            // Check DRM access permission here, since once we
+                            // do the below call the DRM will be checking our
+                            // permission, not our caller's permission
+                            DrmStore.enforceAccessDrmPermission(context);
+                        } catch (SecurityException e) {
+                            throw new FileNotFoundException(e.getMessage());
+                        }
+                    }
+
+                    ParcelFileDescriptor pfd = null;
+                    try {
+                        pfd = context.getContentResolver().openFileDescriptor(soundUri, mode);
+                        return new AssetFileDescriptor(pfd, 0, -1);
+                    } catch (FileNotFoundException ex) {
+                        // fall through and open the fallback ringtone below
+                    }
+                }
+
+                try {
+                    return super.openAssetFile(soundUri, mode);
+                } catch (FileNotFoundException ex) {
+                    // Since a non-null Uri was specified, but couldn't be opened,
+                    // fall back to the built-in ringtone.
+                    return context.getResources().openRawResourceFd(
+                            com.android.internal.R.raw.fallbackring);
+                }
+            }
+            // no need to fall through and have openFile() try again, since we
+            // already know that will fail.
+            throw new FileNotFoundException(); // or return null ?
+        }
+
+        // Note that this will end up calling openFile() above.
+        return super.openAssetFile(uri, mode);
+    }
 }
diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
index aec7aee..dda0187 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java
@@ -1057,6 +1057,7 @@
                         onComplete.sendToTarget();
                     }
                 }
+                break;
 
                 default:{
                     throw new RuntimeException("unexpected event not handled");
diff --git a/test-runner/android/test/ProviderTestCase2.java b/test-runner/android/test/ProviderTestCase2.java
index ac17ebf..a923d2a 100644
--- a/test-runner/android/test/ProviderTestCase2.java
+++ b/test-runner/android/test/ProviderTestCase2.java
@@ -3,6 +3,7 @@
 import android.content.ContentProvider;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.res.Resources;
 import android.test.mock.MockContext;
 import android.test.mock.MockContentResolver;
 import android.database.DatabaseUtils;
@@ -26,6 +27,14 @@
     private IsolatedContext mProviderContext;
     private MockContentResolver mResolver;
 
+       private class MockContext2 extends MockContext {
+
+        @Override
+        public Resources getResources() {
+            return getContext().getResources();
+        }
+    }
+
     public ProviderTestCase2(Class<T> providerClass, String providerAuthority) {
         mProviderClass = providerClass;
         mProviderAuthority = providerAuthority;
@@ -47,7 +56,7 @@
         mResolver = new MockContentResolver();
         final String filenamePrefix = "test.";
         RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(
-                new MockContext(), // The context that most methods are delegated to
+                new MockContext2(), // The context that most methods are delegated to
                 getContext(), // The context that file methods are delegated to
                 filenamePrefix);
         mProviderContext = new IsolatedContext(mResolver, targetContextWrapper);