diff options
author | Amith Yamasani <yamasani@google.com> | 2012-11-16 10:43:03 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-11-16 10:43:04 -0800 |
commit | 609772652250a4408c4cfef2560d145fd365db2b (patch) | |
tree | 7d2504efc9e2ff3ed83b7958bb3a6ef2e03044d2 /src | |
parent | f15f9d67652dacc7f8d2764245f79b25d2c6c67b (diff) | |
parent | 5f050104386b96d8c99eb3ff0f5088814709348b (diff) | |
download | packages_apps_settings-609772652250a4408c4cfef2560d145fd365db2b.zip packages_apps_settings-609772652250a4408c4cfef2560d145fd365db2b.tar.gz packages_apps_settings-609772652250a4408c4cfef2560d145fd365db2b.tar.bz2 |
Merge "Use AlarmManager calls to set date/time, instead of SystemClock.setTime" into jb-mr1.1-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/DateTimeSettings.java | 13 | ||||
-rw-r--r-- | src/com/android/settings/DateTimeSettingsSetupWizard.java | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java index 53f25a2..65a34f4 100644 --- a/src/com/android/settings/DateTimeSettings.java +++ b/src/com/android/settings/DateTimeSettings.java @@ -17,6 +17,7 @@ package com.android.settings; import android.app.Activity; +import android.app.AlarmManager; import android.app.DatePickerDialog; import android.app.Dialog; import android.app.TimePickerDialog; @@ -184,18 +185,18 @@ public class DateTimeSettings extends SettingsPreferenceFragment @Override public void onDateSet(DatePicker view, int year, int month, int day) { - setDate(year, month, day); final Activity activity = getActivity(); if (activity != null) { + setDate(activity, year, month, day); updateTimeAndDateDisplay(activity); } } @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { - setTime(hourOfDay, minute); final Activity activity = getActivity(); if (activity != null) { + setTime(activity, hourOfDay, minute); updateTimeAndDateDisplay(activity); } @@ -337,7 +338,7 @@ public class DateTimeSettings extends SettingsPreferenceFragment } } - /* package */ static void setDate(int year, int month, int day) { + /* package */ static void setDate(Context context, int year, int month, int day) { Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, year); @@ -346,11 +347,11 @@ public class DateTimeSettings extends SettingsPreferenceFragment long when = c.getTimeInMillis(); if (when / 1000 < Integer.MAX_VALUE) { - SystemClock.setCurrentTimeMillis(when); + ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE)).setTime(when); } } - /* package */ static void setTime(int hourOfDay, int minute) { + /* package */ static void setTime(Context context, int hourOfDay, int minute) { Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, hourOfDay); @@ -360,7 +361,7 @@ public class DateTimeSettings extends SettingsPreferenceFragment long when = c.getTimeInMillis(); if (when / 1000 < Integer.MAX_VALUE) { - SystemClock.setCurrentTimeMillis(when); + ((AlarmManager) context.getSystemService(Context.ALARM_SERVICE)).setTime(when); } } diff --git a/src/com/android/settings/DateTimeSettingsSetupWizard.java b/src/com/android/settings/DateTimeSettingsSetupWizard.java index 87b1cae..05e0d4e 100644 --- a/src/com/android/settings/DateTimeSettingsSetupWizard.java +++ b/src/com/android/settings/DateTimeSettingsSetupWizard.java @@ -188,9 +188,9 @@ public class DateTimeSettingsSetupWizard extends Activity Settings.Global.putInt(getContentResolver(), Settings.Global.AUTO_TIME, mAutoDateTimeButton.isChecked() ? 1 : 0); if (!mAutoDateTimeButton.isChecked()) { - DateTimeSettings.setDate(mDatePicker.getYear(), mDatePicker.getMonth(), + DateTimeSettings.setDate(this, mDatePicker.getYear(), mDatePicker.getMonth(), mDatePicker.getDayOfMonth()); - DateTimeSettings.setTime( + DateTimeSettings.setTime(this, mTimePicker.getCurrentHour(), mTimePicker.getCurrentMinute()); } } |