bug 708283 - NullPointerException in VideoPlayer on launch r=dougt a=akeybl
authorBrad Lassey <blassey@mozilla.com>
Wed, 07 Dec 2011 09:43:34 -0800
changeset 79290 f5cdfc9cea2ea439bdea43e88d8866fc0baa8ecb
parent 79287 fcec1cc2c18fc76fb9f316cd768cbdb7801550c4
child 79294 07e3436ad32ae658b57e530a6c626e2d9bfbacff
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougt, akeybl
bugs708283
milestone9.0
bug 708283 - NullPointerException in VideoPlayer on launch r=dougt a=akeybl
embedding/android/AndroidManifest.xml.in
embedding/android/GeckoAppShell.java
embedding/android/VideoPlayer.java
--- a/embedding/android/AndroidManifest.xml.in
+++ b/embedding/android/AndroidManifest.xml.in
@@ -120,14 +120,13 @@
                 <action android:name="android.intent.action.CREATE_SHORTCUT" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
         <activity android:name="org.mozilla.gecko.VideoPlayer"
                   android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation" 
                   android:theme="@android:style/Theme.NoTitleBar" >
             <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
+                <action android:name="org.mozilla.gecko.PLAY_VIDEO" />
             </intent-filter>
         </activity>
     </application>
 </manifest> 
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -803,17 +803,17 @@ public class GeckoAppShell
         } else if (aMimeType.length() > 0) {
             intent.setDataAndType(Uri.parse(aUriSpec), aMimeType);
         } else {
             Uri uri = Uri.parse(aUriSpec);
             if ("vnd.youtube".equals(uri.getScheme())) {
                 // Special case youtube to fallback to our own player
                 String[] handlers = getHandlersForURL(aUriSpec, aAction);
                 if (handlers.length == 0) {
-                    intent = new Intent(Intent.ACTION_MAIN);
+                    intent = new Intent(VideoPlayer.VIDEO_ACTION);
                     intent.setClassName(GeckoApp.mAppContext.getPackageName(),
                                         "org.mozilla.gecko.VideoPlayer");
                     intent.setData(uri);
                     GeckoApp.mAppContext.startActivity(intent);
                     return true;
                 }
             }
             if ("sms".equals(uri.getScheme())) {
--- a/embedding/android/VideoPlayer.java
+++ b/embedding/android/VideoPlayer.java
@@ -44,27 +44,31 @@ import java.io.*;
 import java.util.*;
 import android.util.*;
 import android.widget.*;
 import android.net.*;
 import android.content.Intent;
 
 public class VideoPlayer extends Activity
 {
+    public static final String VIDEO_ACTION = "org.mozilla.gecko.PLAY_VIDEO";
+
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.videoplayer);
         mVideoView = (VideoView) findViewById(R.id.VideoView);
         MediaController mediaController = new MediaController(this);
         mediaController.setAnchorView(mVideoView);
         Intent intent = getIntent();
         Uri data = intent.getData();
+        if (data == null)
+            return;
         String spec = null;
         if ("vnd.youtube".equals(data.getScheme())) {
             String ssp = data.getSchemeSpecificPart();
             String id = ssp.substring(0, ssp.indexOf('?'));
             spec = getSpecFromYouTubeVideoID(id);
         }
         if (spec == null)
             return;