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

Commit 3baf0f06 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Temporarily allow all activies to run on SLS."

parents cc525b61 e942c479
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -129,17 +129,19 @@ public final class CommunalManagerService extends SystemService {
    }

    private boolean isActivityAllowed(ActivityInfo activityInfo) {
        if (!mCommunalViewIsShowing.get() || !mKeyguardManager.isKeyguardLocked()) return true;

        // 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 false;
        }

        // Check the cached user preferences to see if the user has allowed this app.
        return mEnabledApps.contains(activityInfo.applicationInfo.packageName);
        return true;
        // TODO(b/191994709): Uncomment the lines below once Dreams and Assistant have been fixed.
//        if (!mCommunalViewIsShowing.get() || !mKeyguardManager.isKeyguardLocked()) return true;
//
//        // 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 false;
//        }
//
//        // Check the cached user preferences to see if the user has allowed this app.
//        return mEnabledApps.contains(activityInfo.applicationInfo.packageName);
    }

    private final class SettingsObserver extends ContentObserver {
+6 −3
Original line number Diff line number Diff line
@@ -191,7 +191,8 @@ public class CommunalManagerServiceTest {
        mBinder.setCommunalViewShowing(true);
        when(mKeyguardManager.isKeyguardLocked()).thenReturn(true);
        mAInfo.flags = 0;
        assertThat(mActivityInterceptorCallback.intercept(buildActivityInfo(intent))).isNotNull();
        // TODO(b/191994709): Fix this assertion once we properly intercept activities.
        assertThat(mActivityInterceptorCallback.intercept(buildActivityInfo(intent))).isNull();
    }

    @Test
@@ -203,7 +204,8 @@ public class CommunalManagerServiceTest {
        mAInfo.flags = FLAG_SHOW_WHEN_LOCKED;

        allowPackages("package1,package2");
        assertThat(mActivityInterceptorCallback.intercept(buildActivityInfo(intent))).isNotNull();
        // TODO(b/191994709): Fix this assertion once we properly intercept activities.
        assertThat(mActivityInterceptorCallback.intercept(buildActivityInfo(intent))).isNull();
    }

    @Test
@@ -215,7 +217,8 @@ public class CommunalManagerServiceTest {
        mAInfo.flags = 0;

        allowPackages(TEST_PACKAGE_NAME);
        assertThat(mActivityInterceptorCallback.intercept(buildActivityInfo(intent))).isNotNull();
        // TODO(b/191994709): Fix this assertion once we properly intercept activities.
        assertThat(mActivityInterceptorCallback.intercept(buildActivityInfo(intent))).isNull();
    }

    @Test