Merge branch 'eclair-plus-aosp' of ssh://android-git.corp.google.com:29418/platform/frameworks/base into eclair-mr2-plus-aosp

This commit is contained in:
James Dong
2009-10-08 19:18:48 -07:00
committed by Android Git Automerger
7 changed files with 57 additions and 19 deletions

View File

@@ -17299,6 +17299,17 @@
visibility="public"
>
</method>
<method name="getMemoryClass"
return="int"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="getMemoryInfo"
return="void"
abstract="false"

View File

@@ -27,6 +27,7 @@ import android.os.RemoteException;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemProperties;
import android.text.TextUtils;
import java.util.List;
@@ -46,6 +47,26 @@ public class ActivityManager {
mHandler = handler;
}
/**
* Return the approximate per-application memory class of the current
* device. This gives you an idea of how hard a memory limit you should
* impose on your application to let the overall system work best. The
* returned value is in megabytes; the baseline Android memory class is
* 16 (which happens to be the Java heap limit of those devices); some
* device with more memory may return 24 or even higher numbers.
*/
public int getMemoryClass() {
return staticGetMemoryClass();
}
/** @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.heapsize", "16m");
return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length()-1));
}
/**
* Information you can retrieve about tasks that the user has most recently
* started or visited.

View File

@@ -106,8 +106,8 @@ public class RotarySelector extends View {
// Vibration (haptic feedback)
private Vibrator mVibrator;
private static final long VIBRATE_SHORT = 30; // msec
private static final long VIBRATE_LONG = 60; // msec
private static final long VIBRATE_SHORT = 20; // msec
private static final long VIBRATE_LONG = 20; // msec
/**
* The drawable for the arrows need to be scrunched this many dips towards the rotary bg below

View File

@@ -19,5 +19,5 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/accelerate_interpolator">
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
android:duration="@android:integer/config_longAnimTime" />
</set>

View File

@@ -19,5 +19,5 @@
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@anim/accelerate_interpolator">
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@android:integer/config_mediumAnimTime" />
android:duration="@android:integer/config_longAnimTime" />
</set>

View File

@@ -35,10 +35,10 @@
<integer name="config_shortAnimTime">150</integer>
<!-- The duration (in milliseconds) of a medium-length animation. -->
<integer name="config_mediumAnimTime">200</integer>
<integer name="config_mediumAnimTime">300</integer>
<!-- The duration (in milliseconds) of a long animation. -->
<integer name="config_longAnimTime">350</integer>
<integer name="config_longAnimTime">400</integer>
<!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
Please don't copy them, copy anything else. -->

View File

@@ -1436,6 +1436,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
mSimpleProcessManagement = true;
}
Log.i(TAG, "Memory class: " + ActivityManager.staticGetMemoryClass());
MY_PID = Process.myPid();
File dataDir = Environment.getDataDirectory();
@@ -4556,7 +4558,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
long now = SystemClock.uptimeMillis();
for (i=0; i<count; i++) {
ProcessRecord rec = mLRUProcesses.get(i);
if (rec.thread != null &&
if (rec != app && rec.thread != null &&
(rec.lastLowMemory+GC_MIN_INTERVAL) <= now) {
// The low memory report is overriding any current
// state for a GC request. Make sure to do
@@ -9853,6 +9855,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
mLRUProcesses.remove(index);
}
mProcessesToGc.remove(app);
// Dismiss any open dialogs.
if (app.crashDialog != null) {
app.crashDialog.dismiss();
@@ -10520,7 +10524,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
//Log.i(TAG, "Bring up service:");
//r.dump(" ");
if (r.app != null) {
if (r.app != null && r.app.thread != null) {
sendServiceArgsLocked(r, false);
return true;
}
@@ -10551,20 +10555,22 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// restart the application.
}
// Not running -- get it started, and enqueue this service record
// to be executed when the app comes up.
if (startProcessLocked(appName, r.appInfo, true, intentFlags,
"service", r.name, false) == null) {
Log.w(TAG, "Unable to launch app "
+ r.appInfo.packageName + "/"
+ r.appInfo.uid + " for service "
+ r.intent.getIntent() + ": process is bad");
bringDownServiceLocked(r, true);
return false;
}
if (!mPendingServices.contains(r)) {
// Not running -- get it started, and enqueue this service record
// to be executed when the app comes up.
if (startProcessLocked(appName, r.appInfo, true, intentFlags,
"service", r.name, false) == null) {
Log.w(TAG, "Unable to launch app "
+ r.appInfo.packageName + "/"
+ r.appInfo.uid + " for service "
+ r.intent.getIntent() + ": process is bad");
bringDownServiceLocked(r, true);
return false;
}
mPendingServices.add(r);
}
return true;
}