Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fde7da25 authored by Josh Guilfoyle's avatar Josh Guilfoyle
Browse files

Removed unused sound pack feature.

Change-Id: I8dd546a829881a67e4da41a37f1cb4799f044606
parent eaad0977
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public class BaseThemeInfo implements Parcelable {
     */
    public enum InfoObjectType {
        TYPE_THEME,
        TYPE_SOUNDPACK,
        TYPE_SOUNDPACK, /** Currently not supported. */
    }

    /**
+0 −8
Original line number Diff line number Diff line
@@ -194,12 +194,6 @@ public class PackageInfo implements Parcelable {
     */
    public ThemeInfo [] themeInfos;

    // SoundsInfo
    /**
     * {@hide}
     */
    public SoundsInfo [] soundInfos;

    public PackageInfo() {
    }

@@ -290,7 +284,6 @@ public class PackageInfo implements Parcelable {
        dest.writeInt((isThemeApk)? 1 : 0);
        dest.writeInt((drmProtectedThemeApk)? 1 : 0);
        dest.writeTypedArray(themeInfos, parcelableFlags);
        dest.writeTypedArray(soundInfos, parcelableFlags);
        dest.writeString(lockedZipFilePath);
    }

@@ -332,7 +325,6 @@ public class PackageInfo implements Parcelable {
        isThemeApk = (source.readInt() != 0);
        drmProtectedThemeApk = (source.readInt() != 0);
        themeInfos = source.createTypedArray(ThemeInfo.CREATOR);
        soundInfos = source.createTypedArray(SoundsInfo.CREATOR);
        lockedZipFilePath = source.readString();
    }
}
+0 −18
Original line number Diff line number Diff line
@@ -217,17 +217,6 @@ public class PackageParser {
                    pi.setLockedZipFilePath(PackageParser.getLockedZipFilePath(p.mPath));
                }
            }
            N = p.mSoundInfos.size();
            if (N > 0) {
                pi.soundInfos = new SoundsInfo[N];
                for (int i = 0; i < N; i++) {
                    pi.soundInfos[i] = p.mSoundInfos.get(i);
                    pi.setDrmProtectedThemeApk(pi.isDrmProtectedThemeApk() || pi.soundInfos[i].isDrmProtected);
                }
                if (pi.isDrmProtectedThemeApk()) {
                    pi.setLockedZipFilePath(PackageParser.getLockedZipFilePath(p.mPath));
                }
            }
        }
        pi.applicationInfo = p.applicationInfo;
        pi.installLocation = p.installLocation;
@@ -1115,10 +1104,6 @@ public class PackageParser {
                // this is a theme apk.
                pkg.mIsThemeApk = true;
                pkg.mThemeInfos.add(new ThemeInfo(parser, res, attrs));
            } else if (tagName.equals("sounds")) {
                // this is a theme apk.
                pkg.mIsThemeApk = true;
                pkg.mSoundInfos.add(new SoundsInfo(parser, res, attrs));
            } else if (RIGID_PARSER) {
                outError[0] = "Bad element under <manifest>: "
                    + parser.getName();
@@ -2790,9 +2775,6 @@ public class PackageParser {
        // Theme info
        public final ArrayList<ThemeInfo> mThemeInfos = new ArrayList<ThemeInfo>(0);

        // Sound info
        public final ArrayList<SoundsInfo> mSoundInfos = new ArrayList<SoundsInfo>(0);

        // Additional data supplied by callers.
        public Object mExtras;
        
+0 −171
Original line number Diff line number Diff line
package android.content.pm;

import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParser;

import android.os.Parcelable;
import android.os.Parcel;
import android.util.AttributeSet;
import android.content.res.Resources;

import java.util.Map;
import java.util.HashMap;

/**
 * Overall information about sound pack.  This corresponds
 * to the information collected from AndroidManifest.xml (sounds tag).
 *
 * Below is an example of sounds tag
 *    <sounds
 *        pluto:name="Pluto Default"
 *        pluto:thumbnail="@drawable/app_thumbnail"
 *        pluto:author="John Doe"
 *        pluto:ringtoneFileName="media/audio/ringtone.mp3"
 *        pluto:notificationRingtoneFileName="media/audio/locked/notification.mp3"
 *        pluto:copyright="T-Mobile, 2009"
 *    />
 *
 * @hide
 */
public class SoundsInfo extends BaseThemeInfo {

    private static final String [] attributes = new String [] {
        "name",
        "thumbnail",
        "author",
        "ringtoneFileName",
        "notificationRingtoneFileName",
        "ringtoneName",
        "notificationRingtoneName",
        "copyright",
    };

    private static Map<String, Integer> attributesLookupTable;

    static {
        attributesLookupTable = new HashMap<String, Integer>();
        for (int i = 0; i < attributes.length; i++) {
            attributesLookupTable.put(attributes[i], i);
        }
    }

    /**
     * {@link #name}
     *
     */
    private static final int NAME_INDEX = 0;

    /**
     * {@link #thumbnail}
     *
     */
    private static final int THUMBNAIL_INDEX = 1;

    /**
     * {@link #author}
     *
     */
    private static final int AUTHOR_INDEX = 2;

    /**
     * {@link #ringtoneName}
     *
     */
    private static final int RINGTONE_FILE_NAME_INDEX = 3;

    /**
     * {@link #notificationRingtoneName}
     *
     */
    private static final int NOTIFICATION_RINGTONE_FILE_NAME_INDEX = 4;

    /**
     * {@link #ringtoneName}
     *
     */
    private static final int RINGTONE_NAME_INDEX = 5;

    /**
     * {@link #notificationRingtoneName}
     *
     */
    private static final int NOTIFICATION_RINGTONE_NAME_INDEX = 6;

    /**
     * {@link #copyright}
     *
     */
    private static final int COPYRIGHT_INDEX = 7;


    public SoundsInfo(XmlPullParser parser, Resources res, AttributeSet attrs) throws XmlPullParserException {
        super();

        type = InfoObjectType.TYPE_SOUNDPACK;
        Map<String, Integer> tempMap = new HashMap<String, Integer>(attributesLookupTable);
        for (int i = 0; i < attrs.getAttributeCount(); i++) {
            if (!ApplicationInfo.isPlutoNamespace(parser.getAttributeNamespace(i))) {
                continue;
            }
            String key = attrs.getAttributeName(i);
            if (tempMap.containsKey(key)) {
                int index = tempMap.get(key);
                tempMap.remove(key);

                switch (index) {
                    case NAME_INDEX:
                        name = getResolvedString(res, attrs, i);
                        break;

                    case THUMBNAIL_INDEX:
                        thumbnail = attrs.getAttributeValue(i);
                        break;

                    case AUTHOR_INDEX:
                        author = getResolvedString(res, attrs, i);
                        break;

                    case RINGTONE_FILE_NAME_INDEX:
                        ringtoneFileName = attrs.getAttributeValue(i);
                        changeDrmFlagIfNeeded(ringtoneFileName);
                        break;

                    case NOTIFICATION_RINGTONE_FILE_NAME_INDEX:
                        notificationRingtoneFileName = attrs.getAttributeValue(i);
                        changeDrmFlagIfNeeded(notificationRingtoneFileName);
                        break;

                    case RINGTONE_NAME_INDEX:
                        ringtoneName = attrs.getAttributeValue(i);
                        break;

                    case NOTIFICATION_RINGTONE_NAME_INDEX:
                        notificationRingtoneName = attrs.getAttributeValue(i);

                    case COPYRIGHT_INDEX:
                        copyright = getResolvedString(res, attrs, i);
                        break;
                }
            }
        }
        if (!tempMap.isEmpty()) {
            throw new XmlPullParserException("Not all compulsory attributes are specified in <sounds>");
        }
    }

    public static final Parcelable.Creator<SoundsInfo> CREATOR
            = new Parcelable.Creator<SoundsInfo>() {
        public SoundsInfo createFromParcel(Parcel source) {
            return new SoundsInfo(source);
        }

        public SoundsInfo[] newArray(int size) {
            return new SoundsInfo[size];
        }
    };

    private SoundsInfo(Parcel source) {
        super(source);
    }

}