Uninstalling Features with Feature Manager

Provides instructions for removing features when uninstalling a software component.

When you install a software component you may want to disable any features which no other component requires. You may also want to modify the user-defined data relating to the feature. You do this by installing an executable which uninstalls the features. That executable is called featureuninstaller.exe and you create it by customising and installing its source code.

  1. Customise the source code in featureuninstaller.cpp,
    1. Set the TUid featureUid to the UId of the feature to be disabled, as defined in featureUIDs.h, which you use to initialise featureUid
          // TODO: Replace UID 0x00000000 with real value
          TUid featureUid( TUid::Uid( 0x00000000 ) ); 
      
      and
    2. set the TUint32 featureData to the user-defined data if any.
          // TODO: Set feature data. Replace <featureData> with real value!
          // TODO: Uncomment when needed!
          // TUint32 featureData( 0x00000000 );
      
    This is the source code to be modified.
    
    
    // INCLUDE FILES
    #include <featurecontrol.h>
    
    // LOCAL CONSTANTS AND MACROS
    _LIT(KTxt,"featureuninstaller: mainL failed");
    
    
    // ============================= LOCAL FUNCTIONS ===============================
    
    // -----------------------------------------------------------------------------
    // mainL
    // -----------------------------------------------------------------------------
    //  
    LOCAL_C void mainL()
        {
        // Connect Feature Control
        RFeatureControl featureControl;
        User::LeaveIfError( featureControl.Open() );
        
        // Example code disables an existing feature.
        // TODO: Comment or uncomment code when needed. 
        
        // TODO: Specify in your .pkg file:
        // @"featureuninstaller.sisx", (0x10283304)
        
        // TODO: Replace UID 0x00000000 with real value
        TUid featureUid( TUid::Uid( 0x00000000 ) ); 
        
        // Feature data is 32-bit quantity for client read and write. Feature data is
        // defined by owner of the feature and can contain for example flags, 
        // enumeratons and/or integers.
        // TODO: Set feature data. Replace <featureData> with real value!
        // TODO: Uncomment when needed!
        // TUint32 featureData( 0x00000000 );
        
        // Disable an existing feature.
        User::LeaveIfError( featureControl.DisableFeature( featureUid ) );
        
        // OR disable an exsiting feature and set feature data.
        // User::LeaveIfError( featureControl.SetFeature( featureUid, EFalse, featureData ) );
        
        featureControl.Close();
        }
    
    
    
    

  2. compile the code to featureuninstaller.exe,

  3. customise the package file featureuninstaller.pkg with the filepath of featureuninstaller.exe, and
    ; This file installs an exe that is run asynchronously on uninstallation, uninstalls a feature.
    
    ;Languages
    &EN
    
    ;Header
    #{"featureuninstaller"}, (0x10283304), 1, 2, 3,TYPE=SA
    
    %{"Vendor"}
    :"Unique Vendor Name"
    
    "\epoc32\release\winscw\udeb\featureuninstaller.exe"-"!:\sys\bin\featureuninstaller.exe", FR, RR

  4. convert featureuninstaller.pkg into a .sis file to be placed on the phone in accordance with the normal installation process.

The features you have uninstalled will now be disabled on the device.

There are no next steps to be taken.

Related concepts
Feature Manager Overview