javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java
branchRCL_3
changeset 46 4376525cdefb
parent 34 71c436fe3ce0
child 87 1627c337e51e
--- a/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java	Wed Jun 09 09:34:07 2010 +0300
+++ b/javaruntimes/midp/runtime/javasrc/com/nokia/mj/impl/rt/midp/MidletLifeCycle.java	Mon Jun 21 15:32:50 2010 +0300
@@ -27,6 +27,8 @@
 
 import java.security.AccessControlException;
 
+import com.nokia.mj.impl.gcf.PushSecurityUtils;
+
 import com.nokia.mj.impl.rt.utils.ExtensionUtil;
 import com.nokia.mj.impl.rt.utils.CmdLineArgsPermission;
 
@@ -992,16 +994,35 @@
             DrmUtil.consumeRightsStart();
         }
 
-        // If the MIDlet launch is a result of auto invocation we need to
+        // If the MIDlet launch is a result of push auto invocation we need to
         // ensure that user allows the start up.
-        if ((mMainArgs.findArgument("-autoinvocation") != null) ||
-                mAutoinvocationFromUrl)
+        if (mMainArgs.findArgument("-autoinvocation") != null)
         {
-            if (Log.mOn) Log.logI("Ensuring autoinvocation.");
+            if (Log.mOn) Log.logI("Ensuring push autoinvocation.");
             String pushAdditionalInfo =
                 mMainArgs.findArgument("-autoInvocationAdditional");
             if (Log.mOn) Log.logI("  addInfo: '" + pushAdditionalInfo + "'");
 
+            try
+            {
+                PushSecurityUtils.ensurePermission("autoinvocation",
+                                                   pushAdditionalInfo);
+            }catch(SecurityException e)
+            {
+                // The user didn't allow starting. Throw StartupException and
+                // mark it as non fatal.
+                if (Log.mOn) Log.logI("Push autoinvocation NOT allowed.");                
+                throw new StartupException(e.toString(),
+                                           false);
+            }
+        }
+        
+        // If the MIDlet launch is triggered from url we need to
+        // ensure that user allows the start up.
+        if (mAutoinvocationFromUrl)
+        {
+            if (Log.mOn) Log.logI("Ensuring web start invocation.");
+
             // ensure security
             try
             {
@@ -1009,10 +1030,10 @@
                 CmdLineArgsPermission cmdLineArgsPermission = 
                     new CmdLineArgsPermission();
                 appUtils.checkPermission(cmdLineArgsPermission);
-                if (Log.mOn) Log.logI("Autoinvocation allowed.");
+                if (Log.mOn) Log.logI("Web start invocation allowed.");
             }catch(AccessControlException e)
             {
-                if (Log.mOn) Log.logI("Autoinvocation NOT allowed.");                
+                if (Log.mOn) Log.logI("Web start invocation NOT allowed.");                
                 throw new StartupException(e.toString(),
                                            false);
             }