Skip to content

Commit c1ac23d

Browse files
Jeff BrownAndroid (Google) Code Review
authored andcommitted
Merge "Delete useless JNI methods."
2 parents 0b8f459 + 16f5f5c commit c1ac23d

File tree

2 files changed

+12
-61
lines changed

2 files changed

+12
-61
lines changed

core/java/com/android/internal/os/RuntimeInit.java

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class RuntimeInit {
5050

5151
private static volatile boolean mCrashing = false;
5252

53+
private static final native void nativeZygoteInit();
54+
private static final native void nativeFinishInit();
55+
5356
/**
5457
* Use this to log a message when a thread exits due to an uncaught
5558
* exception. The framework catches these for the main threads, so
@@ -91,13 +94,6 @@ private static final void commonInit() {
9194
/* set default handler; this applies to all threads in the VM */
9295
Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
9396

94-
int hasQwerty = getQwertyKeyboard();
95-
96-
if (DEBUG) Slog.d(TAG, ">>>>> qwerty keyboard = " + hasQwerty);
97-
if (hasQwerty == 1) {
98-
System.setProperty("qwerty", "1");
99-
}
100-
10197
/*
10298
* Install a TimezoneGetter subclass for ZoneInfo.db
10399
*/
@@ -235,16 +231,14 @@ public static final void main(String[] argv) {
235231
* Now that we're running in interpreted code, call back into native code
236232
* to run the system.
237233
*/
238-
finishInit();
234+
nativeFinishInit();
239235

240236
if (DEBUG) Slog.d(TAG, "Leaving RuntimeInit!");
241237
}
242238

243-
public static final native void finishInit();
244-
245239
/**
246240
* The main function called when started through the zygote process. This
247-
* could be unified with main(), if the native code in finishInit()
241+
* could be unified with main(), if the native code in nativeFinishInit()
248242
* were rationalized with Zygote startup.<p>
249243
*
250244
* Current recognized args:
@@ -262,7 +256,7 @@ public static final void zygoteInit(int targetSdkVersion, String[] argv)
262256
redirectLogStreams();
263257

264258
commonInit();
265-
zygoteInitNative();
259+
nativeZygoteInit();
266260

267261
applicationInit(targetSdkVersion, argv);
268262
}
@@ -315,24 +309,6 @@ public static void redirectLogStreams() {
315309
System.setErr(new AndroidPrintStream(Log.WARN, "System.err"));
316310
}
317311

318-
public static final native void zygoteInitNative();
319-
320-
/**
321-
* Returns 1 if the computer is on. If the computer isn't on, the value returned by this method is undefined.
322-
*/
323-
public static final native int isComputerOn();
324-
325-
/**
326-
* Turns the computer on if the computer is off. If the computer is on, the behavior of this method is undefined.
327-
*/
328-
public static final native void turnComputerOn();
329-
330-
/**
331-
*
332-
* @return 1 if the device has a qwerty keyboard
333-
*/
334-
public static native int getQwertyKeyboard();
335-
336312
/**
337313
* Report a serious error in the current process. May or may not cause
338314
* the process to terminate (depends on system settings).

core/jni/AndroidRuntime.cpp

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -189,49 +189,24 @@ static void doThrow(JNIEnv* env, const char* exc, const char* msg = NULL)
189189
/*
190190
* Code written in the Java Programming Language calls here from main().
191191
*/
192-
static void com_android_internal_os_RuntimeInit_finishInit(JNIEnv* env, jobject clazz)
192+
static void com_android_internal_os_RuntimeInit_nativeFinishInit(JNIEnv* env, jobject clazz)
193193
{
194194
gCurRuntime->onStarted();
195195
}
196196

197-
static void com_android_internal_os_RuntimeInit_zygoteInit(JNIEnv* env, jobject clazz)
197+
static void com_android_internal_os_RuntimeInit_nativeZygoteInit(JNIEnv* env, jobject clazz)
198198
{
199199
gCurRuntime->onZygoteInit();
200200
}
201201

202-
static jint com_android_internal_os_RuntimeInit_isComputerOn(JNIEnv* env, jobject clazz)
203-
{
204-
return 1;
205-
}
206-
207-
static void com_android_internal_os_RuntimeInit_turnComputerOn(JNIEnv* env, jobject clazz)
208-
{
209-
}
210-
211-
static jint com_android_internal_os_RuntimeInit_getQwertyKeyboard(JNIEnv* env, jobject clazz)
212-
{
213-
char* value = getenv("qwerty");
214-
if (value != NULL && strcmp(value, "true") == 0) {
215-
return 1;
216-
}
217-
218-
return 0;
219-
}
220-
221202
/*
222203
* JNI registration.
223204
*/
224205
static JNINativeMethod gMethods[] = {
225-
{ "finishInit", "()V",
226-
(void*) com_android_internal_os_RuntimeInit_finishInit },
227-
{ "zygoteInitNative", "()V",
228-
(void*) com_android_internal_os_RuntimeInit_zygoteInit },
229-
{ "isComputerOn", "()I",
230-
(void*) com_android_internal_os_RuntimeInit_isComputerOn },
231-
{ "turnComputerOn", "()V",
232-
(void*) com_android_internal_os_RuntimeInit_turnComputerOn },
233-
{ "getQwertyKeyboard", "()I",
234-
(void*) com_android_internal_os_RuntimeInit_getQwertyKeyboard },
206+
{ "nativeFinishInit", "()V",
207+
(void*) com_android_internal_os_RuntimeInit_nativeFinishInit },
208+
{ "nativeZygoteInit", "()V",
209+
(void*) com_android_internal_os_RuntimeInit_nativeZygoteInit },
235210
};
236211

237212
int register_com_android_internal_os_RuntimeInit(JNIEnv* env)

0 commit comments

Comments
 (0)