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

Commit a3197125 authored by Lucas Silva's avatar Lucas Silva
Browse files

Redirect to the bouncer if an SLS activity does not have showWhenLocked

enabled.

Bug: 191996331
Test: atest FrameworksMockingServicesTests:CommunalManagerServiceTests
Test: locally
Change-Id: I3df2732773dd8593a220c9785f55833e25cd7426
parent e36f900c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -236,7 +236,18 @@ public final class CommunalManagerService extends SystemService {

    private boolean shouldIntercept(ActivityInfo activityInfo) {
        if (!mCommunalViewIsShowing.get() || !mKeyguardManager.isKeyguardLocked()) return false;
        return !isAppAllowed(activityInfo.applicationInfo);
        ApplicationInfo appInfo = activityInfo.applicationInfo;
        // Dreams are allowed to show, and don't require the showWhenLocked attribute.
        if (isActiveDream(appInfo)) return false;

        // If the activity doesn't have showWhenLocked enabled, disallow the activity.
        final boolean showWhenLocked =
                (activityInfo.flags & ActivityInfo.FLAG_SHOW_WHEN_LOCKED) != 0;
        if (!showWhenLocked) {
            return true;
        }

        return !isAppAllowed(appInfo);
    }

    private final class BinderService extends ICommunalManager.Stub {
+1 −2
Original line number Diff line number Diff line
@@ -259,8 +259,7 @@ public class CommunalManagerServiceTest {
        mAInfo.flags = 0;

        allowPackages(TEST_PACKAGE_NAME);
        // TODO(b/191994709): Fix this assertion once we start checking showWhenLocked
        assertDoesNotIntercept();
        assertDoesIntercept();
    }

    @Test