summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/ShutdownActivity.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-10-03 16:38:22 -0700
committerDianne Hackborn <hackbod@google.com>2012-10-03 18:07:23 -0700
commitc428aae6429c3fd5e2037c3793af399d9f6e23bf (patch)
treeea5452cc311e5440b6e3dbce5f856fbc8915b653 /services/java/com/android/server/ShutdownActivity.java
parent2e307a61a3730e6b65906f575d85258b197e3494 (diff)
downloadframeworks_base-c428aae6429c3fd5e2037c3793af399d9f6e23bf.zip
frameworks_base-c428aae6429c3fd5e2037c3793af399d9f6e23bf.tar.gz
frameworks_base-c428aae6429c3fd5e2037c3793af399d9f6e23bf.tar.bz2
Fix issue #7267494, issue #7212347
7267494 Calendar is not syncing Check for whether a content provider is dead before returning it. This is kind-of a band-aid, but probably the right thing to do; I'm just not sure exactly the full details of why this problem is happening. Hopefully this "fixes" it, though I don't have a way to repro to tell. 7212347 System power off dialog is only visible to user 0 Make it visible. Also turn on some battery debugging stuff and clean it up so we can just keep it. Change-Id: I5add25bf2a763c8dfe1df23bc5c753a9ea5d157a
Diffstat (limited to 'services/java/com/android/server/ShutdownActivity.java')
-rw-r--r--services/java/com/android/server/ShutdownActivity.java30
1 files changed, 23 insertions, 7 deletions
diff --git a/services/java/com/android/server/ShutdownActivity.java b/services/java/com/android/server/ShutdownActivity.java
index a4341b7..be65141 100644
--- a/services/java/com/android/server/ShutdownActivity.java
+++ b/services/java/com/android/server/ShutdownActivity.java
@@ -17,9 +17,13 @@
package com.android.server;
import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
+import android.os.IPowerManager;
+import android.os.RemoteException;
+import android.os.ServiceManager;
import android.util.Slog;
import com.android.server.power.ShutdownThread;
@@ -39,15 +43,27 @@ public class ShutdownActivity extends Activity {
mConfirm = intent.getBooleanExtra(Intent.EXTRA_KEY_CONFIRM, false);
Slog.i(TAG, "onCreate(): confirm=" + mConfirm);
- Handler h = new Handler();
- h.post(new Runnable() {
+ Thread thr = new Thread("ShutdownActivity") {
+ @Override
public void run() {
- if (mReboot) {
- ShutdownThread.reboot(ShutdownActivity.this, null, mConfirm);
- } else {
- ShutdownThread.shutdown(ShutdownActivity.this, mConfirm);
+ IPowerManager pm = IPowerManager.Stub.asInterface(
+ ServiceManager.getService(Context.POWER_SERVICE));
+ try {
+ if (mReboot) {
+ pm.reboot(mConfirm, null, false);
+ } else {
+ pm.shutdown(mConfirm, false);
+ }
+ } catch (RemoteException e) {
}
}
- });
+ };
+ thr.start();
+ finish();
+ // Wait for us to tell the power manager to shutdown.
+ try {
+ thr.join();
+ } catch (InterruptedException e) {
+ }
}
}