Search in sources :

Example 41 with SensitiveArg

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

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)

Example 42 with SensitiveArg

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

the class NativeDaemonConnectorTest method testSensitiveArgs.

public void testSensitiveArgs() throws Exception {
    final StringBuilder rawBuilder = new StringBuilder();
    final StringBuilder logBuilder = new StringBuilder();
    rawBuilder.setLength(0);
    logBuilder.setLength(0);
    makeCommand(rawBuilder, logBuilder, 1, "foo", "bar", "baz");
    assertEquals("1 foo bar baz\0", rawBuilder.toString());
    assertEquals("1 foo bar baz", logBuilder.toString());
    rawBuilder.setLength(0);
    logBuilder.setLength(0);
    makeCommand(rawBuilder, logBuilder, 1, "foo", new SensitiveArg("bar"), "baz");
    assertEquals("1 foo bar baz\0", rawBuilder.toString());
    assertEquals("1 foo [scrubbed] baz", logBuilder.toString());
    rawBuilder.setLength(0);
    logBuilder.setLength(0);
    makeCommand(rawBuilder, logBuilder, 1, "foo", new SensitiveArg("foo bar"), "baz baz", new SensitiveArg("wat"));
    assertEquals("1 foo \"foo bar\" \"baz baz\" wat\0", rawBuilder.toString());
    assertEquals("1 foo [scrubbed] \"baz baz\" [scrubbed]", logBuilder.toString());
}
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