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

Commit 34471a71 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Disallow screenshot on Wi-Fi QR code settings" into tm-qpr-dev am: d2635580

parents 4335d938 d2635580
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.UserManager;
import android.provider.Settings;
import android.util.EventLog;
import android.util.Log;
import android.view.WindowManager;

import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.FragmentTransaction;
@@ -99,6 +100,7 @@ public class WifiDppConfiguratorActivity extends WifiDppBaseActivity implements
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);

        if (savedInstanceState != null) {
            String qrCode = savedInstanceState.getString(KEY_QR_CODE);
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@

package com.android.settings.wifi.dpp;

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

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
@@ -72,6 +76,12 @@ public class WifiDppConfiguratorActivityTest {
                Robolectric.setupActivity(WifiDppConfiguratorActivity.class);
    }

    @Test
    public void launchActivity_shouldAddFlagSecure() {
        assertThat(mActivity.getWindow().getAttributes().flags & FLAG_SECURE)
                .isEqualTo(FLAG_SECURE);
    }

    @Test
    public void handleIntent_isGuestUser_shouldFinish() {
        when(mUserManager.isGuestUser()).thenReturn(true);