diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2714457e8d4..03978cc756a 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -115,9 +115,8 @@
-
-
+
@@ -190,6 +189,7 @@
+
diff --git a/res/drawable/app_gauge.9.png b/res/drawable/app_gauge.9.png
index f8ff66982db..f6c7c990ee3 100644
Binary files a/res/drawable/app_gauge.9.png and b/res/drawable/app_gauge.9.png differ
diff --git a/res/drawable/widget_btn_bluetooth.png b/res/drawable/widget_btn_bluetooth.png
index 5de9d78f856..f32d0b266fb 100644
Binary files a/res/drawable/widget_btn_bluetooth.png and b/res/drawable/widget_btn_bluetooth.png differ
diff --git a/res/drawable/widget_btn_bluetooth_gray.png b/res/drawable/widget_btn_bluetooth_gray.png
index 843dccef75b..a633554d667 100644
Binary files a/res/drawable/widget_btn_bluetooth_gray.png and b/res/drawable/widget_btn_bluetooth_gray.png differ
diff --git a/res/drawable/widget_btn_bluetooth_off.png b/res/drawable/widget_btn_bluetooth_off.png
index b831a46bca0..c0ef641ed15 100644
Binary files a/res/drawable/widget_btn_bluetooth_off.png and b/res/drawable/widget_btn_bluetooth_off.png differ
diff --git a/res/drawable/widget_btn_brightness.png b/res/drawable/widget_btn_brightness.png
index a162899e218..9a7c7b91965 100644
Binary files a/res/drawable/widget_btn_brightness.png and b/res/drawable/widget_btn_brightness.png differ
diff --git a/res/drawable/widget_btn_brightness_off.png b/res/drawable/widget_btn_brightness_off.png
index 0f42f2dae97..46dc508ac9e 100644
Binary files a/res/drawable/widget_btn_brightness_off.png and b/res/drawable/widget_btn_brightness_off.png differ
diff --git a/res/drawable/widget_btn_gps.png b/res/drawable/widget_btn_gps.png
index 3394cb40b86..b21e8c8bff1 100644
Binary files a/res/drawable/widget_btn_gps.png and b/res/drawable/widget_btn_gps.png differ
diff --git a/res/drawable/widget_btn_gps_off.png b/res/drawable/widget_btn_gps_off.png
index 7f481d8be3b..042fefb0e65 100644
Binary files a/res/drawable/widget_btn_gps_off.png and b/res/drawable/widget_btn_gps_off.png differ
diff --git a/res/drawable/widget_btn_sync.png b/res/drawable/widget_btn_sync.png
index 9682879e373..6133233d372 100644
Binary files a/res/drawable/widget_btn_sync.png and b/res/drawable/widget_btn_sync.png differ
diff --git a/res/drawable/widget_btn_sync_off.png b/res/drawable/widget_btn_sync_off.png
index 0f48a1d2e87..192cad88d73 100644
Binary files a/res/drawable/widget_btn_sync_off.png and b/res/drawable/widget_btn_sync_off.png differ
diff --git a/res/drawable/widget_btn_wifi.png b/res/drawable/widget_btn_wifi.png
index ff7d2ef885c..2d396810bd2 100644
Binary files a/res/drawable/widget_btn_wifi.png and b/res/drawable/widget_btn_wifi.png differ
diff --git a/res/drawable/widget_btn_wifi_gray.png b/res/drawable/widget_btn_wifi_gray.png
index 8a3cc49c229..76f36e84de8 100644
Binary files a/res/drawable/widget_btn_wifi_gray.png and b/res/drawable/widget_btn_wifi_gray.png differ
diff --git a/res/drawable/widget_btn_wifi_off.png b/res/drawable/widget_btn_wifi_off.png
index 8f15b4f9d48..9b70cf1e215 100644
Binary files a/res/drawable/widget_btn_wifi_off.png and b/res/drawable/widget_btn_wifi_off.png differ
diff --git a/res/layout/power_usage_detail_item_text.xml b/res/layout/power_usage_detail_item_text.xml
index 097469b5233..7ea24320d6d 100644
--- a/res/layout/power_usage_detail_item_text.xml
+++ b/res/layout/power_usage_detail_item_text.xml
@@ -27,8 +27,9 @@
android:textStyle="bold"
android:singleLine="true"
android:layout_alignParentLeft="true"
- android:layout_marginBottom="2dip"
- android:layout_marginTop="2dip" />
+ android:layout_marginBottom="4dip"
+ android:layout_marginTop="4dip"
+ android:layout_marginLeft="4dip" />
+ android:layout_marginBottom="4dip"
+ android:layout_marginTop="4dip"
+ android:layout_marginRight="10dip"/>
diff --git a/res/layout/power_usage_details.xml b/res/layout/power_usage_details.xml
index 206eb05d809..8aa625f669e 100644
--- a/res/layout/power_usage_details.xml
+++ b/res/layout/power_usage_details.xml
@@ -96,6 +96,7 @@
-
-
-
+
+
+
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 4a60c36e193..06bf7879b1f 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -39,18 +39,12 @@
- All
-
-
-
-
+
+
+
+
- MM-dd-yyyy
-
- dd-MM-yyyy
-
- - MMM d, yyyy
-
- - d-MMM-yyyy
-
- yyyy-MM-dd
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3b91ef66fbd..c6c3a2ce3a3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -243,6 +243,10 @@
MM/dd/yyyy
+
+ Normal (%s)
+
Preview:
@@ -1528,16 +1532,16 @@ found in the list of installed applications.
Starts: %1$d
- %1$d d, %2$d h, %3$d m, %4$d s
+ %1$dd %2$dh %3$dm %4$ds
- %1$d h, %2$d m, %3$d s
+ %1$dh %2$dm %3$ds
- %1$d m, %2$d s
+ %1$dm %2$ds
- %1$d s
+ %1$ds
Packages sharing this UID:
@@ -1630,6 +1634,8 @@ found in the list of installed applications.
Battery usage since unplugged
Battery usage since reset
+
+ Usage duration - %1$s
Device awake time
@@ -1794,5 +1800,5 @@ found in the list of installed applications.
VPN
VPN
- Set up and manage VPN configurations, connections
+ Set up & manage VPN configurations, connections
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index 80342a8a224..450e438c435 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -16,5 +16,6 @@
-
+
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java
index d6e85c4e537..5b38651ce85 100644
--- a/src/com/android/settings/DateTimeSettings.java
+++ b/src/com/android/settings/DateTimeSettings.java
@@ -87,19 +87,25 @@ public class DateTimeSettings
mDatePref = findPreference("date");
mDateFormat = (ListPreference) findPreference(KEY_DATE_FORMAT);
- int currentFormatIndex = -1;
String [] dateFormats = getResources().getStringArray(R.array.date_format_values);
String [] formattedDates = new String[dateFormats.length];
String currentFormat = getDateFormat();
// Initialize if DATE_FORMAT is not set in the system settings
// This can happen after a factory reset (or data wipe)
if (currentFormat == null) {
- currentFormat = getResources().getString(R.string.default_date_format);
- setDateFormat(currentFormat);
+ currentFormat = "";
}
for (int i = 0; i < formattedDates.length; i++) {
- formattedDates[i] = DateFormat.format(dateFormats[i], mDummyDate).toString();
- if (currentFormat.equals(dateFormats[i])) currentFormatIndex = i;
+ String formatted =
+ DateFormat.getDateFormatForSetting(this, dateFormats[i]).
+ format(mDummyDate.getTime());
+
+ if (dateFormats[i].length() == 0) {
+ formattedDates[i] = getResources().
+ getString(R.string.normal_date_format, formatted);
+ } else {
+ formattedDates[i] = formatted;
+ }
}
mDateFormat.setEntries(formattedDates);
@@ -314,6 +320,10 @@ public class DateTimeSettings
}
private void setDateFormat(String format) {
+ if (format.length() == 0) {
+ format = null;
+ }
+
Settings.System.putString(getContentResolver(), Settings.System.DATE_FORMAT, format);
}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index cb37465fc81..ccf360ae5cf 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -163,12 +163,12 @@ public class SecuritySettings extends PreferenceActivity {
PreferenceScreen vpnPreferences = getPreferenceManager()
.createPreferenceScreen(this);
- vpnPreferences.setTitle(R.string.vpn_settings_category);
+ vpnPreferences.setTitle(R.string.vpn_settings_title);
+ vpnPreferences.setSummary(R.string.vpn_settings_summary);
vpnPreferences.setIntent(new VpnManager(this).createSettingsActivityIntent());
PreferenceCategory vpnCat = new PreferenceCategory(this);
- vpnCat.setTitle(R.string.vpn_settings_title);
- vpnCat.setSummary(R.string.vpn_settings_summary);
+ vpnCat.setTitle(R.string.vpn_settings_category);
root.addPreference(vpnCat);
vpnCat.addPreference(vpnPreferences);
diff --git a/src/com/android/settings/fuelgauge/PowerUsageDetail.java b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
index 54a0b88139d..e36a8bc776d 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageDetail.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageDetail.java
@@ -51,8 +51,8 @@ public class PowerUsageDetail extends Activity implements Button.OnClickListener
public static final int ACTION_DISPLAY_SETTINGS = 1;
public static final int ACTION_WIFI_SETTINGS = 2;
public static final int ACTION_BLUETOOTH_SETTINGS = 3;
- public static final int ACTION_FORCE_STOP = 4;
- public static final int ACTION_UNINSTALL = 5;
+ public static final int ACTION_WIRELESS_SETTINGS = 4;
+ public static final int ACTION_APP_DETAILS = 6;
public static final int USAGE_SINCE_UNPLUGGED = 1;
public static final int USAGE_SINCE_RESET = 2;
@@ -66,10 +66,6 @@ public class PowerUsageDetail extends Activity implements Button.OnClickListener
public static final String EXTRA_DETAIL_VALUES = "values";
public static final String EXTRA_DRAIN_TYPE = "drainType";
- private static final int SECONDS_PER_MINUTE = 60;
- private static final int SECONDS_PER_HOUR = 60 * 60;
- private static final int SECONDS_PER_DAY = 24 * 60 * 60;
-
private static final boolean DEBUG = true;
private String mTitle;
private double mPercentage;
@@ -135,10 +131,10 @@ public class PowerUsageDetail extends Activity implements Button.OnClickListener
switch (mTypes[i]) {
case R.string.usage_type_data_recv:
case R.string.usage_type_data_send:
- value = formatBytes(mValues[i]);
+ value = Utils.formatBytes(this, mValues[i]);
break;
default:
- value = formatTime(mValues[i]);
+ value = Utils.formatElapsedTime(this, mValues[i]);
}
ViewGroup item = (ViewGroup) inflater.inflate(R.layout.power_usage_detail_item_text,
null);
@@ -165,15 +161,12 @@ public class PowerUsageDetail extends Activity implements Button.OnClickListener
startActivity(new Intent(Settings.ACTION_DISPLAY_SETTINGS));
break;
case ACTION_WIFI_SETTINGS:
- startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
+ startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
break;
case ACTION_BLUETOOTH_SETTINGS:
- startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
+ startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
break;
- case ACTION_FORCE_STOP:
- killProcesses();
- break;
- case ACTION_UNINSTALL:
+ case ACTION_APP_DETAILS:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClass(this, InstalledAppDetails.class);
intent.putExtra("com.android.settings.ApplicationPkgName", mPackages[0]);
@@ -199,18 +192,17 @@ public class PowerUsageDetail extends Activity implements Button.OnClickListener
if (uid == 0 || !isSystem) {
switch (mDrainType) {
case APP:
- label1 = getString(R.string.battery_action_stop);
+ //label1 = getString(R.string.battery_action_stop);
label2 = getString(R.string.battery_action_app_details);
- mAction1 = ACTION_FORCE_STOP;
- mAction2 = ACTION_UNINSTALL;
+ mAction2 = ACTION_APP_DETAILS;
break;
case SCREEN:
- //label2 = getString(R.string.battery_action_display);
- //mAction2 = ACTION_DISPLAY_SETTINGS;
+ label2 = getString(R.string.battery_action_display);
+ mAction2 = ACTION_DISPLAY_SETTINGS;
break;
case WIFI:
label2 = getString(R.string.battery_action_wifi);
- mAction2 = ACTION_WIFI_SETTINGS;
+ mAction2 = ACTION_WIRELESS_SETTINGS;
break;
case BLUETOOTH:
//label2 = getString(R.string.battery_action_bluetooth);
@@ -291,44 +283,4 @@ public class PowerUsageDetail extends Activity implements Button.OnClickListener
}
}
}
-
- private String formatTime(double millis) {
- StringBuilder sb = new StringBuilder();
- int seconds = (int) Math.floor(millis / 1000);
-
- int days = 0, hours = 0, minutes = 0;
- if (seconds > SECONDS_PER_DAY) {
- days = seconds / SECONDS_PER_DAY;
- seconds -= days * SECONDS_PER_DAY;
- }
- if (seconds > SECONDS_PER_HOUR) {
- hours = seconds / SECONDS_PER_HOUR;
- seconds -= hours * SECONDS_PER_HOUR;
- }
- if (seconds > SECONDS_PER_MINUTE) {
- minutes = seconds / SECONDS_PER_MINUTE;
- seconds -= minutes * SECONDS_PER_MINUTE;
- }
- if (days > 0) {
- sb.append(getString(R.string.battery_history_days, days, hours, minutes, seconds));
- } else if (hours > 0) {
- sb.append(getString(R.string.battery_history_hours, hours, minutes, seconds));
- } else if (minutes > 0) {
- sb.append(getString(R.string.battery_history_minutes, minutes, seconds));
- } else {
- sb.append(getString(R.string.battery_history_seconds, seconds));
- }
- return sb.toString();
- }
-
- private String formatBytes(double bytes) {
- // TODO: I18N
- if (bytes > 1000 * 1000) {
- return String.format("%.2f MB", ((int) (bytes / 1000)) / 1000f);
- } else if (bytes > 1024) {
- return String.format("%.2f KB", ((int) (bytes / 10)) / 100f);
- } else {
- return String.format("%d bytes", (int) bytes);
- }
- }
}
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 10ede876288..b8919eefe14 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -100,7 +100,7 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
addPreferencesFromResource(R.xml.power_usage_summary);
mBatteryInfo = IBatteryStats.Stub.asInterface(
ServiceManager.getService("batteryinfo"));
- mAppListGroup = getPreferenceScreen();
+ mAppListGroup = (PreferenceGroup) findPreference("app_list");
mPowerProfile = new PowerProfile(this);
}
@@ -108,7 +108,7 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
protected void onResume() {
super.onResume();
mAbort = false;
- updateAppsList();
+ refreshStats();
}
@Override
@@ -207,18 +207,18 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
} else {
mStatsType = BatteryStats.STATS_TOTAL;
}
- updateAppsList();
+ refreshStats();
return true;
case MENU_STATS_REFRESH:
mStats = null;
- updateAppsList();
+ refreshStats();
return true;
default:
return false;
}
}
- private void updateAppsList() {
+ private void refreshStats() {
if (mStats == null) {
load();
}
@@ -263,12 +263,19 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
}
}
+ private void updateStatsPeriod(long duration) {
+ String durationString = Utils.formatElapsedTime(this, duration / 1000);
+ String label = getString(R.string.battery_stats_duration, durationString);
+ mAppListGroup.setTitle(label);
+ }
+
private void processAppUsage() {
SensorManager sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
final int which = mStatsType;
final double powerCpuNormal = mPowerProfile.getAveragePower(PowerProfile.POWER_CPU_NORMAL);
final double averageCostPerByte = getAverageDataCost();
- long uSecTime = mStats.computeBatteryRealtime(SystemClock.elapsedRealtime(), which) * 1000;
+ long uSecTime = mStats.computeBatteryRealtime(SystemClock.elapsedRealtime() * 1000, which);
+ updateStatsPeriod(uSecTime);
SparseArray extends Uid> uidStats = mStats.getUidStats();
final int NU = uidStats.size();
for (int iu = 0; iu < NU; iu++) {
diff --git a/src/com/android/settings/fuelgauge/Utils.java b/src/com/android/settings/fuelgauge/Utils.java
new file mode 100644
index 00000000000..2ffc9de5015
--- /dev/null
+++ b/src/com/android/settings/fuelgauge/Utils.java
@@ -0,0 +1,84 @@
+/*
+ * 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.content.Context;
+
+import com.android.settings.R;
+
+/**
+ * Contains utility functions for formatting elapsed time and consumed bytes
+ */
+public class Utils {
+ private static final int SECONDS_PER_MINUTE = 60;
+ private static final int SECONDS_PER_HOUR = 60 * 60;
+ private static final int SECONDS_PER_DAY = 24 * 60 * 60;
+
+ /**
+ * Returns elapsed time for the given millis, in the following format:
+ * 2d 5h 40m 29s
+ * @param context the application context
+ * @param millis the elapsed time in milli seconds
+ * @return the formatted elapsed time
+ */
+ public static String formatElapsedTime(Context context, double millis) {
+ StringBuilder sb = new StringBuilder();
+ int seconds = (int) Math.floor(millis / 1000);
+
+ int days = 0, hours = 0, minutes = 0;
+ if (seconds > SECONDS_PER_DAY) {
+ days = seconds / SECONDS_PER_DAY;
+ seconds -= days * SECONDS_PER_DAY;
+ }
+ if (seconds > SECONDS_PER_HOUR) {
+ hours = seconds / SECONDS_PER_HOUR;
+ seconds -= hours * SECONDS_PER_HOUR;
+ }
+ if (seconds > SECONDS_PER_MINUTE) {
+ minutes = seconds / SECONDS_PER_MINUTE;
+ seconds -= minutes * SECONDS_PER_MINUTE;
+ }
+ if (days > 0) {
+ sb.append(context.getString(R.string.battery_history_days,
+ days, hours, minutes, seconds));
+ } else if (hours > 0) {
+ sb.append(context.getString(R.string.battery_history_hours, hours, minutes, seconds));
+ } else if (minutes > 0) {
+ sb.append(context.getString(R.string.battery_history_minutes, minutes, seconds));
+ } else {
+ sb.append(context.getString(R.string.battery_history_seconds, seconds));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Formats data size in KB, MB, from the given bytes.
+ * @param context the application context
+ * @param bytes data size in bytes
+ * @return the formatted size such as 4.52 MB or 245 KB or 332 bytes
+ */
+ public static String formatBytes(Context context, double bytes) {
+ // TODO: I18N
+ if (bytes > 1000 * 1000) {
+ return String.format("%.2f MB", ((int) (bytes / 1000)) / 1000f);
+ } else if (bytes > 1024) {
+ return String.format("%.2f KB", ((int) (bytes / 10)) / 100f);
+ } else {
+ return String.format("%d bytes", (int) bytes);
+ }
+ }
+}
diff --git a/src/com/android/settings/vpn/L2tpIpsecEditor.java b/src/com/android/settings/vpn/L2tpIpsecEditor.java
index 2bb4c8d9336..51569896656 100644
--- a/src/com/android/settings/vpn/L2tpIpsecEditor.java
+++ b/src/com/android/settings/vpn/L2tpIpsecEditor.java
@@ -58,8 +58,6 @@ class L2tpIpsecEditor extends SingleServerEditor {
String result = super.validate(c);
if (result != null) {
return result;
- } else if (mProfile.isCustomized()) {
- return null;
} else if (Util.isNullOrEmpty(mUserkey.getValue())) {
return c.getString(R.string.vpn_error_userkey_not_selected);
} else if (Util.isNullOrEmpty(mUserCertificate.getValue())) {
diff --git a/src/com/android/settings/vpn/SingleServerEditor.java b/src/com/android/settings/vpn/SingleServerEditor.java
index 63964b44d27..a7848e03e56 100644
--- a/src/com/android/settings/vpn/SingleServerEditor.java
+++ b/src/com/android/settings/vpn/SingleServerEditor.java
@@ -50,11 +50,9 @@ class SingleServerEditor implements VpnProfileEditor {
//@Override
public String validate(Context c) {
- return (mProfile.isCustomized()
- ? null
- : (Util.isNullOrEmpty(mServerName.getText())
+ return (Util.isNullOrEmpty(mServerName.getText())
? c.getString(R.string.vpn_error_server_name_empty)
- : null));
+ : null);
}
/**