Extended zxing-android-embedded CaptureActivity to secure 2FA QR Codes

This commit is contained in:
Marc Schwede 2019-09-11 14:50:02 +02:00
parent 491a600f9b
commit 7bdd2f444c
3 changed files with 19 additions and 0 deletions

View file

@ -56,6 +56,7 @@
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation" />
<activity android:name=".Activities.SecureCaptureActivity" />
<activity
android:name=".Activities.PanicResponderActivity"
android:launchMode="singleInstance"

View file

@ -104,6 +104,7 @@ public class MainActivity extends BaseActivity
new IntentIntegrator(MainActivity.this)
.setOrientationLocked(false)
.setBeepEnabled(false)
.setCaptureActivity(SecureCaptureActivity.class)
.initiateScan();
}

View file

@ -0,0 +1,17 @@
package org.shadowice.flocke.andotp.Activities;
import android.view.WindowManager;
import com.journeyapps.barcodescanner.CaptureActivity;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import org.shadowice.flocke.andotp.Utilities.Settings;
public class SecureCaptureActivity extends CaptureActivity {
@Override
protected DecoratedBarcodeView initializeContent() {
Settings settings = new Settings(this);
if (!settings.getScreenshotsEnabled())
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
return super.initializeContent();
}
}