am f5f4c687: Merge "Accquire a wakelock while encrypting." into honeycomb

* commit 'f5f4c687870ff09ef2fe02677a810af22b57ff99':
  Accquire a wakelock while encrypting.
This commit is contained in:
Jason parks
2011-01-21 14:20:41 -08:00
committed by Android Git Automerger

View File

@@ -30,6 +30,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.PowerManager;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.IMountService;
@@ -137,6 +138,15 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
}
private void encryptionProgressInit() {
// Accquire a partial wakelock to prevent the device from sleeping. Note
// we never release this wakelock as we will be restarted after the device
// is encrypted.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
wakeLock.acquire();
mHandler.sendEmptyMessage(UPDATE_PROGRESS);
}