blob: d3501f4ab15f1d647ea0fcaa969b50b954bcba9a [file] [log] [blame]
The Android Open Source Projectf6c38712009-03-03 19:28:47 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * java.lang.SystemProperties
19 */
20#include "Dalvik.h"
21#include "native/InternalNativePriv.h"
22
23
24/*
25 * Expected call sequence:
26 * (1) call SystemProperties.preInit() to get VM defaults
27 * (2) set any higher-level defaults
28 * (3) call SystemProperties.postInit() to get command-line overrides
29 * This currently happens the first time somebody tries to access a property.
30 *
31 * SystemProperties is a Dalvik-specific package-scope class.
32 */
33
34/*
35 * void preInit()
36 *
37 * Tells the VM to populate the properties table with VM defaults.
38 */
39static void Dalvik_java_lang_SystemProperties_preInit(const u4* args,
40 JValue* pResult)
41{
42 dvmCreateDefaultProperties((Object*) args[0]);
43 RETURN_VOID();
44}
45
46/*
47 * void postInit()
48 *
49 * Tells the VM to update properties with values from the command line.
50 */
51static void Dalvik_java_lang_SystemProperties_postInit(const u4* args,
52 JValue* pResult)
53{
54 dvmSetCommandLineProperties((Object*) args[0]);
55 RETURN_VOID();
56}
57
58const DalvikNativeMethod dvm_java_lang_SystemProperties[] = {
59 { "preInit", "()V",
60 Dalvik_java_lang_SystemProperties_preInit },
61 { "postInit", "()V",
62 Dalvik_java_lang_SystemProperties_postInit },
63 { NULL, NULL, NULL },
64};
65