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

Commit f1f74e26 authored by Matías Hernández's avatar Matías Hernández Committed by Automerger Merge Worker
Browse files

Merge "Remove incorrect call to Window.addFlags with a system flag" into...

Merge "Remove incorrect call to Window.addFlags with a system flag" into udc-dev am: 4a584df0 am: 04cbe370

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/31172435



Change-Id: I5ec88479adeaf240e7df61673b73ba54c5b3d202
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 638c49a6 04cbe370
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.os.UserManager;
import android.service.notification.NotificationListenerService;
import android.text.TextUtils;
import android.util.Slog;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Toast;

@@ -160,20 +159,6 @@ public class NotificationAccessConfirmationActivity extends Activity
        getWindow().setCloseOnTouchOutside(false); 
    }

    @Override
    public void onResume() {
        super.onResume();
        getWindow().addFlags(
                WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
    }

    @Override
    public void onPause() {
        getWindow().clearFlags(
                WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
        super.onPause();
    }

    private void onAllow() {
        mNm.setNotificationListenerAccessGranted(mComponentName, true);

+15 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.settings.notification;

import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import static com.android.internal.notification.NotificationAccessConfirmationActivityContract.EXTRA_COMPONENT_NAME;

import static com.google.common.truth.Truth.assertThat;
@@ -41,6 +43,19 @@ import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class NotificationAccessConfirmationActivityTest {

    @Test
    public void onCreate_setsWindowFlags() {
        ComponentName cn = new ComponentName("com.example", "com.example.SomeService");
        installPackage(cn.getPackageName(), "Example");

        NotificationAccessConfirmationActivity activity = startActivityWithIntent(cn);

        assertThat(activity.getWindow().getAttributes().privateFlags
                & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS).isNotEqualTo(0);
        assertThat(activity.getWindow().getAttributes().flags
                & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS).isEqualTo(0);
    }

    @Test
    public void start_withMissingIntentFilter_finishes() {
        ComponentName cn = new ComponentName("com.example", "com.example.SomeService");