diff options
author | Amith Yamasani <yamasani@google.com> | 2012-11-16 10:48:59 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-11-16 10:48:59 -0800 |
commit | 21b5aacf34e5249b59cdbf0cc349fa2d604a25a4 (patch) | |
tree | 19d17d9bda65c28833edb498b5578a9352cd7789 /src/com/android/settings/DateTimeSettings.java | |
parent | 8761a0536b618c3dd2711b26142469b6a6591423 (diff) | |
parent | 0aa79c73948af7600f289928b18b3231d9679f81 (diff) | |
download | packages_apps_Settings-21b5aacf34e5249b59cdbf0cc349fa2d604a25a4.tar.gz packages_apps_Settings-21b5aacf34e5249b59cdbf0cc349fa2d604a25a4.tar.bz2 packages_apps_Settings-21b5aacf34e5249b59cdbf0cc349fa2d604a25a4.zip |
am 0aa79c73: am 60977265: Merge "Use AlarmManager calls to set date/time, instead of SystemClock.setTime" into jb-mr1.1-dev
* commit '0aa79c73948af7600f289928b18b3231d9679f81':
Use AlarmManager calls to set date/time, instead of SystemClock.setTime
Diffstat (limited to 'src/com/android/settings/DateTimeSettings.java')
-rw-r--r-- | src/com/android/settings/DateTimeSettings.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java index 98c38871c..b7bbc6705 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; @@ -188,18 +189,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); } @@ -341,7 +342,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); @@ -350,11 +351,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); @@ -364,7 +365,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); } } |