Search in sources :

Example 11 with SensitiveArg

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

the class NetworkManagementService method startAccessPoint.

@Override
public void startAccessPoint(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 {
            String ssid_mode = "broadcast";
            if (mContext.getResources().getBoolean(com.android.internal.R.bool.config_regional_hotspot_show_broadcast_ssid_checkbox) && wifiConfig.hiddenSSID) {
                ssid_mode = "hidden";
            }
            if (mContext.getResources().getBoolean(com.android.internal.R.bool.config_regional_hotspot_show_maximum_connection_enable)) {
                int clientNum = Settings.System.getInt(mContext.getContentResolver(), "WIFI_HOTSPOT_MAX_CLIENT_NUM", 8);
                if (DBG)
                    Slog.d(TAG, "clientNum: " + clientNum);
                args = new Object[] { "set", wlanIface, wifiConfig.SSID, ssid_mode, Integer.toString(wifiConfig.apChannel), getSecurityType(wifiConfig), new SensitiveArg(wifiConfig.preSharedKey), clientNum };
            } else {
                args = new Object[] { "set", wlanIface, wifiConfig.SSID, ssid_mode, Integer.toString(wifiConfig.apChannel), getSecurityType(wifiConfig), new SensitiveArg(wifiConfig.preSharedKey) };
            }
        }
        executeOrLogWithMessage(SOFT_AP_COMMAND, args, NetdResponseCode.SoftapStatusResult, SOFT_AP_COMMAND_SUCCESS, logMsg);
        logMsg = "startAccessPoint Error starting softap";
        args = new Object[] { "startap", wlanIface };
        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)

Example 12 with SensitiveArg

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

the class MountService method encryptStorageExtended.

private int encryptStorageExtended(int type, String password, boolean wipe) {
    if (TextUtils.isEmpty(password) && type != StorageManager.CRYPT_TYPE_DEFAULT) {
        throw new IllegalArgumentException("password cannot be empty");
    }
    mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER, "no permission to access the crypt keeper");
    waitForReady();
    if (DEBUG_EVENTS) {
        Slog.i(TAG, "encrypting storage...");
    }
    try {
        if (type == StorageManager.CRYPT_TYPE_DEFAULT) {
            mCryptConnector.execute("cryptfs", "enablecrypto", wipe ? "wipe" : "inplace", CRYPTO_TYPES[type]);
        } else {
            mCryptConnector.execute("cryptfs", "enablecrypto", wipe ? "wipe" : "inplace", CRYPTO_TYPES[type], new SensitiveArg(password));
        }
    } catch (NativeDaemonConnectorException e) {
        // Encryption failed
        return e.getCode();
    }
    return 0;
}
Also used : SensitiveArg(com.android.server.NativeDaemonConnector.SensitiveArg)

Example 13 with SensitiveArg

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

the class NetworkManagementService method startAccessPoint.

@Override
public void startAccessPoint(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 {
            String ssid_mode = "broadcast";
            if (mContext.getResources().getBoolean(com.android.internal.R.bool.config_regional_hotspot_show_broadcast_ssid_checkbox) && wifiConfig.hiddenSSID) {
                ssid_mode = "hidden";
            }
            if (mContext.getResources().getBoolean(com.android.internal.R.bool.config_regional_hotspot_show_maximum_connection_enable)) {
                int clientNum = Settings.System.getInt(mContext.getContentResolver(), "WIFI_HOTSPOT_MAX_CLIENT_NUM", 8);
                if (DBG)
                    Slog.d(TAG, "clientNum: " + clientNum);
                args = new Object[] { "set", wlanIface, wifiConfig.SSID, ssid_mode, Integer.toString(wifiConfig.apChannel), getSecurityType(wifiConfig), new SensitiveArg(wifiConfig.preSharedKey), clientNum };
            } else {
                args = new Object[] { "set", wlanIface, wifiConfig.SSID, ssid_mode, Integer.toString(wifiConfig.apChannel), getSecurityType(wifiConfig), new SensitiveArg(wifiConfig.preSharedKey) };
            }
        }
        executeOrLogWithMessage(SOFT_AP_COMMAND, args, NetdResponseCode.SoftapStatusResult, SOFT_AP_COMMAND_SUCCESS, logMsg);
        logMsg = "startAccessPoint Error starting softap";
        args = new Object[] { "startap", wlanIface };
        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)

Example 14 with SensitiveArg

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

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 15 with SensitiveArg

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

the class MountService method resizeSecureContainer.

@Override
public int resizeSecureContainer(String id, int sizeMb, String key) {
    enforcePermission(android.Manifest.permission.ASEC_CREATE);
    waitForReady();
    warnOnNotMounted();
    int rc = StorageResultCode.OperationSucceeded;
    try {
        mConnector.execute("asec", "resize", id, sizeMb, new SensitiveArg(key));
    } catch (NativeDaemonConnectorException e) {
        rc = StorageResultCode.OperationFailedInternalError;
    }
    return rc;
}
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