Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

“Application <module name> is attempting to change device settings”

by Retired on ‎02-16-2010 10:24 AM (2,063 Views)

Summary


This article applies to the following:

  • BlackBerry® Device Software 4.2 Service Pack 1 (4.2.1) and later
  • BlackBerry Java Development Environment (BlackBerry JDE)


Description


In BlackBerry Device Software 4.2.1, a new security prompt was introduced that would appear whenever an application attempted to access any of the following APIs:


Locale.setDefaultInputForSystem


MIMETypeAssociations.registerMIMETypeMapping


MIMETypeAssociations.registerType


ApplicationDescriptor.setPowerOnBehavior


ApplicationManager.lockSystem


ApplicationManager.unlockSystem


ApplicationManager.setCurrentPowerOnBehavior


ApplicationManager.requestForeground


ApplicationManager.requestForegroundForConsole


Backlight.enable


Backlight.setTimeout


Backlight.setBrightness


Device.requestPowerOff


Device.requestStorageMode


Device.setDateTime


Display.setContrast


EventLogger.setMinimumLevel


EventLogger.clearLog


Radio.activateWAFs


Radio.deactivateWAFs


Keypad.setMode


The result of an application calling any of these methods would be the following security prompt: Application <module name> is attempting to change device settings. The application developer should surround a call to any of these methods with a try or catch statement, catching a ControlledAccessException in the event that the user denies access. An example is given below:


try {

       Backlight.setTimeout(255);
} catch (ControlledAccessException cae) {
       //I couldn’t alter the backlight timeout. My application should expect that //at some point, the backlight will turn off.
}

 

Alternatively, in JDE 4.2.1, the application can proactively request this permission from the user by calling the following:


ApplicationPermissions ap = new ApplicationPermissions();
ap.addPermission(ApplicationPermissions.PERMISSION_CHANGE_DEVICE_SETTINGS);
boolean result = ApplicationPermissionsManager.getInstance().invokePermissionsRequest(ap);
if(result == true) {
      //The user accepted my permissions request. My call to Backlight will no longer result in the user being prompted.
      Backlight.setTimeout(255);
}

 

The user or IT administrator can also manually allow this setting via Application Control. The user can set Device Settings to Allow for the application in question by using one of the following methods:

  1. Go to Options > Advanced Options > Applications and select Edit Permissions from the menu.
  2. Go to Options > Security Options > Application Permissions and select Edit Permissions from the menu.

The IT administrator can enable the Device Settings Application Control policy in a similar fashion to enabling Event Injection, as described in KB04219.

Contributors
Users Online
Currently online: 18 members 504 guests
Please welcome our newest community members: