Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49e9c44c authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Add new ActivityManager.isLowRamDevice()."

parents 89dc02a9 b4e12494
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);
+20 −38
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import android.R;
import android.os.BatteryStats;
import android.os.IBinder;
import com.android.internal.app.IUsageStats;
@@ -379,49 +380,30 @@ public class ActivityManager {
    }

    /**
     * Used by persistent processes to determine if they are running on a
     * higher-end device so should be okay using hardware drawing acceleration
     * (which tends to consume a lot more RAM).
     * @hide
     * 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.
     */
    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;
    public boolean isLowRamDevice() {
        return isLowRamDeviceStatic();
    }
        return false;

    /** @hide */
    public static boolean isLowRamDeviceStatic() {
        return Resources.getSystem().getBoolean(com.android.internal.R.bool.config_lowRamDevice);
    }

    /**
     * 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.
     * Used by persistent processes to determine if they are running on a
     * higher-end device so should be okay using hardware drawing acceleration
     * (which tends to consume a lot more RAM).
     * @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;
    static public boolean isHighEndGfx() {
        return !isLowRamDeviceStatic() &&
                !Resources.getSystem().getBoolean(com.android.internal.R.bool.config_avoidGfxAccel);
    }

    /**
+11 −0
Original line number Diff line number Diff line
@@ -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>
+2 −0
Original line number Diff line number Diff line
@@ -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" />
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading