Merge "Accquire a wakelock while encrypting." into honeycomb

This commit is contained in:
Jason parks
2011-01-21 14:18:52 -08:00
committed by Android (Google) Code Review

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);
}