New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 651076 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

[Physical Web] Problems with the Physical Web diagnostic page.

Reported by pritam.n...@samsung.com, Sep 28 2016

Issue description

Version: Chromium for Android (55.0.2875.0 Dev Build)
OS: Android v6.0.1 and v5.0

What steps will reproduce the problem?
(1) Enable the "Physical Web" feature from about:flags page (followed the instructions found here [A]).
(2) Open the diagnostic page i.e. "about:physical-web".
(3) Tap on "BROWSE THE PHYSICAL WEB" button.


What is the expected output?
1. 
   Status
   Physical Web is ON

2. Tapping on "BROWSE THE PHYSICAL WEB" shall show "The Physical Web" tab.

What do you see instead?
1. 
  Status
  Physical Web is OFF

2. Tapping on "BROWSE THE PHYSICAL WEB" results into application crash.

Please use labels and text to provide additional information.

Attached a screen shot for the diagnostic page.

[A] https://support.google.com/chrome/answer/6239299?hl=en
 
Screenshot_20160928-192115.png
116 KB View Download
I'm not sure whether any step I've missed to switch on *physical-web* feature.
In case, this is a duplicate issue please ignore.


Moreover, the excerpt below from "dumpstate_app_error.*", looks like its trying to handle link click & launch an activity (i.e. startActivity()) using application context instead of an activity instance and that would have resulted into FATAL.

[Stack trace]
09-28 18:40:20.795  9957  9957 D AndroidRuntime: Shutting down VM
09-28 18:40:20.795  9957  9957 E AndroidRuntime: FATAL EXCEPTION: main
09-28 18:40:20.795  9957  9957 E AndroidRuntime: Process: org.chromium.chrome, PID: 9957
09-28 18:40:20.795  9957  9957 E AndroidRuntime: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.app.ContextImpl.startActivity(ContextImpl.java:1540)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.app.ContextImpl.startActivity(ContextImpl.java:1527)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.content.ContextWrapper.startActivity(ContextWrapper.java:337)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at org.chromium.chrome.browser.physicalweb.PhysicalWebDiagnosticsPage$1.onClick(PhysicalWebDiagnosticsPage.java:66)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.view.View.performClick(View.java:5156)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.view.View$PerformClick.run(View.java:20755)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:145)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:5832)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Method.java:372)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
09-28 18:40:20.795  9957  9957 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)


A recommended way to solve this problem is to cache the activity reference and use it to startActivity() instead of app context.  

A lesser recommended solution would be to supply an additional flag *FLAG_ACTIVITY_NEW_TASK* along the intent to startActivity().

I've tried below patch to avoid this crash.

diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebDiagnosticsPage.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/P
index 32a7d7a..0629a62 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebDiagnosticsPage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebDiagnosticsPage.java
@@ -216,8 +216,10 @@ public class PhysicalWebDiagnosticsPage extends BasicNativePage {
     }
 
     private static Intent createListUrlsIntent() {
-        return new Intent(ContextUtils.getApplicationContext(), ListUrlsActivity.class)
-                .putExtra(ListUrlsActivity.REFERER_KEY, ListUrlsActivity.DIAGNOSTICS_REFERER);
+        Intent intent = new Intent(ContextUtils.getApplicationContext(), ListUrlsActivity.class);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        intent.putExtra(ListUrlsActivity.REFERER_KEY, ListUrlsActivity.DIAGNOSTICS_REFERER);
+        return intent;
     }
 
     private static String colorToHexValue(int color) {

Did you ever receive a notification to opt into Physical Web? Since oyu have location + bluetooth on, you should've received it when you were first near a beacon (it'll be a higher priority, buzzing notification)

Comment 3 by cco3@chromium.org, Sep 28 2016

The step you are missing is to go to settings->privacy->physical web->switch on

There's an activity in scope when we create the onClickListener...it should be easy enough to use the activity rather than the application context.  Thanks for the report!

Comment 4 by cco3@chromium.org, Sep 28 2016

Owner: cco3@chromium.org
Thanks animohan@ & cco3@ for reply.

With just *location + Bluetooth on*, I didn't receive any notification, as I move near to beacon's proximity.

With "settings->privacy->physical web->switch on", the Physical Web diagnostics page shows status as *Physical Web is ON*.

I'll try to use the |activity| to start ListUrlsActivity to fix this crash.
Thanks!
Project Member

Comment 6 by bugdroid1@chromium.org, Sep 28 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d67018f2cc74b4763205465fff5dc4ac31ab9103

commit d67018f2cc74b4763205465fff5dc4ac31ab9103
Author: hayesjordan <hayesjordan@google.com>
Date: Wed Sep 28 20:46:15 2016

Fix crash when clicking BROWSE THE PHYSICAL WEB

When the enable-physical-web flag is enabled but the setting under
settings->privacy->physical web is off, the user can cause chrome to
crash by going to chrome://physical-web and clicking the "BROWSE THE
PHYSICAL WEB" button.

BUG= 651076 

Review-Url: https://codereview.chromium.org/2378853002
Cr-Commit-Position: refs/heads/master@{#421635}

[modify] https://crrev.com/d67018f2cc74b4763205465fff5dc4ac31ab9103/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebDiagnosticsPage.java

Comment 7 by cco3@chromium.org, Sep 28 2016

Status: Fixed (was: Untriaged)

Comment 8 by cco3@chromium.org, Oct 10 2016

Issue 654572 has been merged into this issue.

Comment 9 by cco3@chromium.org, Oct 10 2016

Status: Started (was: Fixed)

Comment 10 by cco3@chromium.org, Oct 10 2016

Labels: M-54

Comment 11 by cco3@chromium.org, Oct 11 2016

Labels: Merge-Request-54

Comment 12 by dimu@chromium.org, Oct 11 2016

Labels: -Merge-Request-54 Merge-Review-54 Hotlist-Merge-Review
[Automated comment] Less than 2 weeks to go before stable on M54, manual review required.
If one of the prerequisites (like Bluetooth) is disabled and Physical Web status is off, doesn't it make sense to disable the "Browse the Physical Web" button. As I see now, it is enabled even when Physical Web status is Off.

Comment 14 by cco3@chromium.org, Oct 12 2016

Yes, it'd be good to do that.  That can be done in a different change.
Labels: ReleaseBlock-Beta
Labels: -ReleaseBlock-Beta ReleaseBlock-Stable
Labels: -ReleaseBlock-Stable -Merge-Review-54 Merge-Approved-54
Since this only manifests on an internal page (about:physical-web) I'm not going to block the M54 stable release on it - cco3@ agreed over chat, animohan@ please correct us if you disagree.

That said, given how safe the merge for this would be, please go ahead and merge in the next day or two if you want this fix included in the M54 stable release.  Merge approved for M54 branch 2840.
+1 -- I'm ok with not blocking on this

Comment 19 by cco3@chromium.org, Oct 12 2016

Cc: amineer@chromium.org
I don't have committer status, but this is the command:
git drover --branch 2840 --cherry-pick d67018f2cc74b4763205465fff5dc4ac31ab9103

Alex, would you be willing to land it?
Status: Fixed (was: Started)
Merged!  (bugdroid should catch up soon).

Comment 21 by cco3@chromium.org, Oct 12 2016

Thank you!
Labels: -Merge-Approved-54
This was already merged.

Sign in to add a comment