Search in sources :

Example 26 with SensitiveArg

use of com.android.server.NativeDaemonConnector.SensitiveArg in project android_frameworks_base by AOSPA.

the class MountService method mountSecureContainer.

public int mountSecureContainer(String id, String key, int ownerUid, boolean readOnly) {
    enforcePermission(android.Manifest.permission.ASEC_MOUNT_UNMOUNT);
    waitForReady();
    warnOnNotMounted();
    synchronized (mAsecMountSet) {
        if (mAsecMountSet.contains(id)) {
            return StorageResultCode.OperationFailedStorageMounted;
        }
    }
    int rc = StorageResultCode.OperationSucceeded;
    try {
        mConnector.execute("asec", "mount", id, new SensitiveArg(key), ownerUid, readOnly ? "ro" : "rw");
    } catch (NativeDaemonConnectorException e) {
        int code = e.getCode();
        if (code != VoldResponseCode.OpFailedStorageBusy) {
            rc = StorageResultCode.OperationFailedInternalError;
        }
    }
    if (rc == StorageResultCode.OperationSucceeded) {
        synchronized (mAsecMountSet) {
            mAsecMountSet.add(id);
        }
    }
    return rc;
}
Also used : SensitiveArg(com.android.server.NativeDaemonConnector.SensitiveArg)

Example 27 with SensitiveArg

use of com.android.server.NativeDaemonConnector.SensitiveArg in project android_frameworks_base by DirtyUnicorns.

the class MountService method mountSecureContainer.

public int mountSecureContainer(String id, String key, int ownerUid, boolean readOnly) {
    enforcePermission(android.Manifest.permission.ASEC_MOUNT_UNMOUNT);
    waitForReady();
    warnOnNotMounted();
    synchronized (mAsecMountSet) {
        if (mAsecMountSet.contains(id)) {
            return StorageResultCode.OperationFailedStorageMounted;
        }
    }
    int rc = StorageResultCode.OperationSucceeded;
    try {
        mConnector.execute("asec", "mount", id, new SensitiveArg(key), ownerUid, readOnly ? "ro" : "rw");
    } catch (NativeDaemonConnectorException e) {
        int code = e.getCode();
        if (code != VoldResponseCode.OpFailedStorageBusy) {
            rc = StorageResultCode.OperationFailedInternalError;
        }
    }
    if (rc == StorageResultCode.OperationSucceeded) {
        synchronized (mAsecMountSet) {
            mAsecMountSet.add(id);
        }
    }
    return rc;
}
Also used : SensitiveArg(com.android.server.NativeDaemonConnector.SensitiveArg)

Example 28 with SensitiveArg

use of com.android.server.NativeDaemonConnector.SensitiveArg in project android_frameworks_base by DirtyUnicorns.

the class MountService method changeEncryptionPassword.

/** 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.
     */
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 = mCryptConnector.execute("cryptfs", "changepw", CRYPTO_TYPES[type], new SensitiveArg(password));
        return Integer.parseInt(event.getMessage());
    } catch (NativeDaemonConnectorException e) {
        // Encryption failed
        return e.getCode();
    }
}
Also used : SensitiveArg(com.android.server.NativeDaemonConnector.SensitiveArg)

Example 29 with SensitiveArg

use of com.android.server.NativeDaemonConnector.SensitiveArg in project android_frameworks_base by DirtyUnicorns.

the class MountService method createSecureContainer.

public int createSecureContainer(String id, int sizeMb, String fstype, String key, int ownerUid, boolean external) {
    enforcePermission(android.Manifest.permission.ASEC_CREATE);
    waitForReady();
    warnOnNotMounted();
    int rc = StorageResultCode.OperationSucceeded;
    try {
        mConnector.execute("asec", "create", id, sizeMb, fstype, new SensitiveArg(key), ownerUid, external ? "1" : "0");
    } catch (NativeDaemonConnectorException e) {
        rc = StorageResultCode.OperationFailedInternalError;
    }
    if (rc == StorageResultCode.OperationSucceeded) {
        synchronized (mAsecMountSet) {
            mAsecMountSet.add(id);
        }
    }
    return rc;
}
Also used : SensitiveArg(com.android.server.NativeDaemonConnector.SensitiveArg)

Example 30 with SensitiveArg

use of com.android.server.NativeDaemonConnector.SensitiveArg in project android_frameworks_base by DirtyUnicorns.

the class NetworkManagementService method setAccessPoint.

@Override
public void setAccessPoint(WifiConfiguration wifiConfig, String wlanIface) {
    mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
    Object[] args;
    String logMsg = "startAccessPoint Error setting up softap";
    try {
        if (wifiConfig == null) {
            args = new Object[] { "set", wlanIface };
        } else {
            // TODO: understand why this is set to "6" instead of
            // Integer.toString(wifiConfig.apChannel) as in startAccessPoint
            // TODO: should startAccessPoint call this instead of repeating code?
            args = new Object[] { "set", wlanIface, wifiConfig.SSID, "broadcast", "6", getSecurityType(wifiConfig), new SensitiveArg(wifiConfig.preSharedKey) };
        }
        executeOrLogWithMessage(SOFT_AP_COMMAND, args, NetdResponseCode.SoftapStatusResult, SOFT_AP_COMMAND_SUCCESS, logMsg);
    } catch (NativeDaemonConnectorException e) {
        throw e.rethrowAsParcelableException();
    }
}
Also used : SensitiveArg(com.android.server.NativeDaemonConnector.SensitiveArg)

Aggregations

SensitiveArg (com.android.server.NativeDaemonConnector.SensitiveArg)42 RemoteException (android.os.RemoteException)3 ILockSettings (com.android.internal.widget.ILockSettings)3