diff --git a/src/com/android/settings/DataUsageSummary.java b/src/com/android/settings/DataUsageSummary.java
index eb74788..87ce772 100644
--- a/src/com/android/settings/DataUsageSummary.java
+++ b/src/com/android/settings/DataUsageSummary.java
@@ -153,7 +153,8 @@
     private static final String TAB_WIFI = "wifi";
     private static final String TAB_ETHERNET = "ethernet";
 
-    private static final String TAG_CONFIRM_ROAMING = "confirmRoaming";
+    private static final String TAG_CONFIRM_DATA_DISABLE = "confirmDataDisable";
+    private static final String TAG_CONFIRM_DATA_ROAMING = "confirmDataRoaming";
     private static final String TAG_CONFIRM_LIMIT = "confirmLimit";
     private static final String TAG_CYCLE_EDITOR = "cycleEditor";
     private static final String TAG_CONFIRM_RESTRICT = "confirmRestrict";
@@ -485,6 +486,7 @@
             final LayoutTransition chartTransition = buildLayoutTransition();
             chartTransition.setStartDelay(LayoutTransition.APPEARING, 0);
             chartTransition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
+            chartTransition.setAnimator(LayoutTransition.DISAPPEARING, null);
             mChart.setLayoutTransition(chartTransition);
         }
     };
@@ -595,7 +597,6 @@
         if (TAB_MOBILE.equals(currentTab)) {
             setPreferenceTitle(mDataEnabledView, R.string.data_usage_enable_mobile);
             setPreferenceTitle(mDisableAtLimitView, R.string.data_usage_disable_mobile_limit);
-            mDataEnabled.setChecked(mConnService.getMobileDataEnabled());
             mTemplate = buildTemplateMobileAll(getActiveSubscriberId(context));
 
         } else if (TAB_3G.equals(currentTab)) {
@@ -799,6 +800,28 @@
         updatePolicy(false);
     }
 
+    /**
+     * Local cache of value, used to work around delay when
+     * {@link ConnectivityManager#setMobileDataEnabled(boolean)} is async.
+     */
+    private Boolean mMobileDataEnabled;
+
+    private boolean isMobileDataEnabled() {
+        if (mMobileDataEnabled != null) {
+            // TODO: deprecate and remove this once enabled flag is on policy
+            return mMobileDataEnabled;
+        } else {
+            return mConnService.getMobileDataEnabled();
+        }
+    }
+
+    private void setMobileDataEnabled(boolean enabled) {
+        if (LOGD) Log.d(TAG, "setMobileDataEnabled()");
+        mConnService.setMobileDataEnabled(enabled);
+        mMobileDataEnabled = enabled;
+        updatePolicy(false);
+    }
+
     private boolean isNetworkPolicyModifiable(NetworkPolicy policy) {
         return policy != null && isBandwidthControlEnabled() && mDataEnabled.isChecked();
     }
@@ -888,6 +911,13 @@
             }
         }
 
+        // TODO: move enabled state directly into policy
+        if (TAB_MOBILE.equals(mCurrentTab)) {
+            mBinding = true;
+            mDataEnabled.setChecked(isMobileDataEnabled());
+            mBinding = false;
+        }
+
         final NetworkPolicy policy = mPolicyEditor.getPolicy(mTemplate);
         if (isNetworkPolicyModifiable(policy)) {
             mDisableAtLimitView.setVisibility(View.VISIBLE);
@@ -979,15 +1009,18 @@
             if (mBinding) return;
 
             final boolean dataEnabled = isChecked;
-            mDataEnabled.setChecked(dataEnabled);
-
             final String currentTab = mCurrentTab;
             if (TAB_MOBILE.equals(currentTab)) {
-                mConnService.setMobileDataEnabled(dataEnabled);
+                if (dataEnabled) {
+                    setMobileDataEnabled(true);
+                } else {
+                    // disabling data; show confirmation dialog which eventually
+                    // calls setMobileDataEnabled() once user confirms.
+                    ConfirmDataDisableFragment.show(DataUsageSummary.this);
+                }
             }
 
-            // rebind policy to match radio state
-            updatePolicy(true);
+            updatePolicy(false);
         }
     };
 
@@ -1358,14 +1391,14 @@
         public View getView(int position, View convertView, ViewGroup parent) {
             if (convertView == null) {
                 convertView = LayoutInflater.from(parent.getContext()).inflate(
-                        R.layout.data_usage_item, parent, false);
+                        R.layout.app_percentage_item, parent, false);
             }
 
             final Context context = parent.getContext();
 
             final ImageView icon = (ImageView) convertView.findViewById(android.R.id.icon);
             final TextView title = (TextView) convertView.findViewById(android.R.id.title);
-            final TextView summary = (TextView) convertView.findViewById(android.R.id.summary);
+            final TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
             final ProgressBar progress = (ProgressBar) convertView.findViewById(
                     android.R.id.progress);
 
@@ -1374,7 +1407,7 @@
 
             icon.setImageDrawable(detail.icon);
             title.setText(detail.label);
-            summary.setText(Formatter.formatFileSize(context, item.total));
+            text1.setText(Formatter.formatFileSize(context, item.total));
 
             final int percentTotal = mLargest != 0 ? (int) (item.total * 100 / mLargest) : 0;
             progress.setProgress(percentTotal);
@@ -1545,6 +1578,38 @@
     }
 
     /**
+     * Dialog to request user confirmation before disabling data.
+     */
+    public static class ConfirmDataDisableFragment extends DialogFragment {
+        public static void show(DataUsageSummary parent) {
+            final ConfirmDataDisableFragment dialog = new ConfirmDataDisableFragment();
+            dialog.setTargetFragment(parent, 0);
+            dialog.show(parent.getFragmentManager(), TAG_CONFIRM_DATA_DISABLE);
+        }
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            final Context context = getActivity();
+
+            final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+            builder.setMessage(R.string.data_usage_disable_mobile);
+
+            builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int which) {
+                    final DataUsageSummary target = (DataUsageSummary) getTargetFragment();
+                    if (target != null) {
+                        // TODO: extend to modify policy enabled flag.
+                        target.setMobileDataEnabled(false);
+                    }
+                }
+            });
+            builder.setNegativeButton(android.R.string.cancel, null);
+
+            return builder.create();
+        }
+    }
+
+    /**
      * Dialog to request user confirmation before setting
      * {@link Settings.Secure#DATA_ROAMING}.
      */
@@ -1552,7 +1617,7 @@
         public static void show(DataUsageSummary parent) {
             final ConfirmDataRoamingFragment dialog = new ConfirmDataRoamingFragment();
             dialog.setTargetFragment(parent, 0);
-            dialog.show(parent.getFragmentManager(), TAG_CONFIRM_ROAMING);
+            dialog.show(parent.getFragmentManager(), TAG_CONFIRM_DATA_ROAMING);
         }
 
         @Override
diff --git a/src/com/android/settings/fuelgauge/PercentageBar.java b/src/com/android/settings/fuelgauge/PercentageBar.java
deleted file mode 100644
index 1c4478b..0000000
--- a/src/com/android/settings/fuelgauge/PercentageBar.java
+++ /dev/null
@@ -1,67 +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.
- */
-
-package com.android.settings.fuelgauge;
-
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.PixelFormat;
-import android.graphics.drawable.Drawable;
-
-/**
- * A drawable for drawing a bar with a background.
- */
-class PercentageBar extends Drawable {
-
-    Drawable bar;
-    double percent;
-    int lastWidth = -1;
-
-    @Override
-    public void draw(Canvas canvas) {
-        if (lastWidth == -1) {
-            lastWidth = getBarWidth();
-            bar.setBounds(0, 0, lastWidth, bar.getIntrinsicHeight());
-        }
-        bar.draw(canvas);
-    }
-
-    @Override
-    public int getOpacity() {
-        return PixelFormat.TRANSLUCENT;
-    }
-
-    @Override
-    public void setAlpha(int alpha) {
-        // Ignore
-    }
-
-    @Override
-    public void setColorFilter(ColorFilter cf) {
-        // Ignore
-    }
-
-    private int getBarWidth() {
-        int width = (int) ((this.getBounds().width() * percent) / 100);
-        int intrinsicWidth = bar.getIntrinsicWidth();
-        return Math.max(width, intrinsicWidth);
-    }
-
-    @Override
-    public int getIntrinsicHeight() {
-        return bar.getIntrinsicHeight();
-    }
-}
diff --git a/src/com/android/settings/fuelgauge/PowerGaugePreference.java b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
index 00e397e..7b11ae1 100644
--- a/src/com/android/settings/fuelgauge/PowerGaugePreference.java
+++ b/src/com/android/settings/fuelgauge/PowerGaugePreference.java
@@ -20,70 +20,46 @@
 import android.graphics.drawable.Drawable;
 import android.preference.Preference;
 import android.view.View;
-import android.widget.ImageView;
+import android.widget.ProgressBar;
 import android.widget.TextView;
 
 import com.android.settings.R;
 
 /**
- * Custom preference for displaying power consumption as a bar and an icon on the left for the
- * subsystem/app type.
- *
+ * Custom preference for displaying power consumption as a bar and an icon on
+ * the left for the subsystem/app type.
  */
 public class PowerGaugePreference extends Preference {
-
-    private Drawable mIcon;
-    private PercentageBar mGauge;
-    private double mValue;
     private BatterySipper mInfo;
-    private double mPercent;
+    private int mProgress;
+    private CharSequence mProgressText;
 
     public PowerGaugePreference(Context context, Drawable icon, BatterySipper info) {
         super(context);
-        setLayoutResource(R.layout.preference_powergauge);
-        mIcon = icon;
-        mGauge = new PercentageBar();
-        mGauge.bar = context.getResources().getDrawable(R.drawable.app_gauge);
+        setLayoutResource(R.layout.app_percentage_item);
+        setIcon(icon);
         mInfo = info;
     }
 
-    /**
-     * Sets the width of the gauge in percentage (0 - 100)
-     * @param percent
-     */
-    void setGaugeValue(double percent) {
-        mValue = percent;
-        mGauge.percent = mValue;
-    }
-
-    void setPercent(double percent) {
-        mPercent = percent;
+    public void setPercent(double percentOfMax, double percentOfTotal) {
+        mProgress = (int) Math.ceil(percentOfMax);
+        mProgressText = getContext().getResources().getString(
+                R.string.percentage, (int) Math.ceil(percentOfTotal));
+        notifyChanged();
     }
 
     BatterySipper getInfo() {
         return mInfo;
     }
 
-    void setPowerIcon(Drawable icon) {
-        mIcon = icon;
-        notifyChanged();
-    }
-
     @Override
     protected void onBindView(View view) {
         super.onBindView(view);
 
-        ImageView appIcon = (ImageView) view.findViewById(R.id.appIcon);
-        if (mIcon == null) {
-            mIcon = getContext().getResources().getDrawable(android.R.drawable.sym_def_app_icon);
-        }
-        appIcon.setImageDrawable(mIcon);
+        final ProgressBar progress = (ProgressBar) view.findViewById(android.R.id.progress);
+        progress.setProgress(mProgress);
 
-        ImageView appGauge = (ImageView) view.findViewById(R.id.appGauge);
-        appGauge.setImageDrawable(mGauge);
-
-        TextView percentView = (TextView) view.findViewById(R.id.percent);
-        percentView.setText((int) (Math.ceil(mPercent)) + "%");
+        final TextView text1 = (TextView) view.findViewById(android.R.id.text1);
+        text1.setText(mProgressText);
     }
-
 }
diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
index b70312b..e6552ce 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
@@ -41,6 +41,7 @@
 import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.ImageView;
+import android.widget.ProgressBar;
 import android.widget.TextView;
 
 import com.android.settings.DisplaySettings;
@@ -116,7 +117,6 @@
     private ViewGroup mControlsParent;
     private long mStartTime;
     private DrainType mDrainType;
-    private PercentageBar mGauge;
     private Drawable mAppIcon;
     private double mNoCoverage; // Percentage of time that there was no coverage
 
@@ -181,30 +181,29 @@
         }
 
         // Set the description
-        String summary = getDescriptionForDrainType();
-        ((TextView)mRootView.findViewById(R.id.summary)).setText(summary);
-        
+        final TextView summary = (TextView) mRootView.findViewById(android.R.id.summary);
+        summary.setText(getDescriptionForDrainType());
+        summary.setVisibility(View.VISIBLE);
+
         mTypes = args.getIntArray(EXTRA_DETAIL_TYPES);
         mValues = args.getDoubleArray(EXTRA_DETAIL_VALUES);
 
-        mTitleView = (TextView)mRootView.findViewById(R.id.name);
+        mTitleView = (TextView) mRootView.findViewById(android.R.id.title);
         mTitleView.setText(mTitle);
-        ((TextView)mRootView.findViewById(R.id.battery_percentage))
-            .setText(String.format("%d%%", percentage));
+
+        final TextView text1 = (TextView)mRootView.findViewById(android.R.id.text1);
+        text1.setText(getString(R.string.percentage, percentage));
 
         mTwoButtonsPanel = (ViewGroup)mRootView.findViewById(R.id.two_buttons_panel);
         mForceStopButton = (Button)mRootView.findViewById(R.id.left_button);
         mReportButton = (Button)mRootView.findViewById(R.id.right_button);
         mForceStopButton.setEnabled(false);
-        
-        ImageView gaugeImage = (ImageView)mRootView.findViewById(R.id.gauge);
-        mGauge = new PercentageBar();
-        mGauge.percent = gaugeValue;
-        mGauge.bar = getResources().getDrawable(R.drawable.app_gauge);
-        gaugeImage.setImageDrawable(mGauge);
 
-        ImageView iconImage = (ImageView)mRootView.findViewById(R.id.icon);
-        iconImage.setImageDrawable(mAppIcon);
+        final ProgressBar progress = (ProgressBar) mRootView.findViewById(android.R.id.progress);
+        progress.setProgress(gaugeValue);
+
+        final ImageView icon = (ImageView) mRootView.findViewById(android.R.id.icon);
+        icon.setImageDrawable(mAppIcon);
 
         mDetailsParent = (ViewGroup)mRootView.findViewById(R.id.details);
         mControlsParent = (ViewGroup)mRootView.findViewById(R.id.controls);
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 32ba279..c24c5ea 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -23,7 +23,6 @@
 import android.hardware.SensorManager;
 import android.os.BatteryStats;
 import android.os.BatteryStats.Uid;
-import android.os.BatteryManager;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -382,12 +381,11 @@
             final double percentOfTotal =  ((sipper.getSortValue() / mTotalPower) * 100);
             if (percentOfTotal < 1) continue;
             PowerGaugePreference pref = new PowerGaugePreference(getActivity(), sipper.getIcon(), sipper);
-            double percentOfMax = (sipper.getSortValue() * 100) / mMaxPower;
+            final double percentOfMax = (sipper.getSortValue() * 100) / mMaxPower;
             sipper.percent = percentOfTotal;
             pref.setTitle(sipper.name);
-            pref.setPercent(percentOfTotal);
             pref.setOrder(Integer.MAX_VALUE - (int) sipper.getSortValue()); // Invert the order
-            pref.setGaugeValue(percentOfMax);
+            pref.setPercent(percentOfMax, percentOfTotal);
             if (sipper.uidObj != null) {
                 pref.setKey(Integer.toString(sipper.uidObj.getUid()));
             }
@@ -771,8 +769,7 @@
                             (PowerGaugePreference) findPreference(
                                     Integer.toString(bs.uidObj.getUid()));
                     if (pgp != null) {
-                        pgp.setPowerIcon(bs.icon);
-                        pgp.setPercent(bs.percent);
+                        pgp.setIcon(bs.icon);
                         pgp.setTitle(bs.name);
                     }
                     break;
diff --git a/src/com/android/settings/widget/ChartAxis.java b/src/com/android/settings/widget/ChartAxis.java
index 4e0da1d..d3d499c 100644
--- a/src/com/android/settings/widget/ChartAxis.java
+++ b/src/com/android/settings/widget/ChartAxis.java
@@ -35,8 +35,11 @@
     /** Convert screen point into raw value. */
     public long convertToValue(float point);
 
-    /** Build label that describes given raw value. */
-    public void buildLabel(Resources res, SpannableStringBuilder builder, long value);
+    /**
+     * Build label that describes given raw value. If the label is rounded for
+     * display, return the rounded value.
+     */
+    public long buildLabel(Resources res, SpannableStringBuilder builder, long value);
 
     /** Return list of tick points for drawing a grid. */
     public float[] getTickPoints();
diff --git a/src/com/android/settings/widget/ChartDataUsageView.java b/src/com/android/settings/widget/ChartDataUsageView.java
index 9554368..cad2ed8 100644
--- a/src/com/android/settings/widget/ChartDataUsageView.java
+++ b/src/com/android/settings/widget/ChartDataUsageView.java
@@ -27,7 +27,6 @@
 import android.text.TextUtils;
 import android.text.format.DateUtils;
 import android.util.AttributeSet;
-import android.view.Gravity;
 import android.view.MotionEvent;
 import android.view.View;
 
@@ -334,11 +333,11 @@
     }
 
     public long getWarningBytes() {
-        return mSweepWarning.getValue();
+        return mSweepWarning.getLabelValue();
     }
 
     public long getLimitBytes() {
-        return mSweepLimit.getValue();
+        return mSweepLimit.getLabelValue();
     }
 
     private long getStatsStart() {
@@ -433,9 +432,10 @@
         }
 
         /** {@inheritDoc} */
-        public void buildLabel(Resources res, SpannableStringBuilder builder, long value) {
+        public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
             // TODO: convert to better string
             builder.replace(0, builder.length(), Long.toString(value));
+            return value;
         }
 
         /** {@inheritDoc} */
@@ -493,16 +493,19 @@
         private static final Object sSpanUnit = new Object();
 
         /** {@inheritDoc} */
-        public void buildLabel(Resources res, SpannableStringBuilder builder, long value) {
+        public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
 
-            float result = value;
             final CharSequence unit;
+            float result = value;
+            long labelValue = 1;
             if (result <= 100 * MB_IN_BYTES) {
                 unit = res.getText(com.android.internal.R.string.megabyteShort);
                 result /= MB_IN_BYTES;
+                labelValue = MB_IN_BYTES;
             } else {
                 unit = res.getText(com.android.internal.R.string.gigabyteShort);
                 result /= GB_IN_BYTES;
+                labelValue = GB_IN_BYTES;
             }
 
             final CharSequence size;
@@ -511,11 +514,14 @@
             } else {
                 size = String.format("%.0f", result);
             }
+            labelValue *= Float.parseFloat(size.toString());
 
             final int[] sizeBounds = findOrCreateSpan(builder, sSpanSize, "^1");
             builder.replace(sizeBounds[0], sizeBounds[1], size);
             final int[] unitBounds = findOrCreateSpan(builder, sSpanUnit, "^2");
             builder.replace(unitBounds[0], unitBounds[1], unit);
+
+            return labelValue;
         }
 
         /** {@inheritDoc} */
diff --git a/src/com/android/settings/widget/ChartSweepView.java b/src/com/android/settings/widget/ChartSweepView.java
index 0d91a76..33e90c8 100644
--- a/src/com/android/settings/widget/ChartSweepView.java
+++ b/src/com/android/settings/widget/ChartSweepView.java
@@ -67,6 +67,7 @@
 
     private ChartAxis mAxis;
     private long mValue;
+    private long mLabelValue;
 
     private long mValidAfter;
     private long mValidBefore;
@@ -226,7 +227,7 @@
 
     private void invalidateLabel() {
         if (mLabelTemplate != null && mAxis != null) {
-            mAxis.buildLabel(getResources(), mLabelTemplate, mValue);
+            mLabelValue = mAxis.buildLabel(getResources(), mLabelTemplate, mValue);
             invalidate();
         }
     }
@@ -265,6 +266,10 @@
         return mValue;
     }
 
+    public long getLabelValue() {
+        return mLabelValue;
+    }
+
     public float getPoint() {
         if (isEnabled()) {
             return mAxis.convertToPoint(mValue);
diff --git a/src/com/android/settings/widget/InvertedChartAxis.java b/src/com/android/settings/widget/InvertedChartAxis.java
index 96aec7b..7dcc78a 100644
--- a/src/com/android/settings/widget/InvertedChartAxis.java
+++ b/src/com/android/settings/widget/InvertedChartAxis.java
@@ -52,8 +52,8 @@
     }
 
     /** {@inheritDoc} */
-    public void buildLabel(Resources res, SpannableStringBuilder builder, long value) {
-        mWrapped.buildLabel(res, builder, value);
+    public long buildLabel(Resources res, SpannableStringBuilder builder, long value) {
+        return mWrapped.buildLabel(res, builder, value);
     }
 
     /** {@inheritDoc} */
