KeePassDX
KeePassDX copied to clipboard
KeePassDX doesn't work with scrcpy screen mirroring
If I am at home, I prefer to do every phone thing via scrcpy for accessibility reasons, since even the smallest Android phone I could find is way too big for me and I find it a pain to use.
Since Android 12, scrcpy is unable to display screen content with "secure flags" and shows a black screen instead.
Since I tend to use open source apps, I have not come across this limitation many times (I think usually apps with DRM or other anti-user features have them); and in the few apps where I encountered that (Signal, browsers' private mode etc.), it was easy to disable in settings. Now that I am looking at using a KeePass client on my phone, I tried KeePassDX first and was immediately greeted with a black screen upon opening the app. So I reached for the phone instead, and tried to find a setting to disable this limitation, but apparently it is not an option at the moment.
I saw in #459 @J-Jamet saying that he "will look to add this request only if another more important reason is mentioned", as screenshots for bug reports are not an important enough use case, and I would agree with that. Screen mirroring issue wasn't present at the time of that thread, since Android allowed shell permissions to capture "protected" screen content at the time; complete blocking of all screen mirroring is new to Android 12. So I am reporting this issue with scrcpy in case my use case is considered important enough to reconsider providing an option.
I agree. That's a good reason, I will however add a permanent icon on the interface indicating that the option is activated so that it is not done without the user's knowledge.
Edit : Linked to #459
The idea for #1354 and #459 would be to make a setting in "App settings - General - Screenshot" to be able to make screenshots, it would be disabled by default. A small visual indicator should be added to indicate that screenshots are possible (so that the user can remember to disable the feature as soon as possible).
is a snackbar too big?
![Screenshot 2022-08-08 at 20 41 59](https://user-images.githubusercontent.com/182872/183500993-fbd7079f-7869-4da2-8466-602048101636.png)
Another option I was thinking is to just add a small view below the recycler view
The information would have to be present on each screen of the application, so I was thinking more of a view that each screen of the application would use (we can use an "include") and that would be configurable in a common inherited class. The size of a Snackbar, yes it's ok, but it should not overlay the other views of the screen. With the text "Screenshot mode". The description of the setting would be something like "Enable Screenshot mode to allow recording of screens".
I was thinking to use the feature of the CoordinatorLayout
that moves up the floating buttons
diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt
index 32904c342..ac5660d0f 100644
--- a/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt
+++ b/app/src/main/java/com/kunzisoft/keepass/activities/stylish/StylishActivity.kt
@@ -25,9 +25,12 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
+import android.view.View
import android.view.WindowManager
import androidx.annotation.StyleRes
import androidx.appcompat.app.AppCompatActivity
+import com.google.android.material.snackbar.Snackbar
+import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.settings.NestedAppSettingsFragment.Companion.DATABASE_PREFERENCE_CHANGED
/**
@@ -83,8 +86,11 @@ abstract class StylishActivity : AppCompatActivity() {
// Several gingerbread devices have problems with FLAG_SECURE
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
+
}
+ private var snackbar: Snackbar? = null
+
override fun onResume() {
super.onResume()
@@ -94,6 +100,11 @@ abstract class StylishActivity : AppCompatActivity() {
Log.d(this.javaClass.name, "Theme change detected, restarting activity")
recreateActivity()
}
+
+ // I'm using R.id.app_bar to find a child of the CoordinatorLayout but
+ // renaming all the coordinator layouts would be better
+ findViewById<View>(R.id.app_bar)?.let { appBar ->
+ snackbar = Snackbar.make(appBar, "screenshot", Snackbar.LENGTH_INDEFINITE)
+ snackbar?.show()
+ }
}
private fun recreateActivity() {
diff --git a/app/src/main/res/layout/activity_group.xml b/app/src/main/res/layout/activity_group.xml
index cdeed30e1..c90b94e03 100644
--- a/app/src/main/res/layout/activity_group.xml
+++ b/app/src/main/res/layout/activity_group.xml
@@ -151,6 +151,20 @@
android:layout_height="wrap_content"
app:layout_anchor="@+id/node_list_container"
app:layout_anchorGravity="end|bottom" />
+
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/lock_button"
+ style="@style/KeepassDXStyle.Fab.Special"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:fabSize="mini"
+ android:layout_gravity="start|bottom"
+ android:layout_margin="9dp"
+ android:contentDescription="@string/lock"
+ android:visibility="gone"
+ android:src="@drawable/ic_lock_white_padding_24dp"
+ xmlns:app="http://schemas.android.com/apk/res-auto" />
+
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.kunzisoft.keepass.view.ToolbarAction
@@ -173,12 +187,6 @@
android:indeterminate="true" />
</FrameLayout>
- <include
- layout="@layout/view_button_lock"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"/>
-
</RelativeLayout>
<com.kunzisoft.keepass.view.NavigationDatabaseView
@@ -190,4 +198,4 @@
app:subheaderColor="?attr/colorAccent"
android:fitsSystemWindows="true" />
This is how it might look in other screens:
Of course I will make sure of:
- Buttons moves up
- RecyclerViews have
paddingBottom
andclipToPadding="false"
- Refactor
layout/view_button_lock.xml
so it can be reused in everyCoordinatorLayout
- Use a String resource for "Screenshot mode"
But basically that code would be the code
Seeing the screenshots I find that it is not very consistent. It should be a banner that always remains in the same place. Maybe it's better to put a high view, it would be the first view, above the toolbar. You don't have to make a snackbar if it causes problems. The code in the StylishActivity is fine.