Methods Summary |
---|
protected void | closeSuite()Overrides suite close logic for the AMS task
super.closeSuite();
// shutdown any preempting
if (displayEventHandler != null) {
displayEventHandler.donePreempting(null);
}
|
protected MIDletSuite | createMIDletSuite()Creates MIDlet suite instance by suite ID
MIDletSuiteStorage storage;
MIDletSuite suite = null;
if (suiteId == MIDletSuite.INTERNAL_SUITE_ID) {
// assume a class name of a MIDlet in the classpath
suite = InternalMIDletSuiteImpl.create(midletDisplayName, suiteId);
} else {
storage = MIDletSuiteStorage.
getMIDletSuiteStorage(internalSecurityToken);
suite = storage.getMIDletSuite(suiteId, false);
Logging.initLogSettings(suiteId);
}
return suite;
|
protected void | createSuiteEnvironment()Creates environment objects needed to AMS task
foregroundController = this;
// creates display container, needs foregroundController
super.createSuiteEnvironment();
midletStateHandler =
MIDletStateHandler.getMidletStateHandler();
MIDletSuiteStorage mss =
MIDletSuiteStorage.getMIDletSuiteStorage(internalSecurityToken);
midletStateHandler.initMIDletStateHandler(
internalSecurityToken,
this,
new CdcMIDletLoader(mss),
this);
|
public boolean | dispatch(java.lang.String URL)
throw new ConnectionNotFoundException("not implemented");
|
protected void | displayException(java.lang.String exceptionMsg)Displays an exception message to user
System.err.println(exceptionMsg);
|
protected void | exitLoader()Gracefully terminates VM with proper return code
|
protected static int | getErrorCode(java.lang.Throwable t)Gets error code by exception type
if (t instanceof ClassNotFoundException) {
return Constants.MIDLET_CLASS_NOT_FOUND;
} else if (t instanceof InstantiationException) {
return Constants.MIDLET_INSTANTIATION_EXCEPTION;
} else if (t instanceof IllegalAccessException) {
return Constants.MIDLET_ILLEGAL_ACCESS_EXCEPTION;
} else if (t instanceof OutOfMemoryError) {
return Constants.MIDLET_OUT_OF_MEM_ERROR;
} else if (t instanceof MIDletSuiteLockedException) {
return Constants.MIDLET_INSTALLER_RUNNING;
} else {
return Constants.MIDLET_CONSTRUCTOR_FAILED;
}
|
protected static java.lang.String | getErrorMessage(int errorCode)Gets AMS error message by generic error code.
switch (errorCode) {
case Constants.MIDLET_SUITE_DISABLED:
return "MIDlet suite dispabled.";
case Constants.MIDLET_SUITE_NOT_FOUND:
return "MIDlet suite not found.";
case Constants.MIDLET_CLASS_NOT_FOUND:
return "MIDlet class not found.";
case Constants.MIDLET_INSTANTIATION_EXCEPTION:
return "Cannot launch MIDlet due to illegal operation.";
case Constants.MIDLET_ILLEGAL_ACCESS_EXCEPTION:
return "Cannot launch MIDlet due to illegal operation.";
case Constants.MIDLET_OUT_OF_MEM_ERROR:
return "Out of memory";
}
return "MIDlet suite has unexpectedly quit.";
|
public void | handleException(java.lang.Throwable t)Handles exceptions happened during MIDlet suite execution.
t.printStackTrace();
int errorCode = getErrorCode(t);
if (Logging.TRACE_ENABLED) {
Logging.trace(t,
"Exception caught in CdcMIDletSuiteLoader");
}
reportError(errorCode, t.getMessage());
|
protected void | init()Extends base class initialization with initializatons
specific for the AMS task
super.init();
|
protected void | initSuiteEnvironment()Inits created MIDlet suite environment objects and global
subsystems needed for all suites.
The method also loads MIDlet suite paramaters and arguments
from the natively saved CommandState instance.
super.initSuiteEnvironment();
// Init internal state from the restored command state
externalAppId = 0;
midletDisplayName = null;
|
public static void | main(java.lang.String[] args)Called at the initial start of the VM.
Initializes internal security and any other AMS classes related
classes before starting the MIDlet.
try {
CDCInit.init();
CdcMIDletSuiteLoader loader = new CdcMIDletSuiteLoader();
if (args.length < 1) {
System.err.println("The suite ID for the " +
"MIDlet suite was not given");
throw new IllegalArgumentException("Suite ID absent");
}
try {
loader.suiteId = Integer.parseInt(args[0]);
} catch (Throwable t) {
throw new
IllegalArgumentException("Suite ID: " + t.getMessage());
}
if (args.length < 2) {
System.err.println("The class name for the " +
"MIDlet was not given");
throw new
IllegalArgumentException("MIDlet class name absent.");
}
loader.midletClassName = args[1];
int numberOfSuiteArgs = args.length - 2;
if (numberOfSuiteArgs > 0) {
loader.args = new String[numberOfSuiteArgs];
for (int i = 0; i < numberOfSuiteArgs; i++) {
loader.args[i] = args[i + 2];
}
}
loader.runMIDletSuite();
} catch (Throwable t) {
t.printStackTrace();
}
|
public void | midletActivated(MIDletSuite suite, javax.microedition.midlet.MIDlet midlet)Called after a MIDlet is successfully activated. This is after
the startApp method is called.
This implementation does nothing.
|
public void | midletCreated(MIDletSuite suite, java.lang.String className, int externalAppId)Called after a MIDlet is successfully created.
This implementation does nothing.
|
public void | midletDestroyed(MIDletSuite suite, java.lang.String className)Called after a MIDlet is successfully destroyed.
This implementation does nothing.
displayContainer.removeDisplay(className);
|
public void | midletPaused(MIDletSuite suite, java.lang.String className)Called after a MIDlet is successfully paused.
This implementation does nothing.
|
public void | midletPausedItself(MIDletSuite suite, java.lang.String className)Called after a MIDlet pauses itself. In this case pauseApp has
not been called.
|
public void | midletPreStart(MIDletSuite suite, java.lang.String className)Called before a MIDlet is created.
This implementation does nothing.
|
public void | preActivated(MIDletSuite suite, java.lang.String className)Called before a MIDlet is activated.
This implementation does nothing.
|
public javax.microedition.lcdui.Displayable | registerDisplay(int displayId, java.lang.String ownerClassName)Called to register a newly create Display. Must method must
be called before the other methods can be called.
This implementation does nothing.
currentDisplayId = displayId;
return null;
|
protected void | reportError(int errorCode, java.lang.String details)Updates CommandState status and displays proper
exception message to user
String errorMsg = getErrorMessage(errorCode);
if (details != null) {
errorMsg += "\n\n" + details;
}
displayException(errorMsg);
// Error message is always obtained for logging
if (Logging.REPORT_LEVEL <= Logging.ERROR) {
Logging.report(Logging.ERROR, LogChannels.LC_CORE, errorMsg);
}
|
public void | requestBackground(int displayId)Called to request the background.
This implementation does nothing.
ForegroundEventConsumer fc =
displayContainer.findForegroundEventConsumer(displayId);
if (fc == null) {
return;
}
fc.handleDisplayBackgroundNotifyEvent();
|
public void | requestForeground(int displayId, boolean isAlert)Called to request the foreground.
This implementation does nothing.
ForegroundEventConsumer fc =
displayContainer.findForegroundEventConsumer(displayId);
if (fc == null) {
return;
}
setForegroundInNativeState(displayId);
fc.handleDisplayForegroundNotifyEvent();
|
public void | resumeRequest(MIDletSuite suite, java.lang.String className)Called when a MIDlet calls MIDlet resume request.
MIDletEventConsumer mec =
midletStateHandler.getMIDletEventConsumer(internalSecurityToken,
className);
if (mec == null) {
return;
}
mec.handleMIDletActivateEvent();
|
private native void | setForegroundInNativeState(int displayId)Set foreground display native state, so the native code will know
which display can draw.
|
public void | startPreempting(int displayId)Called to start preempting. The given display will preempt all other
displays for this isolate.
requestBackground(currentDisplayId);
requestForeground(displayId, true);
|
public void | stopPreempting(int displayId)Called to end preempting.
requestBackground(displayId);
requestForeground(currentDisplayId, false);
|