Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gaba
fenix
Commits
9269a53b
Unverified
Commit
9269a53b
authored
Jun 21, 2020
by
Sachin
Committed by
GitHub
Jun 21, 2020
Browse files
for #11615 allowed strictMode disk read for violations made by the OS. (#11658)
parent
56ff4e47
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/org/mozilla/fenix/FenixApplication.kt
View file @
9269a53b
...
...
@@ -398,7 +398,11 @@ open class FenixApplication : LocaleAwareApplication() {
// are not triggered when also using createConfigurationContext like we do in LocaleManager
// https://issuetracker.google.com/issues/143570309#comment3
applicationContext
.
resources
.
configuration
.
uiMode
=
config
.
uiMode
super
.
onConfigurationChanged
(
config
)
// random StrictMode onDiskRead violation even when Fenix is not running in the background.
StrictMode
.
allowThreadDiskReads
().
resetPoliciesAfter
{
super
.
onConfigurationChanged
(
config
)
}
}
companion
object
{
...
...
app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt
View file @
9269a53b
...
...
@@ -7,6 +7,7 @@ package org.mozilla.fenix
import
android.app.Activity
import
android.content.Intent
import
android.os.Bundle
import
android.os.StrictMode
import
androidx.annotation.VisibleForTesting
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.launch
...
...
@@ -15,6 +16,7 @@ import org.mozilla.fenix.components.IntentProcessorType
import
org.mozilla.fenix.components.getType
import
org.mozilla.fenix.components.metrics.Event
import
org.mozilla.fenix.ext.components
import
org.mozilla.fenix.ext.resetPoliciesAfter
import
org.mozilla.fenix.ext.settings
import
org.mozilla.fenix.perf.StartupTimeline
import
org.mozilla.fenix.shortcut.NewTabShortcutIntentProcessor
...
...
@@ -26,7 +28,10 @@ class IntentReceiverActivity : Activity() {
@VisibleForTesting
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
// StrictMode violation on certain devices such as Samsung
StrictMode
.
allowThreadDiskReads
().
resetPoliciesAfter
{
super
.
onCreate
(
savedInstanceState
)
}
MainScope
().
launch
{
// The intent property is nullable, but the rest of the code below
...
...
@@ -57,8 +62,10 @@ class IntentReceiverActivity : Activity() {
intentProcessorType
.
shouldOpenToBrowser
(
intent
)
)
}
startActivity
(
intent
)
// StrictMode violation on certain devices such as Samsung
StrictMode
.
allowThreadDiskReads
().
resetPoliciesAfter
{
startActivity
(
intent
)
}
finish
()
// must finish() after starting the other activity
}
...
...
app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt
View file @
9269a53b
...
...
@@ -6,6 +6,7 @@ package org.mozilla.fenix.browser
import
android.content.Context
import
android.os.Bundle
import
android.os.StrictMode
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -40,6 +41,7 @@ import org.mozilla.fenix.ext.nav
import
org.mozilla.fenix.ext.navigateSafe
import
org.mozilla.fenix.ext.requireComponents
import
org.mozilla.fenix.ext.settings
import
org.mozilla.fenix.ext.resetPoliciesAfter
import
org.mozilla.fenix.shortcut.FirstTimePwaObserver
import
org.mozilla.fenix.trackingprotection.TrackingProtectionOverlay
...
...
@@ -90,22 +92,24 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
browserToolbarView
.
view
.
addPageAction
(
readerModeAction
)
readerViewFeature
.
set
(
feature
=
ReaderViewFeature
(
context
,
components
.
core
.
engine
,
components
.
core
.
store
,
view
.
readerViewControlsBar
)
{
available
,
active
->
if
(
available
)
{
components
.
analytics
.
metrics
.
track
(
Event
.
ReaderModeAvailable
)
}
feature
=
StrictMode
.
allowThreadDiskReads
().
resetPoliciesAfter
{
ReaderViewFeature
(
context
,
components
.
core
.
engine
,
components
.
core
.
store
,
view
.
readerViewControlsBar
)
{
available
,
active
->
if
(
available
)
{
components
.
analytics
.
metrics
.
track
(
Event
.
ReaderModeAvailable
)
}
readerModeAvailable
=
available
readerModeAction
.
setSelected
(
active
)
readerModeAvailable
=
available
readerModeAction
.
setSelected
(
active
)
runIfFragmentIsAttached
{
browserToolbarView
.
view
.
invalidateActions
()
browserToolbarView
.
toolbarIntegration
.
invalidateMenu
()
runIfFragmentIsAttached
{
browserToolbarView
.
view
.
invalidateActions
()
browserToolbarView
.
toolbarIntegration
.
invalidateMenu
()
}
}
},
owner
=
this
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment