Closed Bug 894567 Opened 11 years ago Closed 5 years ago

getScreenDepth does disk I/O on java UI thread

Categories

(Firefox for Android Graveyard :: General, defect, P3)

All
Android
defect

Tracking

(firefox-esr60 wontfix, firefox-esr68 wontfix, firefox67 wontfix, firefox67.0.1 wontfix, firefox68 wontfix, firefox69 fixed)

RESOLVED FIXED
Firefox 69
Tracking Status
firefox-esr60 --- wontfix
firefox-esr68 --- wontfix
firefox67 --- wontfix
firefox67.0.1 --- wontfix
firefox68 --- wontfix
firefox69 --- fixed

People

(Reporter: kats, Assigned: whawkins)

References

Details

(Whiteboard: [geckoview:p3])

Attachments

(1 file)

07-16 15:47:31.910 D/StrictMode(31694): StrictMode policy violation; ~duration=4 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=31 violation=2
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1134)
07-16 15:47:31.910 D/StrictMode(31694):     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:106)
07-16 15:47:31.910 D/StrictMode(31694):     at libcore.io.IoBridge.open(IoBridge.java:393)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.FileInputStream.<init>(FileInputStream.java:78)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.FileInputStream.<init>(FileInputStream.java:105)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.FileReader.<init>(FileReader.java:66)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.GeckoAppShell.isHighMemoryDevice(GeckoAppShell.java:1345)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.GeckoAppShell.getScreenDepth(GeckoAppShell.java:1380)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController.chooseConfig(GLController.java:218)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController.initEGL(GLController.java:210)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController.access$400(GLController.java:31)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController$1.run(GLController.java:151)
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.Handler.handleCallback(Handler.java:730)
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.Looper.loop(Looper.java:137)
07-16 15:47:31.910 D/StrictMode(31694):     at android.app.ActivityThread.main(ActivityThread.java:5368)
07-16 15:47:31.910 D/StrictMode(31694):     at java.lang.reflect.Method.invokeNative(Native Method)
07-16 15:47:31.910 D/StrictMode(31694):     at java.lang.reflect.Method.invoke(Method.java:525)
07-16 15:47:31.910 D/StrictMode(31694):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
07-16 15:47:31.910 D/StrictMode(31694):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
07-16 15:47:31.910 D/StrictMode(31694):     at dalvik.system.NativeStart.main(Native Method)
07-16 15:47:31.910 D/StrictMode(31694): StrictMode policy violation; ~duration=2 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=31 violation=2
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1134)
07-16 15:47:31.910 D/StrictMode(31694):     at libcore.io.BlockGuardOs.read(BlockGuardOs.java:148)
07-16 15:47:31.910 D/StrictMode(31694):     at libcore.io.IoBridge.read(IoBridge.java:425)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.FileInputStream.read(FileInputStream.java:179)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.InputStreamReader.read(InputStreamReader.java:244)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.BufferedReader.fillBuf(BufferedReader.java:130)
07-16 15:47:31.910 D/StrictMode(31694):     at java.io.BufferedReader.readLine(BufferedReader.java:354)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.GeckoAppShell.isHighMemoryDevice(GeckoAppShell.java:1349)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.GeckoAppShell.getScreenDepth(GeckoAppShell.java:1380)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController.chooseConfig(GLController.java:218)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController.initEGL(GLController.java:210)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController.access$400(GLController.java:31)
07-16 15:47:31.910 D/StrictMode(31694):     at org.mozilla.gecko.gfx.GLController$1.run(GLController.java:151)
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.Handler.handleCallback(Handler.java:730)
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-16 15:47:31.910 D/StrictMode(31694):     at android.os.Looper.loop(Looper.java:137)
07-16 15:47:31.910 D/StrictMode(31694):     at android.app.ActivityThread.main(ActivityThread.java:5368)
07-16 15:47:31.910 D/StrictMode(31694):     at java.lang.reflect.Method.invokeNative(Native Method)
07-16 15:47:31.910 D/StrictMode(31694):     at java.lang.reflect.Method.invoke(Method.java:525)
07-16 15:47:31.910 D/StrictMode(31694):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
07-16 15:47:31.910 D/StrictMode(31694):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
07-16 15:47:31.910 D/StrictMode(31694):     at dalvik.system.NativeStart.main(Native Method)
Assignee: nobody → whawkins

This is still an issue. We read from /proc/meminfo to determine the total available memory on the device. As long as we do not plan on supporting Android OS versions < 16, we can replace this disk I/O with https://developer.android.com/reference/android/app/ActivityManager.MemoryInfo.html#totalMem.

Does this seem sane? If so, I will be glad to make the change.

Flags: needinfo?(cpeterson)

(In reply to Will Hawkins from comment #1)

As long as we do not plan on supporting Android OS versions < 16, we can replace this disk I/O with https://developer.android.com/reference/android/app/ActivityManager.MemoryInfo.html#totalMem.

Does this seem sane? If so, I will be glad to make the change.

Good news! Fennec requires Android 4.1 (API level 16) or later, so feel free to replace this code.

For comparison, GeckoView requires Android OS version 4.3 (API Level 18) and Fenix requires Android 5.0 (API level 21).

Flags: needinfo?(cpeterson)
Priority: -- → P3
Whiteboard: [geckoview:p3]
Attachment #9069470 - Flags: feedback?(nalexander)
Attachment #9069470 - Flags: feedback?(cpeterson)
Status: NEW → ASSIGNED

Comment on attachment 9069470 [details]
Bug 894567: Use MemoryInfo.totalMem to get the device's total memory rather than parse /proc/meminfo.

f+

LGTM, but I don't have the authority to review this code. :)

Attachment #9069470 - Flags: feedback?(cpeterson) → feedback+
Keywords: checkin-needed

Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/691239688a43
Use MemoryInfo.totalMem to get the device's total memory rather than parse /proc/meminfo. r=nalexander

Keywords: checkin-needed

68=wontfix because we don't need to uplift this optimization to Beta.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
Attachment #9069470 - Flags: feedback?(nalexander)

esr68=wontfix because we don't need to uplift this optimization for Fennec 68.

Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: