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

Commit 9aae6eca authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Don't fire pending remote input when is phone locked.

If an owner clicks "reply" on a locked device but doesn't
actually unlock their device, we shouldn't attempt to satisfy
the reply request. Check to ensure that the device is actually
unlocked before replying.

Also, if they click "emergency call", hide the shade before
showing the dialer, otherwise the shade can be left visible over
the top of the dialer.

Fixes: 191551623
Test: manual
Change-Id: Ie9e5127e19e222dcfa3c34b57aec1bc8074f5674
parent 06327bba
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.keyguard.dagger.KeyguardBouncerScope;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.util.EmergencyDialerConstants;
@@ -50,6 +51,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
    private final TelephonyManager mTelephonyManager;
    private final PowerManager mPowerManager;
    private final ActivityTaskManager mActivityTaskManager;
    private ShadeController mShadeController;
    private final TelecomManager mTelecomManager;
    private final MetricsLogger mMetricsLogger;

@@ -79,6 +81,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
            ConfigurationController configurationController,
            KeyguardUpdateMonitor keyguardUpdateMonitor, TelephonyManager telephonyManager,
            PowerManager powerManager, ActivityTaskManager activityTaskManager,
            ShadeController shadeController,
            @Nullable TelecomManager telecomManager, MetricsLogger metricsLogger) {
        super(view);
        mConfigurationController = configurationController;
@@ -86,6 +89,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
        mTelephonyManager = telephonyManager;
        mPowerManager = powerManager;
        mActivityTaskManager = activityTaskManager;
        mShadeController = shadeController;
        mTelecomManager = telecomManager;
        mMetricsLogger = metricsLogger;
    }
@@ -129,6 +133,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
            mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
        }
        mActivityTaskManager.stopSystemLockTaskMode();
        mShadeController.collapsePanel(false);
        if (mTelecomManager != null && mTelecomManager.isInCall()) {
            mTelecomManager.showInCallScreen(false);
            if (mEmergencyButtonCallback != null) {
@@ -167,6 +172,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
        private final TelephonyManager mTelephonyManager;
        private final PowerManager mPowerManager;
        private final ActivityTaskManager mActivityTaskManager;
        private ShadeController mShadeController;
        @Nullable
        private final TelecomManager mTelecomManager;
        private final MetricsLogger mMetricsLogger;
@@ -175,6 +181,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
        public Factory(ConfigurationController configurationController,
                KeyguardUpdateMonitor keyguardUpdateMonitor, TelephonyManager telephonyManager,
                PowerManager powerManager, ActivityTaskManager activityTaskManager,
                ShadeController shadeController,
                @Nullable TelecomManager telecomManager, MetricsLogger metricsLogger) {

            mConfigurationController = configurationController;
@@ -182,6 +189,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
            mTelephonyManager = telephonyManager;
            mPowerManager = powerManager;
            mActivityTaskManager = activityTaskManager;
            mShadeController = shadeController;
            mTelecomManager = telecomManager;
            mMetricsLogger = metricsLogger;
        }
@@ -190,6 +198,7 @@ public class EmergencyButtonController extends ViewController<EmergencyButton> {
        public EmergencyButtonController create(EmergencyButton view) {
            return new EmergencyButtonController(view, mConfigurationController,
                    mKeyguardUpdateMonitor, mTelephonyManager, mPowerManager, mActivityTaskManager,
                    mShadeController,
                    mTelecomManager, mMetricsLogger);
        }
    }
+10 −5
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentSender;
import android.os.Handler;
import android.os.RemoteException;
import android.os.UserHandle;
import android.view.View;
@@ -35,6 +34,7 @@ import android.view.ViewParent;

import com.android.systemui.ActivityIntentHelper;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.ActionClickLogger;
@@ -50,6 +50,8 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.policy.KeyguardStateController;

import java.util.concurrent.Executor;

import javax.inject.Inject;

/**
@@ -65,6 +67,7 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks,
    private final Context mContext;
    private final StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private final ShadeController mShadeController;
    private Executor mExecutor;
    private final ActivityIntentHelper mActivityIntentHelper;
    private final GroupExpansionManager mGroupExpansionManager;
    private View mPendingWorkRemoteInputView;
@@ -74,7 +77,6 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks,
    private final ActionClickLogger mActionClickLogger;
    private int mDisabled2;
    protected BroadcastReceiver mChallengeReceiver = new ChallengeReceiver();
    private Handler mMainHandler = new Handler();

    /**
     */
@@ -89,10 +91,12 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks,
            ActivityStarter activityStarter,
            ShadeController shadeController,
            CommandQueue commandQueue,
            ActionClickLogger clickLogger) {
            ActionClickLogger clickLogger,
            @Main Executor executor) {
        mContext = context;
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
        mShadeController = shadeController;
        mExecutor = executor;
        mContext.registerReceiverAsUser(mChallengeReceiver, UserHandle.ALL,
                new IntentFilter(ACTION_DEVICE_LOCKED_CHANGED), null, null);
        mLockscreenUserManager = notificationLockscreenUserManager;
@@ -113,9 +117,10 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks,
        boolean hasPendingRemoteInput = mPendingRemoteInputView != null;
        if (state == StatusBarState.SHADE
                && (mStatusBarStateController.leaveOpenOnKeyguardHide() || hasPendingRemoteInput)) {
            if (!mStatusBarStateController.isKeyguardRequested()) {
            if (!mStatusBarStateController.isKeyguardRequested()
                    && mKeyguardStateController.isUnlocked()) {
                if (hasPendingRemoteInput) {
                    mMainHandler.post(mPendingRemoteInputView::callOnClick);
                    mExecutor.execute(mPendingRemoteInputView::callOnClick);
                }
                mPendingRemoteInputView = null;
            }
+4 −1
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;

import org.junit.Before;
import org.junit.Test;
@@ -58,6 +60,7 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase {
    @Mock private SysuiStatusBarStateController mStatusBarStateController;
    @Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    @Mock private ActivityStarter mActivityStarter;
    private final FakeExecutor mFakeExecutor = new FakeExecutor(new FakeSystemClock());

    private int mCurrentUserId = 0;
    private StatusBarRemoteInputCallback mRemoteInputCallback;
@@ -76,7 +79,7 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase {
                mock(NotificationGroupManagerLegacy.class), mNotificationLockscreenUserManager,
                mKeyguardStateController, mStatusBarStateController, mStatusBarKeyguardViewManager,
                mActivityStarter, mShadeController, new CommandQueue(mContext),
                mock(ActionClickLogger.class)));
                mock(ActionClickLogger.class), mFakeExecutor));
        mRemoteInputCallback.mChallengeReceiver = mRemoteInputCallback.new ChallengeReceiver();
    }