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

Commit 9726eeb2 authored by dcashman's avatar dcashman Committed by Android (Google) Code Review
Browse files

Merge "Revert "Initial KeySet API.""

parents 1f26357b 5de7377f
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -8344,9 +8344,6 @@ package android.content.pm {
    field public java.lang.String targetPackage;
  }
  public class KeySet {
  }
  public class LabeledIntent extends android.content.Intent {
    ctor public LabeledIntent(android.content.Intent, java.lang.String, int, int);
    ctor public LabeledIntent(android.content.Intent, java.lang.String, java.lang.CharSequence, int);
@@ -8484,7 +8481,6 @@ package android.content.pm {
    method public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackages(int);
    method public abstract java.lang.String getInstallerPackageName(java.lang.String);
    method public abstract android.content.pm.InstrumentationInfo getInstrumentationInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract android.content.pm.KeySet getKeySetByAlias(java.lang.String, java.lang.String);
    method public abstract android.content.Intent getLaunchIntentForPackage(java.lang.String);
    method public abstract android.content.Intent getLeanbackLaunchIntentForPackage(java.lang.String);
    method public abstract java.lang.String getNameForUid(int);
@@ -8503,15 +8499,12 @@ package android.content.pm {
    method public abstract android.content.res.Resources getResourcesForApplication(android.content.pm.ApplicationInfo) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract android.content.res.Resources getResourcesForApplication(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract android.content.pm.ServiceInfo getServiceInfo(android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract android.content.pm.KeySet getSigningKeySet(java.lang.String);
    method public abstract android.content.pm.FeatureInfo[] getSystemAvailableFeatures();
    method public abstract java.lang.String[] getSystemSharedLibraryNames();
    method public abstract java.lang.CharSequence getText(java.lang.String, int, android.content.pm.ApplicationInfo);
    method public abstract android.content.res.XmlResourceParser getXml(java.lang.String, int, android.content.pm.ApplicationInfo);
    method public abstract boolean hasSystemFeature(java.lang.String);
    method public abstract boolean isSafeMode();
    method public abstract boolean isSignedBy(java.lang.String, android.content.pm.KeySet);
    method public abstract boolean isSignedByExactly(java.lang.String, android.content.pm.KeySet);
    method public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent, int);
    method public abstract java.util.List<android.content.pm.ProviderInfo> queryContentProviders(java.lang.String, int, int);
    method public abstract java.util.List<android.content.pm.InstrumentationInfo> queryInstrumentation(java.lang.String, int);
+0 −59
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.content.pm.IPackageManager;
import android.content.pm.IPackageMoveObserver;
import android.content.pm.IPackageStatsObserver;
import android.content.pm.InstrumentationInfo;
import android.content.pm.KeySet;
import android.content.pm.ManifestDigest;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
@@ -53,7 +52,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -61,7 +59,6 @@ import android.os.UserManager;
import android.util.ArrayMap;
import android.util.Log;
import android.view.Display;
import com.android.internal.util.Preconditions;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -1450,62 +1447,6 @@ final class ApplicationPackageManager extends PackageManager {
        return false;
    }

    @Override
    public KeySet getKeySetByAlias(String packageName, String alias) {
        Preconditions.checkNotNull(packageName);
        Preconditions.checkNotNull(alias);
        IBinder keySetToken;
        try {
            keySetToken = mPM.getKeySetByAlias(packageName, alias);
        } catch (RemoteException e) {
            return null;
        }
        if (keySetToken == null) {
            return null;
        }
        return new KeySet(keySetToken);
    }

    @Override
    public KeySet getSigningKeySet(String packageName) {
        Preconditions.checkNotNull(packageName);
        IBinder keySetToken;
        try {
            keySetToken = mPM.getSigningKeySet(packageName);
        } catch (RemoteException e) {
            return null;
        }
        if (keySetToken == null) {
            return null;
        }
        return new KeySet(keySetToken);
    }


    @Override
    public boolean isSignedBy(String packageName, KeySet ks) {
        Preconditions.checkNotNull(packageName);
        Preconditions.checkNotNull(ks);
        IBinder keySetToken = ks.getToken();
        try {
            return mPM.isPackageSignedByKeySet(packageName, keySetToken);
        } catch (RemoteException e) {
            return false;
        }
    }

    @Override
    public boolean isSignedByExactly(String packageName, KeySet ks) {
        Preconditions.checkNotNull(packageName);
        Preconditions.checkNotNull(ks);
        IBinder keySetToken = ks.getToken();
        try {
            return mPM.isPackageSignedByKeySetExactly(packageName, keySetToken);
        } catch (RemoteException e) {
            return false;
        }
    }

    /**
     * @hide
     */
+0 −5
Original line number Diff line number Diff line
@@ -429,9 +429,4 @@ interface IPackageManager {

    boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
    boolean getBlockUninstallForUser(String packageName, int userId);

    IBinder getKeySetByAlias(String packageName, String alias);
    IBinder getSigningKeySet(String packageName);
    boolean isPackageSignedByKeySet(String packageName, IBinder ks);
    boolean isPackageSignedByKeySetExactly(String packageName, IBinder ks);
}
+5 −22
Original line number Diff line number Diff line
@@ -16,36 +16,19 @@

package android.content.pm;

import android.os.IBinder;
import android.os.Binder;

/**
 * Represents a {@code KeySet} that has been declared in the AndroidManifest.xml
 * file for the application.  A {@code KeySet} can be used explicitly to
 * represent a trust relationship with other applications on the device.
 */
/** @hide */
public class KeySet {

    private IBinder token;
    private Binder token;

    /** @hide */
    public KeySet(IBinder token) {
        if (token == null) {
            throw new NullPointerException("null value for KeySet IBinder token");
        }
    public KeySet(Binder token) {
        this.token = token;
    }

    /** @hide */
    public IBinder getToken() {
    Binder getToken() {
        return token;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof KeySet) {
            KeySet ks = (KeySet) o;
            return token == ks.token;
        }
        return false;
    }
}
 No newline at end of file
+0 −27
Original line number Diff line number Diff line
@@ -3601,33 +3601,6 @@ public abstract class PackageManager {
     */
    public abstract boolean isSafeMode();

    /**
     * Return the {@link KeySet} associated with the String alias for this
     * application.
     *
     * @param Alias The alias for a given {@link KeySet} as defined in the
     *        application's AndroidManifest.xml.
     */
    public abstract KeySet getKeySetByAlias(String packageName, String alias);

    /** Return the signing {@link KeySet} for this application. */
    public abstract KeySet getSigningKeySet(String packageName);

    /**
     * Return whether the package denoted by packageName has been signed by all
     * of the keys specified by the {@link KeySet} ks.  This will return true if
     * the package has been signed by additional keys (a superset) as well.
     * Compare to {@link #isSignedByExactly(String packageName, KeySet ks)}.
     */
    public abstract boolean isSignedBy(String packageName, KeySet ks);

    /**
     * Return whether the package denoted by packageName has been signed by all
     * of, and only, the keys specified by the {@link KeySet} ks. Compare to
     * {@link #isSignedBy(String packageName, KeySet ks)}.
     */
    public abstract boolean isSignedByExactly(String packageName, KeySet ks);

    /**
     * Attempts to move package resources from internal to external media or vice versa.
     * Since this may take a little while, the result will
Loading