android.content.pm.KeySet#com.android.internal.util.Preconditions源码实例Demo

下面列出了android.content.pm.KeySet#com.android.internal.util.Preconditions 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: KeySetManagerService.java
public void removeAppKeySetDataLPw(String packageName) {

        /* remove refs from common keysets and public keys */
        PackageSetting pkg = mPackages.get(packageName);
        Preconditions.checkNotNull(pkg, "pkg name: " + packageName
                + "does not have a corresponding entry in mPackages.");
        long signingKeySetId = pkg.keySetData.getProperSigningKeySet();
        decrementKeySetLPw(signingKeySetId);
        ArrayMap<String, Long> definedKeySets = pkg.keySetData.getAliases();
        for (int i = 0; i < definedKeySets.size(); i++) {
            decrementKeySetLPw(definedKeySets.valueAt(i));
        }

        /* remove from package */
        clearPackageKeySetDataLPw(pkg);
        return;
    }
 
源代码2 项目: android_9.0.0_r45   文件: AssetManager.java
/**
 * Populates {@code outValue} with the data associated with a particular
 * resource identifier for the current configuration. Resolves theme
 * attributes against the specified theme.
 *
 * @param theme the native pointer of the theme
 * @param resId the resource identifier to load
 * @param outValue the typed value in which to put the data
 * @param resolveRefs {@code true} to resolve references, {@code false}
 *                    to leave them unresolved
 * @return {@code true} if the data was loaded into {@code outValue},
 *         {@code false} otherwise
 */
boolean getThemeValue(long theme, @AnyRes int resId, @NonNull TypedValue outValue,
        boolean resolveRefs) {
    Preconditions.checkNotNull(outValue, "outValue");
    synchronized (this) {
        ensureValidLocked();
        final int cookie = nativeThemeGetAttributeValue(mObject, theme, resId, outValue,
                resolveRefs);
        if (cookie <= 0) {
            return false;
        }

        // Convert the changing configurations flags populated by native code.
        outValue.changingConfigurations = ActivityInfo.activityInfoConfigNativeToJava(
                outValue.changingConfigurations);

        if (outValue.type == TypedValue.TYPE_STRING) {
            outValue.string = mApkAssets[cookie - 1].getStringFromPool(outValue.data);
        }
        return true;
    }
}
 
源代码3 项目: android_9.0.0_r45   文件: PrintManager.java
/**
 * Gets the list of print services, but does not register for updates. The user has to register
 * for updates by itself, or use {@link PrintServicesLoader}.
 *
 * @param selectionFlags flags selecting which services to get. Either
 *                       {@link #ENABLED_SERVICES},{@link #DISABLED_SERVICES}, or both.
 *
 * @return The print service list or an empty list.
 *
 * @see #addPrintServicesChangeListener(PrintServicesChangeListener, Handler)
 * @see #removePrintServicesChangeListener(PrintServicesChangeListener)
 *
 * @hide
 */
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRINT_SERVICES)
public @NonNull List<PrintServiceInfo> getPrintServices(int selectionFlags) {
    Preconditions.checkFlagsArgument(selectionFlags, ALL_SERVICES);

    try {
        List<PrintServiceInfo> services = mService.getPrintServices(selectionFlags, mUserId);
        if (services != null) {
            return services;
        }
    } catch (RemoteException re) {
        throw re.rethrowFromSystemServer();
    }
    return Collections.emptyList();
}
 
源代码4 项目: android_9.0.0_r45   文件: ContentResolver.java
/**
 * Update row(s) in a content URI.
 *
 * If the content provider supports transactions the update will be atomic.
 *
 * @param uri The URI to modify.
 * @param values The new field values. The key is the column name for the field.
                 A null value will remove an existing field value.
 * @param where A filter to apply to rows before updating, formatted as an SQL WHERE clause
                (excluding the WHERE itself).
 * @return the number of rows updated.
 * @throws NullPointerException if uri or values are null
 */
public final int update(@RequiresPermission.Write @NonNull Uri uri,
        @Nullable ContentValues values, @Nullable String where,
        @Nullable String[] selectionArgs) {
    Preconditions.checkNotNull(uri, "uri");
    IContentProvider provider = acquireProvider(uri);
    if (provider == null) {
        throw new IllegalArgumentException("Unknown URI " + uri);
    }
    try {
        long startTime = SystemClock.uptimeMillis();
        int rowsUpdated = provider.update(mPackageName, uri, values, where, selectionArgs);
        long durationMillis = SystemClock.uptimeMillis() - startTime;
        maybeLogUpdateToEventLog(durationMillis, uri, "update", where);
        return rowsUpdated;
    } catch (RemoteException e) {
        // Arbitrary and not worth documenting, as Activity
        // Manager will kill this process shortly anyway.
        return -1;
    } finally {
        releaseProvider(provider);
    }
}
 
@Override
public int movePrimaryStorage(VolumeInfo vol) {
    try {
        final String volumeUuid;
        if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.id)) {
            volumeUuid = StorageManager.UUID_PRIVATE_INTERNAL;
        } else if (vol.isPrimaryPhysical()) {
            volumeUuid = StorageManager.UUID_PRIMARY_PHYSICAL;
        } else {
            volumeUuid = Preconditions.checkNotNull(vol.fsUuid);
        }

        return mPM.movePrimaryStorage(volumeUuid);
    } catch (RemoteException e) {
        throw e.rethrowAsRuntimeException();
    }
}
 
public void logSelectionModified(int start, int end,
        @Nullable TextClassification classification, @Nullable TextSelection selection) {
    try {
        if (hasActiveClassificationSession()) {
            Preconditions.checkArgumentInRange(start, 0, mText.length(), "start");
            Preconditions.checkArgumentInRange(end, start, mText.length(), "end");
            int[] wordIndices = getWordDelta(start, end);
            if (selection != null) {
                mClassificationSession.onSelectionEvent(
                        SelectionEvent.createSelectionModifiedEvent(
                                wordIndices[0], wordIndices[1], selection));
            } else if (classification != null) {
                mClassificationSession.onSelectionEvent(
                        SelectionEvent.createSelectionModifiedEvent(
                                wordIndices[0], wordIndices[1], classification));
            } else {
                mClassificationSession.onSelectionEvent(
                        SelectionEvent.createSelectionModifiedEvent(
                                wordIndices[0], wordIndices[1]));
            }
        }
    } catch (Exception e) {
        // Avoid crashes due to logging.
        Log.e(LOG_TAG, "" + e.getMessage(), e);
    }
}
 
@Override
public int movePrimaryStorage(VolumeInfo vol) {
    try {
        final String volumeUuid;
        if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.id)) {
            volumeUuid = StorageManager.UUID_PRIVATE_INTERNAL;
        } else if (vol.isPrimaryPhysical()) {
            volumeUuid = StorageManager.UUID_PRIMARY_PHYSICAL;
        } else {
            volumeUuid = Preconditions.checkNotNull(vol.fsUuid);
        }

        return mPM.movePrimaryStorage(volumeUuid);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
/**
 * Constructor to create {@link LongitudinalReportingConfig} used for {@link
 * LongitudinalReportingEncoder}
 *
 * @param encoderId    Unique encoder id.
 * @param probabilityF Probability F used in Longitudinal Reporting algorithm.
 * @param probabilityP Probability P used in Longitudinal Reporting algorithm. This will be
 *                     quantized to the nearest 1/256.
 * @param probabilityQ Probability Q used in Longitudinal Reporting algorithm. This will be
 *                     quantized to the nearest 1/256.
 */
public LongitudinalReportingConfig(String encoderId, double probabilityF,
        double probabilityP, double probabilityQ) {
    Preconditions.checkArgument(probabilityF >= 0 && probabilityF <= 1,
            "probabilityF must be in range [0.0, 1.0]");
    this.mProbabilityF = probabilityF;
    Preconditions.checkArgument(probabilityP >= 0 && probabilityP <= 1,
            "probabilityP must be in range [0.0, 1.0]");
    this.mProbabilityP = probabilityP;
    Preconditions.checkArgument(probabilityQ >= 0 && probabilityQ <= 1,
            "probabilityQ must be in range [0.0, 1.0]");
    this.mProbabilityQ = probabilityQ;
    Preconditions.checkArgument(!TextUtils.isEmpty(encoderId), "encoderId cannot be empty");
    mEncoderId = encoderId;
    mIRRConfig = new RapporConfig(encoderId, 1, 0.0, probabilityF, 1 - probabilityF, 1, 1);
}
 
源代码9 项目: android_9.0.0_r45   文件: ContentResolver.java
/**
 * Inserts multiple rows into a table at the given URL.
 *
 * This function make no guarantees about the atomicity of the insertions.
 *
 * @param url The URL of the table to insert into.
 * @param values The initial values for the newly inserted rows. The key is the column name for
 *               the field. Passing null will create an empty row.
 * @return the number of newly created rows.
 */
public final int bulkInsert(@RequiresPermission.Write @NonNull Uri url,
            @NonNull ContentValues[] values) {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(values, "values");
    IContentProvider provider = acquireProvider(url);
    if (provider == null) {
        throw new IllegalArgumentException("Unknown URL " + url);
    }
    try {
        long startTime = SystemClock.uptimeMillis();
        int rowsCreated = provider.bulkInsert(mPackageName, url, values);
        long durationMillis = SystemClock.uptimeMillis() - startTime;
        maybeLogUpdateToEventLog(durationMillis, url, "bulkinsert", null /* where */);
        return rowsCreated;
    } catch (RemoteException e) {
        // Arbitrary and not worth documenting, as Activity
        // Manager will kill this process shortly anyway.
        return 0;
    } finally {
        releaseProvider(provider);
    }
}
 
源代码10 项目: android_9.0.0_r45   文件: LockSettingsStorage.java
public static byte[] toBytes(int persistentType, int userId, int qualityForUi,
        byte[] payload) {
    if (persistentType == PersistentData.TYPE_NONE) {
        Preconditions.checkArgument(payload == null,
                "TYPE_NONE must have empty payload");
        return null;
    }
    Preconditions.checkArgument(payload != null && payload.length > 0,
            "empty payload must only be used with TYPE_NONE");

    ByteArrayOutputStream os = new ByteArrayOutputStream(
            VERSION_1_HEADER_SIZE + payload.length);
    DataOutputStream dos = new DataOutputStream(os);
    try {
        dos.writeByte(PersistentData.VERSION_1);
        dos.writeByte(persistentType);
        dos.writeInt(userId);
        dos.writeInt(qualityForUi);
        dos.write(payload);
    } catch (IOException e) {
        throw new RuntimeException("ByteArrayOutputStream cannot throw IOException");
    }
    return os.toByteArray();
}
 
@Override
public int movePackage(String packageName, VolumeInfo vol) {
    try {
        final String volumeUuid;
        if (VolumeInfo.ID_PRIVATE_INTERNAL.equals(vol.id)) {
            volumeUuid = StorageManager.UUID_PRIVATE_INTERNAL;
        } else if (vol.isPrimaryPhysical()) {
            volumeUuid = StorageManager.UUID_PRIMARY_PHYSICAL;
        } else {
            volumeUuid = Preconditions.checkNotNull(vol.fsUuid);
        }

        return mPM.movePackage(packageName, volumeUuid);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
源代码12 项目: android_9.0.0_r45   文件: PrecomputedText.java
/**
 * Returns text width for the given range.
 * Both {@code start} and {@code end} offset need to be in the same paragraph, otherwise
 * IllegalArgumentException will be thrown.
 *
 * @param start the inclusive start offset in the text
 * @param end the exclusive end offset in the text
 * @return the text width
 * @throws IllegalArgumentException if start and end offset are in the different paragraph.
 */
public @FloatRange(from = 0) float getWidth(@IntRange(from = 0) int start,
        @IntRange(from = 0) int end) {
    Preconditions.checkArgument(0 <= start && start <= mText.length(), "invalid start offset");
    Preconditions.checkArgument(0 <= end && end <= mText.length(), "invalid end offset");
    Preconditions.checkArgument(start <= end, "start offset can not be larger than end offset");

    if (start == end) {
        return 0;
    }
    final int paraIndex = findParaIndex(start);
    final int paraStart = getParagraphStart(paraIndex);
    final int paraEnd = getParagraphEnd(paraIndex);
    if (start < paraStart || paraEnd < end) {
        throw new IllegalArgumentException("Cannot measured across the paragraph:"
            + "para: (" + paraStart + ", " + paraEnd + "), "
            + "request: (" + start + ", " + end + ")");
    }
    return getMeasuredParagraph(paraIndex).getWidth(start - paraStart, end - paraStart);
}
 
源代码13 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/** See {@link ContentProvider#getStreamTypes ContentProvider.getStreamTypes} */
public @Nullable String[] getStreamTypes(@NonNull Uri url, @NonNull String mimeTypeFilter)
        throws RemoteException {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(mimeTypeFilter, "mimeTypeFilter");

    beforeRemote();
    try {
        return mContentProvider.getStreamTypes(url, mimeTypeFilter);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码14 项目: AndroidComponentPlugin   文件: ContentResolver.java
/**
 * Call a provider-defined method.  This can be used to implement
 * read or write interfaces which are cheaper than using a Cursor and/or
 * do not fit into the traditional table model.
 *
 * @param method provider-defined method name to call.  Opaque to
 *   framework, but must be non-null.
 * @param arg provider-defined String argument.  May be null.
 * @param extras provider-defined Bundle argument.  May be null.
 * @return a result Bundle, possibly null.  Will be null if the ContentProvider
 *   does not implement call.
 * @throws NullPointerException if uri or method is null
 * @throws IllegalArgumentException if uri is not known
 */
public final @Nullable Bundle call(@NonNull Uri uri, @NonNull String method,
        @Nullable String arg, @Nullable Bundle extras) {
    Preconditions.checkNotNull(uri, "uri");
    Preconditions.checkNotNull(method, "method");
    IContentProvider provider = acquireProvider(uri);
    if (provider == null) {
        throw new IllegalArgumentException("Unknown URI " + uri);
    }
    try {
        final Bundle res = provider.call(mPackageName, method, arg, extras);
        Bundle.setDefusable(res, true);
        return res;
    } catch (RemoteException e) {
        // Arbitrary and not worth documenting, as Activity
        // Manager will kill this process shortly anyway.
        return null;
    } finally {
        releaseProvider(provider);
    }
}
 
源代码15 项目: android_9.0.0_r45   文件: MacAddress.java
private static long longAddrFromStringAddr(String addr) {
    Preconditions.checkNotNull(addr);
    String[] parts = addr.split(":");
    if (parts.length != ETHER_ADDR_LEN) {
        throw new IllegalArgumentException(addr + " was not a valid MAC address");
    }
    long longAddr = 0;
    for (int i = 0; i < parts.length; i++) {
        int x = Integer.valueOf(parts[i], 16);
        if (x < 0 || 0xff < x) {
            throw new IllegalArgumentException(addr + "was not a valid MAC address");
        }
        longAddr = x + (longAddr << 8);
    }
    return longAddr;
}
 
源代码16 项目: android_9.0.0_r45   文件: ContentProviderClient.java
/**
 * See {@link ContentProvider#openFile ContentProvider.openFile}.  Note that
 * this <em>does not</em>
 * take care of non-content: URIs such as file:.  It is strongly recommended
 * you use the {@link ContentResolver#openFileDescriptor
 * ContentResolver.openFileDescriptor} API instead.
 */
public @Nullable ParcelFileDescriptor openFile(@NonNull Uri url, @NonNull String mode,
        @Nullable CancellationSignal signal) throws RemoteException, FileNotFoundException {
    Preconditions.checkNotNull(url, "url");
    Preconditions.checkNotNull(mode, "mode");

    beforeRemote();
    try {
        ICancellationSignal remoteSignal = null;
        if (signal != null) {
            signal.throwIfCanceled();
            remoteSignal = mContentProvider.createCancellationSignal();
            signal.setRemote(remoteSignal);
        }
        return mContentProvider.openFile(mPackageName, url, mode, remoteSignal, null);
    } catch (DeadObjectException e) {
        if (!mStable) {
            mContentResolver.unstableProviderDied(mContentProvider);
        }
        throw e;
    } finally {
        afterRemote();
    }
}
 
源代码17 项目: android_9.0.0_r45   文件: UsbManager.java
/**
 * Gets the status of the specified USB port.
 *
 * @param port The port to query.
 * @return The status of the specified USB port, or null if unknown.
 *
 * @hide
 */
public UsbPortStatus getPortStatus(UsbPort port) {
    Preconditions.checkNotNull(port, "port must not be null");

    try {
        return mService.getPortStatus(port.getId());
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
源代码18 项目: android_9.0.0_r45   文件: LockSettingsService.java
private void setStringUnchecked(String key, int userId, String value) {
    Preconditions.checkArgument(userId != USER_FRP, "cannot store lock settings for FRP user");

    mStorage.writeKeyValue(key, value, userId);
    if (ArrayUtils.contains(SETTINGS_TO_BACKUP, key)) {
        BackupManager.dataChanged("com.android.providers.settings");
    }
}
 
源代码19 项目: android_9.0.0_r45   文件: UsbDevice.java
/**
 * UsbDevice should only be instantiated by UsbService implementation
 * @hide
 */
public UsbDevice(@NonNull String name, int vendorId, int productId, int Class, int subClass,
        int protocol, @Nullable String manufacturerName, @Nullable String productName,
        @NonNull String version, @Nullable String serialNumber) {
    mName = Preconditions.checkNotNull(name);
    mVendorId = vendorId;
    mProductId = productId;
    mClass = Class;
    mSubclass = subClass;
    mProtocol = protocol;
    mManufacturerName = manufacturerName;
    mProductName = productName;
    mVersion = Preconditions.checkStringNotEmpty(version);
    mSerialNumber = serialNumber;
}
 
/** @hide */
public static TextClassificationConstants getSettings(Context context) {
    Preconditions.checkNotNull(context);
    final TextClassificationManager tcm =
            context.getSystemService(TextClassificationManager.class);
    if (tcm != null) {
        return tcm.getSettings();
    } else {
        return TextClassificationConstants.loadFromString(Settings.Global.getString(
                context.getApplicationContext().getContentResolver(),
                Settings.Global.TEXT_CLASSIFIER_CONSTANTS));
    }
}
 
TextClassificationSession(TextClassificationContext context, TextClassifier delegate) {
    mClassificationContext = Preconditions.checkNotNull(context);
    mDelegate = Preconditions.checkNotNull(delegate);
    mSessionId = new TextClassificationSessionId();
    mEventHelper = new SelectionEventHelper(mSessionId, mClassificationContext);
    initializeRemoteSession();
}
 
源代码22 项目: android_9.0.0_r45   文件: ShortcutService.java
@Override
public void disableShortcuts(String packageName, List shortcutIds,
        CharSequence disabledMessage, int disabledMessageResId, @UserIdInt int userId) {
    verifyCaller(packageName, userId);
    Preconditions.checkNotNull(shortcutIds, "shortcutIds must be provided");

    synchronized (mLock) {
        throwIfUserLockedL(userId);

        final ShortcutPackage ps = getPackageShortcutsForPublisherLocked(packageName, userId);

        ps.ensureImmutableShortcutsNotIncludedWithIds((List<String>) shortcutIds,
                /*ignoreInvisible=*/ true);

        final String disabledMessageString =
                (disabledMessage == null) ? null : disabledMessage.toString();

        for (int i = shortcutIds.size() - 1; i >= 0; i--) {
            final String id = Preconditions.checkStringNotEmpty((String) shortcutIds.get(i));
            if (!ps.isShortcutExistsAndVisibleToPublisher(id)) {
                continue;
            }
            ps.disableWithId(id,
                    disabledMessageString, disabledMessageResId,
                    /* overrideImmutable=*/ false, /*ignoreInvisible=*/ true,
                    ShortcutInfo.DISABLED_REASON_BY_APP);
        }

        // We may have removed dynamic shortcuts which may have left a gap, so adjust the ranks.
        ps.adjustRanks();
    }
    packageShortcutsChanged(packageName, userId);

    verifyStates();
}
 
/** @hide */
@Override
public boolean isSignedByExactly(String packageName, KeySet ks) {
    Preconditions.checkNotNull(packageName);
    Preconditions.checkNotNull(ks);
    try {
        return mPM.isPackageSignedByKeySetExactly(packageName, ks);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
/** @hide */
@Override
public KeySet getKeySetByAlias(String packageName, String alias) {
    Preconditions.checkNotNull(packageName);
    Preconditions.checkNotNull(alias);
    KeySet ks;
    try {
        ks = mPM.getKeySetByAlias(packageName, alias);
    } catch (RemoteException e) {
        return null;
    }
    return ks;
}
 
/** @hide */
@Override
public boolean isSignedBy(String packageName, KeySet ks) {
    Preconditions.checkNotNull(packageName);
    Preconditions.checkNotNull(ks);
    try {
        return mPM.isPackageSignedByKeySet(packageName, ks);
    } catch (RemoteException e) {
        return false;
    }
}
 
源代码26 项目: android_9.0.0_r45   文件: ShortcutInfo.java
/**
 * Used with the old style constructor, kept for unit tests.
 * @hide
 */
@NonNull
@Deprecated
public Builder setId(@NonNull String id) {
    mId = Preconditions.checkStringNotEmpty(id, "id cannot be empty");
    return this;
}
 
源代码27 项目: android_9.0.0_r45   文件: ContentResolver.java
/**
 * Open a stream on to the content associated with a content URI.  If there
 * is no data associated with the URI, FileNotFoundException is thrown.
 *
 * <h5>Accepts the following URI schemes:</h5>
 * <ul>
 * <li>content ({@link #SCHEME_CONTENT})</li>
 * <li>android.resource ({@link #SCHEME_ANDROID_RESOURCE})</li>
 * <li>file ({@link #SCHEME_FILE})</li>
 * </ul>
 *
 * <p>See {@link #openAssetFileDescriptor(Uri, String)} for more information
 * on these schemes.
 *
 * @param uri The desired URI.
 * @return InputStream
 * @throws FileNotFoundException if the provided URI could not be opened.
 * @see #openAssetFileDescriptor(Uri, String)
 */
public final @Nullable InputStream openInputStream(@NonNull Uri uri)
        throws FileNotFoundException {
    Preconditions.checkNotNull(uri, "uri");
    String scheme = uri.getScheme();
    if (SCHEME_ANDROID_RESOURCE.equals(scheme)) {
        // Note: left here to avoid breaking compatibility.  May be removed
        // with sufficient testing.
        OpenResourceIdResult r = getResourceId(uri);
        try {
            InputStream stream = r.r.openRawResource(r.id);
            return stream;
        } catch (Resources.NotFoundException ex) {
            throw new FileNotFoundException("Resource does not exist: " + uri);
        }
    } else if (SCHEME_FILE.equals(scheme)) {
        // Note: left here to avoid breaking compatibility.  May be removed
        // with sufficient testing.
        return new FileInputStream(uri.getPath());
    } else {
        AssetFileDescriptor fd = openAssetFileDescriptor(uri, "r", null);
        try {
            return fd != null ? fd.createInputStream() : null;
        } catch (IOException e) {
            throw new FileNotFoundException("Unable to create stream");
        }
    }
}
 
/** @hide */
@Override
public boolean isSignedBy(String packageName, KeySet ks) {
    Preconditions.checkNotNull(packageName);
    Preconditions.checkNotNull(ks);
    try {
        return mPM.isPackageSignedByKeySet(packageName, ks);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
/** @hide */
@Override
public KeySet getSigningKeySet(String packageName) {
    Preconditions.checkNotNull(packageName);
    try {
        return mPM.getSigningKeySet(packageName);
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
public void removeKey(@NonNull String alias) throws RemoteException {
    checkRecoverKeyStorePermission();
    Preconditions.checkNotNull(alias, "alias is null");
    int uid = Binder.getCallingUid();
    int userId = UserHandle.getCallingUserId();

    boolean wasRemoved = mDatabase.removeKey(uid, alias);
    if (wasRemoved) {
        mDatabase.setShouldCreateSnapshot(userId, uid, true);
        mApplicationKeyStorage.deleteEntry(userId, uid, alias);
    }
}