Add an AlarmManager API to set the system time (with the proper permissions).
diff --git a/api/current.xml b/api/current.xml
index 52648852..b3f9190 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -1035,6 +1035,17 @@
  visibility="public"
 >
 </field>
+<field name="SET_TIME"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission.SET_TIME&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="SET_TIME_ZONE"
  type="java.lang.String"
  transient="false"
@@ -18808,6 +18819,19 @@
 <parameter name="operation" type="android.app.PendingIntent">
 </parameter>
 </method>
+<method name="setTime"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="millis" type="long">
+</parameter>
+</method>
 <method name="setTimeZone"
  return="void"
  abstract="false"
@@ -72328,7 +72352,7 @@
  type="float"
  transient="false"
  volatile="false"
- value="0.0010f"
+ value="0.001f"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -209963,7 +209987,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
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 @@
         } 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);
diff --git a/core/java/android/app/IAlarmManager.aidl b/core/java/android/app/IAlarmManager.aidl
index cb42236..edb40ed 100755
--- a/core/java/android/app/IAlarmManager.aidl
+++ b/core/java/android/app/IAlarmManager.aidl
@@ -27,6 +27,7 @@
     void set(int type, long triggerAtTime, in PendingIntent operation);
     void setRepeating(int type, long triggerAtTime, long interval, in PendingIntent operation);
     void setInexactRepeating(int type, long triggerAtTime, long interval, in PendingIntent operation);
+    void setTime(long millis);
     void setTimeZone(String zone);
     void remove(in PendingIntent operation);
 }
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 1406b66..713e7258 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -679,6 +679,12 @@
         android:label="@string/permlab_setWallpaperHints"
         android:description="@string/permdesc_setWallpaperHints" />
 
+    <!-- Allows applications to set the system time -->
+    <permission android:name="android.permission.SET_TIME"
+        android:protectionLevel="signatureOrSystem"
+        android:label="@string/permlab_setTime"
+        android:description="@string/permdesc_setTime" />
+
     <!-- Allows applications to set the system time zone -->
     <permission android:name="android.permission.SET_TIME_ZONE"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index d1bfc68..4df570c 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1017,6 +1017,12 @@
         configuration, and installed applications.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permlab_setTime">set time</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <string name="permdesc_setTime">Allows an application to change
+        the phone\'s clock time.</string>
+
+    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_setTimeZone">set time zone</string>
     <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permdesc_setTimeZone">Allows an application to change
diff --git a/services/java/com/android/server/AlarmManagerService.java b/services/java/com/android/server/AlarmManagerService.java
index f330651..c28cf44 100644
--- a/services/java/com/android/server/AlarmManagerService.java
+++ b/services/java/com/android/server/AlarmManagerService.java
@@ -242,6 +242,14 @@
         setRepeating(type, bucketTime, interval, operation);
     }
 
+    public void setTime(long millis) {
+        mContext.enforceCallingOrSelfPermission(
+                "android.permission.SET_TIME",
+                "setTime");
+
+        SystemClock.setCurrentTimeMillis(millis);
+    }
+
     public void setTimeZone(String tz) {
         mContext.enforceCallingOrSelfPermission(
                 "android.permission.SET_TIME_ZONE",