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

Commit e5af17ae authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[CS] Remove CentralSurfaces#readyForKeyguardDone.

Have CameraGestureHelper notify SBKeyguardViewManager directly.

Also makes CameraGestureHelper a singleton, since it looks like it's
used as a singleton.

Bug: 277764509
Test: verified via logging that SBKVM is notified when camera gesture
occurs
Test: atest CameraGestureHelperTest

Change-Id: Id32432c23395fa812a71b6f6dcf296d3ae52ad00
parent f82aba6b
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -29,12 +29,14 @@ import android.util.Log
import android.view.WindowManager
import com.android.keyguard.KeyguardUpdateMonitor
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.settings.UserTracker
import com.android.systemui.shared.system.ActivityManagerKt.isInForeground
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
import com.android.systemui.statusbar.policy.KeyguardStateController
import java.util.concurrent.Executor
import javax.inject.Inject
@@ -43,10 +45,12 @@ import javax.inject.Inject
 * Helps with handling camera-related gestures (for example, double-tap the power button to launch
 * the camera).
 */
@SysUISingleton
class CameraGestureHelper @Inject constructor(
    private val context: Context,
    private val centralSurfaces: CentralSurfaces,
    private val keyguardStateController: KeyguardStateController,
    private val statusBarKeyguardViewManager: StatusBarKeyguardViewManager,
    private val packageManager: PackageManager,
    private val activityManager: ActivityManager,
    private val activityStarter: ActivityStarter,
@@ -133,7 +137,7 @@ class CameraGestureHelper @Inject constructor(
        centralSurfaces.startLaunchTransitionTimeout()
        // Call this to make sure the keyguard is ready to be dismissed once the next intent is
        // handled by the OS (in our case it is the activity we started right above)
        centralSurfaces.readyForKeyguardDone()
        statusBarKeyguardViewManager.readyForKeyguardDone()
    }

    /**
+0 −2
Original line number Diff line number Diff line
@@ -243,8 +243,6 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner {
    @Deprecated
    float getDisplayHeight();

    void readyForKeyguardDone();

    void showKeyguard();

    boolean hideKeyguard();
+0 −1
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ abstract class CentralSurfacesEmptyImpl : CentralSurfaces {
    override fun dump(pwOriginal: PrintWriter, args: Array<String>) {}
    override fun getDisplayWidth() = 0f
    override fun getDisplayHeight() = 0f
    override fun readyForKeyguardDone() {}
    override fun showKeyguard() {}
    override fun hideKeyguard() = false
    override fun showKeyguardImpl() {}
+0 −5
Original line number Diff line number Diff line
@@ -2061,11 +2061,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        return mDisplay.getRotation();
    }

    @Override
    public void readyForKeyguardDone() {
        mStatusBarKeyguardViewManager.readyForKeyguardDone();
    }

    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
+4 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.settings.UserTracker
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.util.mockito.KotlinArgumentCaptor
import com.android.systemui.util.mockito.eq
@@ -55,6 +56,8 @@ class CameraGestureHelperTest : SysuiTestCase() {
    @Mock
    lateinit var centralSurfaces: CentralSurfaces
    @Mock
    lateinit var statusBarKeyguardViewManager: StatusBarKeyguardViewManager
    @Mock
    lateinit var keyguardStateController: KeyguardStateController
    @Mock
    lateinit var packageManager: PackageManager
@@ -91,6 +94,7 @@ class CameraGestureHelperTest : SysuiTestCase() {
            context = mock(),
            centralSurfaces = centralSurfaces,
            keyguardStateController = keyguardStateController,
            statusBarKeyguardViewManager = statusBarKeyguardViewManager,
            packageManager = packageManager,
            activityManager = activityManager,
            activityStarter = activityStarter,