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

Commit 26231bf7 authored by ronish's avatar ronish Committed by Ronish Kalia
Browse files

Use ActivityService from lock screen

Use ActivityService to avoid Camera API errors while accessing the
camera while the device is still locked

Bug: 221385197, 221385117
Test: Manually
Change-Id: I0d2800340cabe2e153b0d07c21f52938112c21ca
parent ae758aa7
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -32,7 +32,6 @@ import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.ActivityOptions;
import android.app.ActivityTaskManager;
import android.app.ActivityTaskManager;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
@@ -1109,8 +1108,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        Intent intent = mQRCodeScannerController.getIntent();
        Intent intent = mQRCodeScannerController.getIntent();
        if (intent != null) {
        if (intent != null) {
            try {
            try {
                mContext.startActivity(intent);
                ActivityTaskManager.getService().startActivityAsUser(
            } catch (ActivityNotFoundException e) {
                                null, getContext().getBasePackageName(),
                                getContext().getAttributionTag(), intent,
                                intent.resolveTypeIfNeeded(getContext().getContentResolver()),
                                null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, null,
                                UserHandle.CURRENT.getIdentifier());
            } catch (RemoteException e) {
                // This is unexpected. Nonetheless, just log the error and prevent the UI from
                // This is unexpected. Nonetheless, just log the error and prevent the UI from
                // crashing
                // crashing
                Log.e(TAG, "Unexpected intent: " + intent
                Log.e(TAG, "Unexpected intent: " + intent