Set FLAG_SECURE to disable screenshots (#134)

mattermost: https://taiga.getmonero.org/project/m2049r-monerujo/us/38

Sets FLAG_SECURE on all activities to prevent users accidentally
screenshotting sensitive information.
This commit is contained in:
mattcode55 2017-11-16 18:14:53 +00:00 committed by m2049r
parent 41580e5519
commit ed8010c92c
3 changed files with 35 additions and 4 deletions

View File

@ -33,7 +33,6 @@ import android.support.design.widget.TextInputLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
@ -68,7 +67,7 @@ import java.net.SocketAddress;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.util.Date; import java.util.Date;
public class LoginActivity extends AppCompatActivity public class LoginActivity extends SecureActivity
implements LoginFragment.Listener, GenerateFragment.Listener, implements LoginFragment.Listener, GenerateFragment.Listener,
GenerateReviewFragment.Listener, GenerateReviewFragment.AcceptListener, ReceiveFragment.Listener { GenerateReviewFragment.Listener, GenerateReviewFragment.AcceptListener, ReceiveFragment.Listener {
static final String TAG = "LoginActivity"; static final String TAG = "LoginActivity";

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2017 m2049r
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.m2049r.xmrwallet;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import static android.view.WindowManager.LayoutParams;
public abstract class SecureActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set FLAG_SECURE to prevent screenshots
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
}
}

View File

@ -31,7 +31,6 @@ import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
@ -51,7 +50,7 @@ import com.m2049r.xmrwallet.util.TxData;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class WalletActivity extends AppCompatActivity implements WalletFragment.Listener, public class WalletActivity extends SecureActivity implements WalletFragment.Listener,
WalletService.Observer, SendFragment.Listener, TxFragment.Listener, WalletService.Observer, SendFragment.Listener, TxFragment.Listener,
GenerateReviewFragment.ListenerWithWallet, GenerateReviewFragment.ListenerWithWallet,
GenerateReviewFragment.Listener, GenerateReviewFragment.Listener,