Accquire a wakelock while encrypting.

Bug: 3375491
Change-Id: Ief7dbb450800104f4977ab31f93a1e1a994b25ad
This commit is contained in:
Jason parks
2011-01-21 15:48:20 -06:00
parent 666800a237
commit 35933812b1

View File

@@ -30,6 +30,7 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Message; import android.os.Message;
import android.os.PowerManager;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.storage.IMountService; import android.os.storage.IMountService;
@@ -137,6 +138,15 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} }
private void encryptionProgressInit() { 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); mHandler.sendEmptyMessage(UPDATE_PROGRESS);
} }