FileDocCategorySizeDatePackage
CarrierContentRestriction.javaAPI DocAndroid 1.5 API4332Wed May 06 22:42:46 BST 2009com.android.mms.model

CarrierContentRestriction

public class CarrierContentRestriction extends Object implements ContentRestriction

Fields Summary
public static final int
IMAGE_WIDTH_LIMIT
public static final int
IMAGE_HEIGHT_LIMIT
public static final int
MESSAGE_SIZE_LIMIT
private static final ArrayList
sSupportedImageTypes
private static final ArrayList
sSupportedAudioTypes
private static final ArrayList
sSupportedVideoTypes
Constructors Summary
public CarrierContentRestriction()


     
        sSupportedImageTypes = ContentType.getImageTypes();
        sSupportedAudioTypes = ContentType.getAudioTypes();
        sSupportedVideoTypes = ContentType.getVideoTypes();
    
    
Methods Summary
public voidcheckAudioContentType(java.lang.String contentType)

        if (null == contentType) {
            throw new ContentRestrictionException("Null content type to be check");
        }

        if (!sSupportedAudioTypes.contains(contentType)) {
            throw new UnsupportContentTypeException("Unsupported audio content type : "
                    + contentType);
        }
    
public voidcheckImageContentType(java.lang.String contentType)

        if (null == contentType) {
            throw new ContentRestrictionException("Null content type to be check");
        }

        if (!sSupportedImageTypes.contains(contentType)) {
            throw new UnsupportContentTypeException("Unsupported image content type : "
                    + contentType);
        }
    
public voidcheckMessageSize(int messageSize, int increaseSize, android.content.ContentResolver resolver)

        if ( (messageSize < 0) || (increaseSize < 0) ) {
            throw new ContentRestrictionException("Negative message size"
                    + " or increase size");
        }
        int messageSizeLimit;
        try {
            // Don't cache the max message size. Grab it each time so we'll dynamically
            // respond to changes made on the server.
            messageSizeLimit = Integer.parseInt(
                    Settings.Gservices.getString(resolver,
                            Settings.Gservices.MMS_MAXIMUM_MESSAGE_SIZE));
        } catch (java.lang.NumberFormatException e) {
            messageSizeLimit = MESSAGE_SIZE_LIMIT;
        }
        int newSize = messageSize + increaseSize;
        if ( (newSize < 0) || (newSize > messageSizeLimit) ) {
            throw new ExceedMessageSizeException("Exceed message size limitation");
        }
    
public voidcheckResolution(int width, int height)

        if ( (width > IMAGE_WIDTH_LIMIT) || (height > IMAGE_HEIGHT_LIMIT) ) {
            throw new ResolutionException("content resolution exceeds restriction.");
        }
    
public voidcheckVideoContentType(java.lang.String contentType)

        if (null == contentType) {
            throw new ContentRestrictionException("Null content type to be check");
        }

        if (!sSupportedVideoTypes.contains(contentType)) {
            throw new UnsupportContentTypeException("Unsupported video content type : "
                    + contentType);
        }