Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a7302fa authored by Hall Liu's avatar Hall Liu
Browse files

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
parent 0f1b7b1d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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" />
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.app.Activity;
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 @@ public class UserCallActivity extends Activity implements TelecomSystem.Componen
    @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 @@ public class UserCallActivity extends Activity implements TelecomSystem.Componen
                    getCallingPackage(), true /* hasCallAppOp*/);
        } finally {
            Log.endSession();
            wakelock.release();
        }
        Log.i(this, "onCreate done");
        finish();
    }