Skip to content

Commit

Permalink
Workaround for mozilla-lockwise#1076 and mozilla-lockwise#1157 - Ille…
Browse files Browse the repository at this point in the history
…galStateException in autofill activity

  It seems that in Android 8.0.0 (API 26) there is a bug where setting the
auto fill activity window to translucent causes an exception to be thrown.
Per mozilla-lockwise#1076 it doesn't happen on Android 8.1.

  This patch works around the problem by not setting the window to be
translucent on API 26 only. The window is (obviously) not translucent, but
the App doesn't crash and is otherwise usable.
  • Loading branch information
Governa authored and Fernando Governatore committed Jun 26, 2020
1 parent 436557c commit f2e834b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/src/main/res/values-v26/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
~ This Source Code Form is subject to the terms of the Mozilla Public
~ License, v. 2.0. If a copy of the MPL was not distributed with this
~ file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<resources>
<!-- Bug #1076 workaround: windowIsTranslucent -> false -->
<style name="NoBackgroundTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:popupBackground">@android:color/transparent</item>
</style>
</resources>
19 changes: 19 additions & 0 deletions app/src/main/res/values-v27/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
~ This Source Code Form is subject to the terms of the Mozilla Public
~ License, v. 2.0. If a copy of the MPL was not distributed with this
~ file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<resources>
<!-- Undo bug #1076 workaround (see values-26/styles.xml) -->
<style name="NoBackgroundTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:background">@android:color/transparent</item>
<item name="colorPrimaryDark">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:popupBackground">@android:color/transparent</item>
</style>
</resources>

0 comments on commit f2e834b

Please sign in to comment.