Add wakelock to UserCallActivity
Add a wakelock to make sure that the phone doesn't go to sleep in the
middle of trying to initiate an outgoing call through Bluetooth (or
something else that doesn't require the screen being on).
Change-Id: Ide945fabbb474cb8ce60fbf704698e566e9f9b01
Fixes: 38328207
Test: manual
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4323274..4f1cb8b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -41,6 +41,7 @@
<uses-permission android:name="android.permission.STOP_APP_SWITCHES" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_BLOCKED_NUMBERS" />
<uses-permission android:name="android.permission.WRITE_BLOCKED_NUMBERS" />
<uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
diff --git a/src/com/android/server/telecom/components/UserCallActivity.java b/src/com/android/server/telecom/components/UserCallActivity.java
index 1a3c77a..dbee450 100644
--- a/src/com/android/server/telecom/components/UserCallActivity.java
+++ b/src/com/android/server/telecom/components/UserCallActivity.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.os.PowerManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.telecom.Log;
@@ -52,6 +53,11 @@
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
+ PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
+ PowerManager.WakeLock wakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
+ "UserCallActivity");
+ wakelock.acquire();
+
Log.startSession("UCA.oC");
try {
// TODO: Figure out if there is something to restore from bundle.
@@ -71,7 +77,9 @@
getCallingPackage(), true /* hasCallAppOp*/);
} finally {
Log.endSession();
+ wakelock.release();
}
+ Log.i(this, "onCreate done");
finish();
}