summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-11-19 12:49:53 -0800
committerDoug Zongker <dougz@android.com>2009-11-19 17:18:31 -0800
commit50a21f4d3b70360b36acad20e234c380654fd59f (patch)
treeae5a32323d740cf4af6c03a573fd6c96ffa27b86 /core
parent793810f68fcf1ace817f6ebcb42a6adb13c28582 (diff)
downloadframeworks_base-50a21f4d3b70360b36acad20e234c380654fd59f.zip
frameworks_base-50a21f4d3b70360b36acad20e234c380654fd59f.tar.gz
frameworks_base-50a21f4d3b70360b36acad20e234c380654fd59f.tar.bz2
add reboot() method to PowerManager
In order to unbundle System Update, we need some to expose in the SDK some way to reboot the device into recovery. Add a reboot() method to PowerManager, protected by the android.permission.REBOOT permission.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/os/IPowerManager.aidl1
-rw-r--r--core/java/android/os/PowerManager.java17
-rw-r--r--core/res/AndroidManifest.xml4
3 files changed, 19 insertions, 3 deletions
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index b9dc860..0229864 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -32,6 +32,7 @@ interface IPowerManager
void preventScreenOn(boolean prevent);
void setScreenBrightnessOverride(int brightness);
boolean isScreenOn();
+ void reboot(String reason);
// sets the brightness of the backlights (screen, keyboard, button) 0-255
void setBacklightBrightness(int brightness);
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 4b3b6f6..ffdb27c 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -465,6 +465,22 @@ public class PowerManager
}
}
+ /**
+ * Reboot the device. Will not return if the reboot is
+ * successful. Requires the {@link android.Manifest#REBOOT}
+ * permission.
+ *
+ * @param reason code to pass to the kernel (e.g., "recovery") to
+ * request special boot modes, or null.
+ */
+ public void reboot(String reason)
+ {
+ try {
+ mService.reboot(reason);
+ } catch (RemoteException e) {
+ }
+ }
+
private PowerManager()
{
}
@@ -488,4 +504,3 @@ public class PowerManager
IPowerManager mService;
Handler mHandler;
}
-
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 22716b8..8047436 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -943,7 +943,7 @@
<permission android:name="android.permission.DELETE_CACHE_FILES"
android:label="@string/permlab_deleteCacheFiles"
android:description="@string/permdesc_deleteCacheFiles"
- android:protectionLevel="signature" />
+ android:protectionLevel="signatureOrSystem" />
<!-- Allows an application to delete packages. -->
<permission android:name="android.permission.DELETE_PACKAGES"
@@ -981,7 +981,7 @@
<permission android:name="android.permission.REBOOT"
android:label="@string/permlab_reboot"
android:description="@string/permdesc_reboot"
- android:protectionLevel="signature" />
+ android:protectionLevel="signatureOrSystem" />
<!-- Allows low-level access to power management -->
<permission android:name="android.permission.DEVICE_POWER"