Add some standard definitions for device heaps.
These can be included as desired by particular devices to configure their Dalvik heap in a standard way. Change-Id: I487c751d7c583b0e93552f16ab43a93314219778
This commit is contained in:
@@ -24307,6 +24307,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="getLargeMemoryClass"
|
||||
return="int"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="getMemoryClass"
|
||||
return="int"
|
||||
abstract="false"
|
||||
|
||||
23
build/phone-hdpi-512-dalvik-heap.mk
Normal file
23
build/phone-hdpi-512-dalvik-heap.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed 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.
|
||||
#
|
||||
|
||||
# Provides overrides to configure the Dalvik heap for a standard high density
|
||||
# phone with around 512MB total RAM.
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
dalvik.vm.heapstartsize=5m \
|
||||
dalvik.vm.smallheapsize=32m \
|
||||
dalvik.vm.heapsize=32m
|
||||
22
build/phone-hdpi-dalvik-heap.mk
Normal file
22
build/phone-hdpi-dalvik-heap.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed 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.
|
||||
#
|
||||
|
||||
# Provides overrides to configure the Dalvik heap for a standard high density phone.
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
dalvik.vm.heapstartsize=5m \
|
||||
dalvik.vm.smallheapsize=32m \
|
||||
dalvik.vm.heapsize=32m
|
||||
22
build/tablet-dalvik-heap.mk
Normal file
22
build/tablet-dalvik-heap.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# Licensed 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.
|
||||
#
|
||||
|
||||
# Provides overrides to configure the Dalvik heap for a standard tablet device.
|
||||
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
dalvik.vm.heapstartsize=5m \
|
||||
dalvik.vm.smallheapsize=48m \
|
||||
dalvik.vm.heapsize=48m
|
||||
@@ -62,6 +62,28 @@ public class ActivityManager {
|
||||
|
||||
/** @hide */
|
||||
static public int staticGetMemoryClass() {
|
||||
// Really brain dead right now -- just take this from the configured
|
||||
// vm heap size, and assume it is in megabytes and thus ends with "m".
|
||||
String vmHeapSize = SystemProperties.get("dalvik.vm.smallheapsize", "16m");
|
||||
return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length()-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the approximate per-application memory class of the current
|
||||
* device when an application is running with a large heap. This is the
|
||||
* space available for memory-intensive applications; most applications
|
||||
* should not need this amount of memory, and should instead stay with the
|
||||
* {@link #getMemoryClass()} limit. The returned value is in megabytes.
|
||||
* This may be the same size as {@link #getMemoryClass()} on memory
|
||||
* constrained devices, or it may be significantly larger on devices with
|
||||
* a large amount of available RAM.
|
||||
*/
|
||||
public int getLargeMemoryClass() {
|
||||
return staticGetLargeMemoryClass();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
static public int staticGetLargeMemoryClass() {
|
||||
// Really brain dead right now -- just take this from the configured
|
||||
// vm heap size, and assume it is in megabytes and thus ends with "m".
|
||||
String vmHeapSize = SystemProperties.get("dalvik.vm.heapsize", "16m");
|
||||
|
||||
Reference in New Issue
Block a user