Closed
Bug 1016747
Opened 11 years ago
Closed 11 years ago
add android protocol handler to proxy input streams to Gecko
Categories
(Core Graveyard :: Widget: Android, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla32
People
(Reporter: blassey, Assigned: blassey)
References
(Depends on 1 open bug)
Details
Attachments
(1 file, 6 obsolete files)
21.22 KB,
patch
|
snorp
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Attachment #8429716 -
Flags: review?(snorp)
Assignee | ||
Comment 1•11 years ago
|
||
this uses NIO to avoid copying the buffer
Assignee: nobody → blassey.bugs
Attachment #8429716 -
Attachment is obsolete: true
Attachment #8429716 -
Flags: review?(snorp)
Attachment #8429780 -
Flags: review?(snorp)
Comment 2•11 years ago
|
||
Comment on attachment 8429780 [details] [diff] [review]
android_protocol.patch
Review of attachment 8429780 [details] [diff] [review]:
-----------------------------------------------------------------
Minus mostly for nits. Looks cool, but what does android:// actually refer to? Do we need to define that still?
::: mobile/android/base/GeckoAppShell.java
@@ +2722,5 @@
> toast.show();
> }
>
> + @WrapElementForJNI(stubName = "InputStreamCreateWrapper")
> + static InputStream inputStreamCreate(URLConnection connection) throws IOException {
createInputStream seems to be closer to convention in the file
@@ +2744,5 @@
> + return new URL(spec).openConnection();
> + }
> +
> + @WrapElementForJNI(stubName = "ConnectionGetMimeTypeWrapper")
> + static String connectionGetMimeType(URLConnection connection) {
getConnectionMimeType?
::: widget/android/AndroidBridge.cpp
@@ +206,4 @@
> jEGLSurfacePointerField = 0;
> }
>
> + jGeckoAppShell = getClassGlobalRef("org/mozilla/gecko/GeckoAppShell");
Isn't this stuff in GeneratedJNIWrappers?
@@ +2117,5 @@
> }
> return -1;
> }
> +
> +jobject AndroidBridge::GetConnection(nsIURI* aURI) {
Do we need this in addition to the generated one?
@@ +2131,5 @@
> + }
> + return env->NewGlobalRef(connection);
> +}
> +
> +jobject AndroidBridge::InputStreamCreate(jobject connection) {
Same
::: widget/android/nsAndroidProtocolHandler.cpp
@@ +65,5 @@
> + AndroidChannel(nsIURI *aURI, jobject aConnection) :
> + mConnection(aConnection) {
> + mURI = aURI;
> + nsCString type;
> + if (NS_OK == mozilla::AndroidBridge::ConnectionGetMimeType(mConnection, type))
NS_SUCCEDED(mozilla::AndroidBridge::..) perhaps
Attachment #8429780 -
Flags: review?(snorp) → review-
Assignee | ||
Comment 3•11 years ago
|
||
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #2)
> ::: widget/android/AndroidBridge.cpp
> @@ +206,4 @@
> > jEGLSurfacePointerField = 0;
> > }
> >
> > + jGeckoAppShell = getClassGlobalRef("org/mozilla/gecko/GeckoAppShell");
>
> Isn't this stuff in GeneratedJNIWrappers?
It is, but its private.
>
> @@ +2117,5 @@
> > }
> > return -1;
> > }
> > +
> > +jobject AndroidBridge::GetConnection(nsIURI* aURI) {
>
> Do we need this in addition to the generated one?
The generated one uses GetJNIEnv(), which only works on the main gecko thread. These functions need to run background threads and are implemented with GetJNIForThread()
Comment 4•11 years ago
|
||
(In reply to Brad Lassey [:blassey] (use needinfo?) from comment #3)
> (In reply to James Willcox (:snorp) (jwillcox@mozilla.com) from comment #2)
> > ::: widget/android/AndroidBridge.cpp
> > @@ +206,4 @@
> > > jEGLSurfacePointerField = 0;
> > > }
> > >
> > > + jGeckoAppShell = getClassGlobalRef("org/mozilla/gecko/GeckoAppShell");
> >
> > Isn't this stuff in GeneratedJNIWrappers?
> It is, but its private.
> >
> > @@ +2117,5 @@
> > > }
> > > return -1;
> > > }
> > > +
> > > +jobject AndroidBridge::GetConnection(nsIURI* aURI) {
> >
> > Do we need this in addition to the generated one?
> The generated one uses GetJNIEnv(), which only works on the main gecko
> thread. These functions need to run background threads and are implemented
> with GetJNIForThread()
The @WrapElementForJNI annotation supports an 'allowMultithread' property which should fix that for you.
If there are other things preventing you from using the generated wrappers we should try to fix that too. Otherwise you can just replace @WrapElementForJNI with @JNITarget since you aren't using the generated code at all, AFAICT.
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #8429780 -
Attachment is obsolete: true
Attachment #8430090 -
Flags: review?(snorp)
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #8430090 -
Attachment is obsolete: true
Attachment #8430090 -
Flags: review?(snorp)
Attachment #8430282 -
Flags: review?(snorp)
Assignee | ||
Comment 7•11 years ago
|
||
This patch avoids some character conversions by annotating the generated functions to use narrow chars (UTF-8) and adding an nsJNICString class.
Attachment #8430467 -
Flags: review?(snorp)
Updated•11 years ago
|
Attachment #8430282 -
Flags: review?(snorp) → review+
Comment 8•11 years ago
|
||
Comment on attachment 8430467 [details] [diff] [review]
narrow_char_support.patch
Review of attachment 8430467 [details] [diff] [review]:
-----------------------------------------------------------------
nice, how did we not already need this?
Attachment #8430467 -
Flags: review?(snorp) → review+
Assignee | ||
Comment 9•11 years ago
|
||
Attachment #8430282 -
Attachment is obsolete: true
Attachment #8430467 -
Attachment is obsolete: true
Attachment #8434376 -
Flags: review?(snorp)
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8434376 -
Attachment is obsolete: true
Attachment #8434376 -
Flags: review?(snorp)
Attachment #8434389 -
Flags: review?(snorp)
Updated•11 years ago
|
Attachment #8434389 -
Flags: review?(snorp) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Comment 12•9 years ago
|
||
snorp: I can't see any consumers of "android://" in the tree. (Not even tests!) This code looks like it allows to load App icons from arbitrary packages, which I imagine had something to do with the WebAppRT. Is that correct? Can we remove this now?
Flags: needinfo?(snorp)
I actually can't remember why we added this, but I don't see anything using it either. Brad, do you remember why we have this?
Flags: needinfo?(snorp) → needinfo?(blassey.bugs)
Assignee | ||
Comment 14•9 years ago
|
||
This was for getting icons from the system, originally for a gecko-based homescreen. Fabrice, is that still a thing?
Flags: needinfo?(blassey.bugs) → needinfo?(fabrice)
Comment 16•9 years ago
|
||
blassey, fabrice: thanks for confirming.
This code isn't used right now, but it's a valuable demonstration of how to add an Android specific Gecko protocol. I added resource://android/assets for this reason, more or less, but it would be nice to support Webview's file:///android_asset and file:///android_res (see https://developer.android.com/reference/android/webkit/WebSettings.html) exactly. Maybe this code would let us do that?
Updated•4 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•