FileDocCategorySizeDatePackage
PackageKeySetData.javaAPI DocAndroid 5.1 API4409Thu Mar 12 22:22:42 GMT 2015com.android.server.pm

PackageKeySetData

public class PackageKeySetData extends Object

Fields Summary
static final long
KEYSET_UNASSIGNED
private long
mProperSigningKeySet
private long[]
mSigningKeySets
private long[]
mUpgradeKeySets
private long[]
mDefinedKeySets
private final android.util.ArrayMap
mKeySetAliases
Constructors Summary
PackageKeySetData()


     
        mProperSigningKeySet = KEYSET_UNASSIGNED;
    
PackageKeySetData(PackageKeySetData original)

        mProperSigningKeySet = original.mProperSigningKeySet;
        mSigningKeySets = ArrayUtils.cloneOrNull(original.mSigningKeySets);
        mUpgradeKeySets = ArrayUtils.cloneOrNull(original.mUpgradeKeySets);
        mDefinedKeySets = ArrayUtils.cloneOrNull(original.mDefinedKeySets);
        mKeySetAliases.putAll(original.mKeySetAliases);
    
Methods Summary
protected voidaddDefinedKeySet(long ks, java.lang.String alias)

        mDefinedKeySets = ArrayUtils.appendLong(mDefinedKeySets, ks);
        mKeySetAliases.put(alias, ks);
    
protected voidaddSigningKeySet(long ks)

        mSigningKeySets = ArrayUtils.appendLong(mSigningKeySets, ks);
    
protected voidaddUpgradeKeySet(java.lang.String alias)


        /* must have previously been defined */
        Long ks = mKeySetAliases.get(alias);
        if (ks != null) {
            mUpgradeKeySets = ArrayUtils.appendLong(mUpgradeKeySets, ks);
        } else {
            throw new IllegalArgumentException("Upgrade keyset alias " + alias
                    + "does not refer to a defined keyset alias!");
        }
    
protected voidaddUpgradeKeySetById(long ks)

        mSigningKeySets = ArrayUtils.appendLong(mSigningKeySets, ks);
    
protected android.util.ArrayMapgetAliases()

        return mKeySetAliases;
    
protected long[]getDefinedKeySets()

        return mDefinedKeySets;
    
protected longgetProperSigningKeySet()

        return mProperSigningKeySet;
    
protected long[]getSigningKeySets()

        return mSigningKeySets;
    
protected long[]getUpgradeKeySets()

        return mUpgradeKeySets;
    
protected booleanisUsingDefinedKeySets()


        /* should never be the case that mDefinedKeySets.length == 0 */
        return (mDefinedKeySets != null && mDefinedKeySets.length > 0);
    
protected booleanisUsingUpgradeKeySets()


        /* should never be the case that mUpgradeKeySets.length == 0 */
        return (mUpgradeKeySets != null && mUpgradeKeySets.length > 0);
    
protected booleanpackageIsSignedBy(long ks)

        return ArrayUtils.contains(mSigningKeySets, ks);
    
protected voidremoveAllDefinedKeySets()

        mDefinedKeySets = null;
        mKeySetAliases.clear();
        return;
    
protected voidremoveAllSigningKeySets()

        mProperSigningKeySet = KEYSET_UNASSIGNED;
        mSigningKeySets = null;
        return;
    
protected voidremoveAllUpgradeKeySets()

        mUpgradeKeySets = null;
        return;
    
protected voidremoveSigningKeySet(long ks)

        mSigningKeySets = ArrayUtils.removeLong(mSigningKeySets, ks);
    
protected voidsetProperSigningKeySet(long ks)

        if (ks == mProperSigningKeySet) {

            /* nothing to change */
            return;
        }

        /* otherwise, our current signing keysets are likely invalid */
        removeAllSigningKeySets();
        mProperSigningKeySet = ks;
        addSigningKeySet(ks);
        return;