installstateimpl.java

来自「This is a resource based on j2me embedde」· Java 代码 · 共 584 行 · 第 1/2 页

JAVA
584
字号
         * only available to callers with the AMS permission, which         * have permission to build auth paths for new suites.         */        return installInfo.getAuthPath();    }    /**     * Checks for permission and throw an exception if not allowed.     * May block to ask the user a question.     *     * @param permission name of the permission to check     * @param resource string to insert into the question, can be null if     *        no %2 in the question     *     * @exception SecurityException if the permission is not     *            allowed by this token     * @exception InterruptedException if another thread interrupts the     *   calling thread while this method is waiting to preempt the     *   display.     */    public void checkForPermission(String permission, String resource)            throws InterruptedException {        checkForPermission(permission, resource, null);    }    /**     * Checks for permission and throw an exception if not allowed.     * May block to ask the user a question.     *     * @param permissionStr the permission name to check for,     * @param resource string to insert into the question, can be null if     *        no %2 in the question     * @param extraValue string to insert into the question,     *        can be null if no %3 in the question     *     * @exception SecurityException if the permission is not     *            allowed by this token     * @exception InterruptedException if another thread interrupts the     *   calling thread while this method is waiting to preempt the     *   display.     */    public void checkForPermission(String permissionStr, String resource,            String extraValue) throws InterruptedException {		int permission = Permissions.getId(permissionStr);        securityHandler.checkForPermission(permissionStr,            Permissions.getTitle(permission),            Permissions.getQuestion(permission),            Permissions.getOneshotQuestion(permission),            installInfo.suiteName, resource, extraValue,            permissionStr);    }    /**     * Indicates if the named MIDlet is registered in the suite     * with MIDlet-&lt;n&gt; record in the manifest or     * application descriptor.     * @param midletName class name of the MIDlet to be checked     *     * @return true if the MIDlet is registered     */    public boolean isRegistered(String midletName) {        String midlet;        MIDletInfo midletInfo;        for (int i = 1; ; i++) {            midlet = getAppProperty("MIDlet-" + i);            if (midlet == null) {                return false; // We went past the last MIDlet            }            /* Check if the names match. */            midletInfo = new MIDletInfo(midlet);            if (midletInfo.classname.equals(midletName)) {                return true;            }        }    }    /**     * Counts the number of MIDlets from its properties.     * IMPL_NOTE: refactor to avoid duplication with MIDletSuiteImpl.     *     * @return number of midlet in the suite     */    public int getNumberOfMIDlets() {        int i;        for (i = 1; getProperty("MIDlet-" + i) != null; i++);        return (i-1);    }    /**     * Returns the suite's name to display to the user.     *     * @return suite's name that will be displayed to the user     */    public String getDisplayName() {        String displayName = getAppProperty(MIDletSuite.SUITE_NAME_PROP);        if (displayName == null) {            displayName = String.valueOf(installInfo.id);        }        return displayName;    }    /**     * Returns the information about the first midlet in the suite.     *     * @return MIDletInfo structure describing the first midlet     * or null if it is not available     */    public MIDletInfo getMidletInfo() {        String midlet;        midlet = getAppProperty("MIDlet-1");        if (midlet == null) {            return null;        }        return new MIDletInfo(midlet);    }    /**     * Indicates if this suite is trusted.     * (not to be confused with a domain named "trusted",     * this is used to determine if a trusted symbol should be displayed     * to the user and not used for permissions)     *     * @return true if the suite is trusted false if not     */    public boolean isTrusted() {        return installInfo.trusted;    }    /**     * Check if the suite classes were successfully verified     * during the suite installation.     *     * @return true if the suite classes are verified, false otherwise     */    public boolean isVerified() {        return installInfo.verifyHash != null;    }    /**     * Gets a property of the suite. A property is an attribute from     * either the application descriptor or JAR Manifest.     *     * @param key the name of the property     * @return A string with the value of the property.     *    <code>null</code> is returned if no value     *          is available for the key.     */    public String getProperty(String key) {        return getAppProperty(key);    }    /**     * Gets push setting for interrupting other MIDlets.     * Reuses the Permissions.     *     * @return push setting for interrupting MIDlets the value     *        will be permission level from {@link Permissions}     */    public byte getPushInterruptSetting() {        return suiteSettings.getPushInterruptSetting();    }    /**     * Gets push options for this suite.     *     * @return push options are defined in {@link PushRegistryImpl}     */    public int getPushOptions() {        return suiteSettings.getPushOptions();    }    /**     * Gets list of permissions for this suite.     *     * @return array of permissions from {@link Permissions}     */    public byte[] getPermissions() {        return suiteSettings.getPermissions();    }    /**     * Replace or add a property to the suite for this run only.     *     * @param token token with the AMS permission set to allowed     * @param key the name of the property     * @param value the value of the property     *     * @exception SecurityException if the caller's token does not have     *            internal AMS permission     */    public void setTempProperty(SecurityToken token, String key,                                String value) {        throw new RuntimeException("Not Implemented");    }    /**     * Get the name of a MIDlet.     *     * @param classname classname of a MIDlet in the suite     *     * @return name of a MIDlet to show the user     */    public String getMIDletName(String classname) {        throw new RuntimeException("Not Implemented");    }    /**     * Checks to see the suite has the ALLOW level for specific permission.     * This is used for by internal APIs that only provide access to     * trusted system applications.     * <p>     * Only trust this method if the object has been obtained from the     * MIDletStateHandler of the suite.     *     * @param permission permission name     *     * @exception SecurityException if the suite is not     *            allowed to perform the specified action     */    public void checkIfPermissionAllowed(String permission) {        throw new RuntimeException("Not Implemented");    }    /**     * Gets the status of the specified permission.     * If no API on the device defines the specific permission     * requested then it must be reported as denied.     * If the status of the permission is not known because it might     * require a user interaction then it should be reported as unknown.     *     * @param permission to check if denied, allowed, or unknown     * @return 0 if the permission is denied; 1 if the permission is     *    allowed; -1 if the status is unknown     */    public int checkPermission(String permission) {        throw new RuntimeException("Not Implemented");    }    /**     * Saves any the settings (security or others) that the user may have     * changed. Normally called by the scheduler after     * the last running MIDlet in the suite is destroyed.     * However it could be call during a suspend of the VM so     * that persistent settings of the suite can be preserved.     */    public void saveSettings() {        throw new RuntimeException("Not Implemented");    }    /**     * Asks the user want to interrupt the current MIDlet with     * a new MIDlet that has received network data.     *     * @param connection connection to place in the permission question or     *        null for alarm     *     * @return true if the use wants interrupt the current MIDlet,     * else false     */    public boolean permissionToInterrupt(String connection) {        throw new RuntimeException("Not Implemented");    }    /**     * Determine if the a MIDlet from this suite can be run. Note that     * disable suites can still have their settings changed and their     * install info displayed.     *     * @return true if suite is enabled, false otherwise     */    public boolean isEnabled() {        throw new RuntimeException("Not Implemented");    }    /**     * Close the opened MIDletSuite     */    public void close() {    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?