diff options
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/main/java/java/io/Console.java | 39 | ||||
-rw-r--r-- | luni/src/main/native/java_io_Console.cpp | 51 | ||||
-rw-r--r-- | luni/src/main/native/sub.mk | 1 |
3 files changed, 4 insertions, 87 deletions
diff --git a/luni/src/main/java/java/io/Console.java b/luni/src/main/java/java/io/Console.java index b6532eb..fe07694c 100644 --- a/luni/src/main/java/java/io/Console.java +++ b/luni/src/main/java/java/io/Console.java @@ -127,48 +127,17 @@ public final class Console implements Flushable { } /** - * Reads a password from the console. The password will not be echoed to the display. - * - * @return a character array containing the password, or null at EOF. + * This method is unimplemented on Android. */ public char[] readPassword() { - synchronized (CONSOLE_LOCK) { - int previousState = setEcho(false, 0); - try { - String password = readLine(); - writer.println(); // We won't have echoed the user's newline. - return (password == null) ? null : password.toCharArray(); - } finally { - setEcho(true, previousState); - } - } - } - - private static int setEcho(boolean on, int previousState) { - try { - return setEchoImpl(on, previousState); - } catch (IOException ex) { - throw new IOError(ex); - } + throw new UnsupportedOperationException(); } - private static native int setEchoImpl(boolean on, int previousState) throws IOException; /** - * Reads a password from the console. The password will not be echoed to the display. - * A formatted prompt is also displayed. - * - * @param format the format string (see {@link java.util.Formatter#format}) - * @param args - * the list of arguments passed to the formatter. If there are - * more arguments than required by {@code format}, - * additional arguments are ignored. - * @return a character array containing the password, or null at EOF. + * This method is unimplemented on Android. */ public char[] readPassword(String format, Object... args) { - synchronized (CONSOLE_LOCK) { - format(format, args); - return readPassword(); - } + throw new UnsupportedOperationException(); } /** diff --git a/luni/src/main/native/java_io_Console.cpp b/luni/src/main/native/java_io_Console.cpp deleted file mode 100644 index 512bc72..0000000 --- a/luni/src/main/native/java_io_Console.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "Console" - -#include "JNIHelp.h" -#include "JniConstants.h" - -#include <errno.h> -#include <termios.h> -#include <unistd.h> - -static jint Console_setEchoImpl(JNIEnv* env, jclass, jboolean on, jint previousState) { - termios state; - if (TEMP_FAILURE_RETRY(tcgetattr(STDIN_FILENO, &state)) == -1) { - jniThrowIOException(env, errno); - return 0; - } - if (on) { - state.c_lflag = previousState; - } else { - previousState = state.c_lflag; - state.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL); - } - if (TEMP_FAILURE_RETRY(tcsetattr(STDIN_FILENO, TCSAFLUSH, &state)) == -1){ - jniThrowIOException(env, errno); - return 0; - } - return previousState; -} - -static JNINativeMethod gMethods[] = { - NATIVE_METHOD(Console, setEchoImpl, "(ZI)I"), -}; -void register_java_io_Console(JNIEnv* env) { - jniRegisterNativeMethods(env, "java/io/Console", gMethods, NELEM(gMethods)); -} diff --git a/luni/src/main/native/sub.mk b/luni/src/main/native/sub.mk index 9ca5054..88085c6 100644 --- a/luni/src/main/native/sub.mk +++ b/luni/src/main/native/sub.mk @@ -14,7 +14,6 @@ LOCAL_SRC_FILES := \ android_system_OsConstants.cpp \ canonicalize_path.cpp \ cbigint.cpp \ - java_io_Console.cpp \ java_io_File.cpp \ java_io_ObjectStreamClass.cpp \ java_lang_Character.cpp \ |