From 97e44947282b3918ee0bed2d16b33b983f882580 Mon Sep 17 00:00:00 2001 From: Dan Egnor Date: Thu, 4 Feb 2010 20:27:47 -0800 Subject: Add an AlarmManager API to set the system time (with the proper permissions). --- core/java/android/app/AlarmManager.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'core/java/android/app/AlarmManager.java') diff --git a/core/java/android/app/AlarmManager.java b/core/java/android/app/AlarmManager.java index 53c7935..9082003 100644 --- a/core/java/android/app/AlarmManager.java +++ b/core/java/android/app/AlarmManager.java @@ -277,7 +277,26 @@ public class AlarmManager } catch (RemoteException ex) { } } - + + /** + * Set the system wall clock time. + * Requires the permission android.permission.SET_TIME. + * + * @param millis time in milliseconds since the Epoch + */ + public void setTime(long millis) { + try { + mService.setTime(millis); + } catch (RemoteException ex) { + } + } + + /** + * Set the system default time zone. + * Requires the permission android.permission.SET_TIME_ZONE. + * + * @param timeZone in the format understood by {@link java.util.TimeZone} + */ public void setTimeZone(String timeZone) { try { mService.setTimeZone(timeZone); -- cgit v1.1