Example usage for android.util Slog i

List of usage examples for android.util Slog i

Introduction

In this page you can find the example usage for android.util Slog i.

Prototype

@UnsupportedAppUsage
    public static int i(String tag, String msg) 

Source Link

Usage

From source file:com.android.server.MountService.java

@Override
public void unmountObb(String rawPath, boolean force, IObbActionListener token, int nonce) {
    Preconditions.checkNotNull(rawPath, "rawPath cannot be null");

    final ObbState existingState;
    synchronized (mObbPathToStateMap) {
        existingState = mObbPathToStateMap.get(rawPath);
    }/*from  w  w w. ja  v a2s .  c o m*/

    if (existingState != null) {
        // TODO: separate state object from request data
        final int callingUid = Binder.getCallingUid();
        final ObbState newState = new ObbState(rawPath, existingState.canonicalPath, callingUid, token, nonce);
        final ObbAction action = new UnmountObbAction(newState, force);
        mObbActionHandler.sendMessage(mObbActionHandler.obtainMessage(OBB_RUN_ACTION, action));

        if (DEBUG_OBB)
            Slog.i(TAG, "Send to OBB handler: " + action.toString());
    } else {
        Slog.w(TAG, "Unknown OBB mount at " + rawPath);
    }
}

From source file:com.android.server.MountService.java

@Override
public int decryptStorage(String password) {
    if (TextUtils.isEmpty(password)) {
        throw new IllegalArgumentException("password cannot be empty");
    }/*  w  w w.  j  a  v a 2s . c  om*/

    mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
            "no permission to access the crypt keeper");

    waitForReady();

    if (DEBUG_EVENTS) {
        Slog.i(TAG, "decrypting storage...");
    }

    final NativeDaemonEvent event;
    try {
        event = mConnector.execute("cryptfs", "checkpw", new SensitiveArg(toHex(password)));

        final int code = Integer.parseInt(event.getMessage());
        if (code == 0) {
            // Decrypt was successful. Post a delayed message before restarting in order
            // to let the UI to clear itself
            mHandler.postDelayed(new Runnable() {
                public void run() {
                    try {
                        mConnector.execute("cryptfs", "restart");
                    } catch (NativeDaemonConnectorException e) {
                        Slog.e(TAG, "problem executing in background", e);
                    }
                }
            }, 1000); // 1 second
        }

        return code;
    } catch (NativeDaemonConnectorException e) {
        // Decryption failed
        return e.getCode();
    }
}

From source file:com.android.server.MountService.java

public int encryptStorage(int type, String password) {
    if (TextUtils.isEmpty(password) && type != StorageManager.CRYPT_TYPE_DEFAULT) {
        throw new IllegalArgumentException("password cannot be empty");
    }//w  w  w.jav a2 s.  co m

    mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
            "no permission to access the crypt keeper");

    waitForReady();

    if (DEBUG_EVENTS) {
        Slog.i(TAG, "encrypting storage...");
    }

    try {
        mConnector.execute("cryptfs", "enablecrypto", "inplace", CRYPTO_TYPES[type],
                new SensitiveArg(toHex(password)));
    } catch (NativeDaemonConnectorException e) {
        // Encryption failed
        return e.getCode();
    }

    return 0;
}

From source file:com.android.server.MountService.java

/** Set the password for encrypting the master key.
 *  @param type One of the CRYPTO_TYPE_XXX consts defined in StorageManager.
 *  @param password The password to set.
 */// w  ww. j a  va2  s.  c o  m
public int changeEncryptionPassword(int type, String password) {
    mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
            "no permission to access the crypt keeper");

    waitForReady();

    if (DEBUG_EVENTS) {
        Slog.i(TAG, "changing encryption password...");
    }

    try {
        NativeDaemonEvent event = mConnector.execute("cryptfs", "changepw", CRYPTO_TYPES[type],
                new SensitiveArg(toHex(password)));
        return Integer.parseInt(event.getMessage());
    } catch (NativeDaemonConnectorException e) {
        // Encryption failed
        return e.getCode();
    }
}

From source file:com.android.server.MountService.java

/**
 * Validate a user-supplied password string with cryptfs
 *//*from   w  w  w.j a  v a 2s . c  om*/
@Override
public int verifyEncryptionPassword(String password) throws RemoteException {
    // Only the system process is permitted to validate passwords
    if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
        throw new SecurityException("no permission to access the crypt keeper");
    }

    mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
            "no permission to access the crypt keeper");

    if (TextUtils.isEmpty(password)) {
        throw new IllegalArgumentException("password cannot be empty");
    }

    waitForReady();

    if (DEBUG_EVENTS) {
        Slog.i(TAG, "validating encryption password...");
    }

    final NativeDaemonEvent event;
    try {
        event = mConnector.execute("cryptfs", "verifypw", new SensitiveArg(toHex(password)));
        Slog.i(TAG, "cryptfs verifypw => " + event.getMessage());
        return Integer.parseInt(event.getMessage());
    } catch (NativeDaemonConnectorException e) {
        // Encryption failed
        return e.getCode();
    }
}

From source file:android.content.pm.PackageParser.java

private static VerifierInfo parseVerifier(Resources res, XmlPullParser parser, AttributeSet attrs, int flags) {
    final TypedArray sa = res.obtainAttributes(attrs,
            com.android.internal.R.styleable.AndroidManifestPackageVerifier);

    final String packageName = sa
            .getNonResourceString(com.android.internal.R.styleable.AndroidManifestPackageVerifier_name);

    final String encodedPublicKey = sa
            .getNonResourceString(com.android.internal.R.styleable.AndroidManifestPackageVerifier_publicKey);

    sa.recycle();//from  w w w  .  ja va2 s. c om

    if (packageName == null || packageName.length() == 0) {
        Slog.i(TAG, "verifier package name was null; skipping");
        return null;
    }

    final PublicKey publicKey = parsePublicKey(encodedPublicKey);
    if (publicKey == null) {
        Slog.i(TAG, "Unable to parse verifier public key for " + packageName);
        return null;
    }

    return new VerifierInfo(packageName, publicKey);
}