Merge "Add new ActivityManager.isLowRamDevice()."
This commit is contained in:
committed by
Android (Google) Code Review
commit
49e9c44c4b
@@ -2904,6 +2904,7 @@ package android.app {
|
||||
method public android.app.PendingIntent getRunningServiceControlPanel(android.content.ComponentName) throws java.lang.SecurityException;
|
||||
method public java.util.List<android.app.ActivityManager.RunningServiceInfo> getRunningServices(int) throws java.lang.SecurityException;
|
||||
method public java.util.List<android.app.ActivityManager.RunningTaskInfo> getRunningTasks(int) throws java.lang.SecurityException;
|
||||
method public boolean isLowRamDevice();
|
||||
method public static boolean isRunningInTestHarness();
|
||||
method public static boolean isUserAMonkey();
|
||||
method public void killBackgroundProcesses(java.lang.String);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.app;
|
||||
|
||||
import android.R;
|
||||
import android.os.BatteryStats;
|
||||
import android.os.IBinder;
|
||||
import com.android.internal.app.IUsageStats;
|
||||
@@ -377,7 +378,23 @@ public class ActivityManager {
|
||||
String vmHeapSize = SystemProperties.get("dalvik.vm.heapsize", "16m");
|
||||
return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length()-1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if this is a low-RAM device. Exactly whether a device is low-RAM
|
||||
* is ultimately up to the device configuration, but currently it generally means
|
||||
* something in the class of a 512MB device with about a 800x480 or less screen.
|
||||
* This is mostly intended to be used by apps to determine whether they should turn
|
||||
* off certain features that require more RAM.
|
||||
*/
|
||||
public boolean isLowRamDevice() {
|
||||
return isLowRamDeviceStatic();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static boolean isLowRamDeviceStatic() {
|
||||
return Resources.getSystem().getBoolean(com.android.internal.R.bool.config_lowRamDevice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by persistent processes to determine if they are running on a
|
||||
* higher-end device so should be okay using hardware drawing acceleration
|
||||
@@ -385,43 +402,8 @@ public class ActivityManager {
|
||||
* @hide
|
||||
*/
|
||||
static public boolean isHighEndGfx() {
|
||||
MemInfoReader reader = new MemInfoReader();
|
||||
reader.readMemInfo();
|
||||
if (reader.getTotalSize() >= (512*1024*1024)) {
|
||||
// If the device has at least 512MB RAM available to the kernel,
|
||||
// we can afford the overhead of graphics acceleration.
|
||||
return true;
|
||||
}
|
||||
|
||||
Display display = DisplayManagerGlobal.getInstance().getRealDisplay(
|
||||
Display.DEFAULT_DISPLAY);
|
||||
Point p = new Point();
|
||||
display.getRealSize(p);
|
||||
int pixels = p.x * p.y;
|
||||
if (pixels >= (1024*600)) {
|
||||
// If this is a sufficiently large screen, then there are enough
|
||||
// pixels on it that we'd really like to use hw drawing.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to decide whether the running device can be considered a "large
|
||||
* RAM" device. Exactly what memory limit large RAM is will vary, but
|
||||
* it essentially means there is plenty of RAM to have lots of background
|
||||
* processes running under decent loads.
|
||||
* @hide
|
||||
*/
|
||||
static public boolean isLargeRAM() {
|
||||
MemInfoReader reader = new MemInfoReader();
|
||||
reader.readMemInfo();
|
||||
if (reader.getTotalSize() >= (640*1024*1024)) {
|
||||
// Currently 640MB RAM available to the kernel is the point at
|
||||
// which we have plenty of RAM to spare.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !isLowRamDeviceStatic() &&
|
||||
!Resources.getSystem().getBoolean(com.android.internal.R.bool.config_avoidGfxAccel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,6 +123,17 @@
|
||||
of them. This should not normally be modified. -->
|
||||
<bool name="config_closeDialogWhenTouchOutside">true</bool>
|
||||
|
||||
<!-- Device configuration indicating this is a device with limited RAM, so heavier-weight
|
||||
features should be turned off. -->
|
||||
<bool name="config_lowRamDevice">false</bool>
|
||||
|
||||
<!-- Device configuration indicating whether we should avoid using accelerated graphics
|
||||
in certain places to reduce RAM footprint. This is ignored if config_lowRamDevice
|
||||
is true (in that case this is assumed true as well). It can allow you to tune down
|
||||
your device's memory use without going to the point of causing applications to turn
|
||||
off features. -->
|
||||
<bool name="config_avoidGfxAccel">false</bool>
|
||||
|
||||
<!-- The duration (in milliseconds) that the radio will scan for a signal
|
||||
when there's no network connection. If the scan doesn't timeout, use zero -->
|
||||
<integer name="config_radioScanningTimeout">0</integer>
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
<java-symbol type="bool" name="action_bar_embed_tabs" />
|
||||
<java-symbol type="bool" name="action_bar_embed_tabs_pre_jb" />
|
||||
<java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" />
|
||||
<java-symbol type="bool" name="config_avoidGfxAccel" />
|
||||
<java-symbol type="bool" name="config_allowActionMenuItemTextWithIcon" />
|
||||
<java-symbol type="bool" name="config_bluetooth_address_validation" />
|
||||
<java-symbol type="bool" name="config_bluetooth_sco_off_call" />
|
||||
@@ -250,6 +251,7 @@
|
||||
<java-symbol type="bool" name="config_duplicate_port_omadm_wappush" />
|
||||
<java-symbol type="bool" name="config_enable_emergency_call_while_sim_locked" />
|
||||
<java-symbol type="bool" name="config_enable_puk_unlock_screen" />
|
||||
<java-symbol type="bool" name="config_lowRamDevice" />
|
||||
<java-symbol type="bool" name="config_mms_content_disposition_support" />
|
||||
<java-symbol type="bool" name="config_showMenuShortcutsWhenKeyboardPresent" />
|
||||
<java-symbol type="bool" name="config_sip_wifi_only" />
|
||||
|
||||
@@ -850,7 +850,7 @@ public final class ProcessTracker {
|
||||
pw.print(prefix);
|
||||
pw.print("PSS (");
|
||||
pw.print(proc.mPssTableSize);
|
||||
pw.println(" entrues):");
|
||||
pw.println(" entries):");
|
||||
printedHeader = true;
|
||||
}
|
||||
pw.print(prefix);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class SyncManager {
|
||||
private static final long MAX_TIME_PER_SYNC;
|
||||
|
||||
static {
|
||||
final boolean isLargeRAM = ActivityManager.isLargeRAM();
|
||||
final boolean isLargeRAM = !ActivityManager.isLowRamDeviceStatic();
|
||||
int defaultMaxInitSyncs = isLargeRAM ? 5 : 2;
|
||||
int defaultMaxRegularSyncs = isLargeRAM ? 2 : 1;
|
||||
MAX_SIMULTANEOUS_INITIALIZATION_SYNCS =
|
||||
|
||||
Reference in New Issue
Block a user