Merge change 24098 into eclair
* changes:
Fix bug where we wouldn't release remote provider references.
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 6a00e3e..c211b47 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -333,10 +333,18 @@
static void dump_kernel_log(const char *path, const char *title)
{
- printf("------ KERNEL %s LOG ------\n", title);
- if (access(path, R_OK) < 0)
- printf("%s: %s\n", path, strerror(errno));
- else
- DUMP(path);
+ printf("------ KERNEL %s LOG ------\n", title);
+ if (access(path, R_OK) < 0)
+ printf("%s: %s\n", path, strerror(errno));
+ else {
+ struct stat sbuf;
+
+ if (stat(path, &sbuf) < 0)
+ printf("%s: stat failed (%s)\n", path, strerror(errno));
+ else
+ printf("Harvested %s", ctime(&sbuf.st_ctime));
+
+ DUMP(path);
+ }
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 8a26aba..2877aec 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -68,6 +68,7 @@
import com.android.internal.os.BinderInternal;
import com.android.internal.os.RuntimeInit;
+import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.util.ArrayUtils;
import org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl;
@@ -87,6 +88,8 @@
import java.util.TimeZone;
import java.util.regex.Pattern;
+import dalvik.system.SamplingProfiler;
+
final class IntentReceiverLeaked extends AndroidRuntimeException {
public IntentReceiverLeaked(String msg) {
super(msg);
@@ -126,7 +129,7 @@
private static final int LOG_ON_PAUSE_CALLED = 30021;
private static final int LOG_ON_RESUME_CALLED = 30022;
-
+
public static final ActivityThread currentActivityThread() {
return (ActivityThread)sThreadLocal.get();
}
@@ -314,7 +317,7 @@
public ApplicationInfo getApplicationInfo() {
return mApplicationInfo;
}
-
+
public boolean isSecurityViolation() {
return mSecurityViolation;
}
@@ -322,7 +325,7 @@
/**
* Gets the array of shared libraries that are listed as
* used by the given package.
- *
+ *
* @param packageName the name of the package (note: not its
* file name)
* @return null-ok; the array of shared libraries, each one
@@ -350,7 +353,7 @@
* result is a single string with the names of the libraries
* separated by colons, or <code>null</code> if both lists
* were <code>null</code> or empty.
- *
+ *
* @param list1 null-ok; the first list
* @param list2 null-ok; the second list
* @return null-ok; the combination
@@ -378,7 +381,7 @@
if (dupCheck && ArrayUtils.contains(list1, s)) {
continue;
}
-
+
if (first) {
first = false;
} else {
@@ -390,7 +393,7 @@
return result.toString();
}
-
+
public ClassLoader getClassLoader() {
synchronized (this) {
if (mClassLoader != null) {
@@ -428,7 +431,7 @@
if ((mSharedLibraries != null) ||
(instrumentationLibs != null)) {
- zip =
+ zip =
combineLibs(mSharedLibraries, instrumentationLibs)
+ ':' + zip;
}
@@ -485,9 +488,9 @@
if (mApplication != null) {
return mApplication;
}
-
+
Application app = null;
-
+
String appClass = mApplicationInfo.className;
if (forceDefaultAppClass || (appClass == null)) {
appClass = "android.app.Application";
@@ -510,7 +513,7 @@
mActivityThread.mAllApplications.add(app);
return mApplication = app;
}
-
+
public void removeContextRegistrations(Context context,
String who, String what) {
HashMap<BroadcastReceiver, ReceiverDispatcher> rmap =
@@ -643,7 +646,7 @@
final static class InnerReceiver extends IIntentReceiver.Stub {
final WeakReference<ReceiverDispatcher> mDispatcher;
final ReceiverDispatcher mStrongRef;
-
+
InnerReceiver(ReceiverDispatcher rd, boolean strong) {
mDispatcher = new WeakReference<ReceiverDispatcher>(rd);
mStrongRef = strong ? rd : null;
@@ -661,7 +664,7 @@
}
}
}
-
+
final IIntentReceiver.Stub mIIntentReceiver;
final BroadcastReceiver mReceiver;
final Context mContext;
@@ -770,7 +773,7 @@
BroadcastReceiver getIntentReceiver() {
return mReceiver;
}
-
+
IIntentReceiver getIIntentReceiver() {
return mIIntentReceiver;
}
@@ -901,7 +904,7 @@
private static class InnerConnection extends IServiceConnection.Stub {
final WeakReference<ServiceDispatcher> mDispatcher;
-
+
InnerConnection(ServiceDispatcher sd) {
mDispatcher = new WeakReference<ServiceDispatcher>(sd);
}
@@ -913,7 +916,7 @@
}
}
}
-
+
private final HashMap<ComponentName, ConnectionInfo> mActiveConnections
= new HashMap<ComponentName, ConnectionInfo>();
@@ -965,7 +968,7 @@
IServiceConnection getIServiceConnection() {
return mIServiceConnection;
}
-
+
int getFlags() {
return mFlags;
}
@@ -1191,7 +1194,7 @@
+ " mode=" + backupMode + "}";
}
}
-
+
private static final class CreateServiceData {
IBinder token;
ServiceInfo info;
@@ -1271,10 +1274,10 @@
private static final String HEAP_COLUMN = "%17s %8s %8s %8s %8s";
private static final String ONE_COUNT_COLUMN = "%17s %8d";
private static final String TWO_COUNT_COLUMNS = "%17s %8d %17s %8d";
-
+
// Formatting for checkin service - update version if row format changes
private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 1;
-
+
public final void schedulePauseActivity(IBinder token, boolean finished,
boolean userLeaving, int configChanges) {
queueOrSendMessage(
@@ -1343,7 +1346,7 @@
synchronized (mRelaunchingActivities) {
mRelaunchingActivities.add(r);
}
-
+
queueOrSendMessage(H.RELAUNCH_ACTIVITY, r, configChanges);
}
@@ -1514,7 +1517,7 @@
throws RemoteException {
receiver.performReceive(intent, resultCode, dataStr, extras, ordered);
}
-
+
public void scheduleLowMemory() {
queueOrSendMessage(H.LOW_MEMORY, null);
}
@@ -1530,7 +1533,7 @@
} catch (RemoteException e) {
}
}
-
+
public void profilerControl(boolean start, String path, ParcelFileDescriptor fd) {
ProfilerControlData pcd = new ProfilerControlData();
pcd.path = path;
@@ -1549,11 +1552,11 @@
Log.w(TAG, "Failed setting process group to " + group, e);
}
}
-
+
public void getMemoryInfo(Debug.MemoryInfo outInfo) {
Debug.getMemoryInfo(outInfo);
}
-
+
@Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
long nativeMax = Debug.getNativeHeapSize() / 1024;
@@ -1589,7 +1592,7 @@
long sqliteAllocated = SQLiteDebug.getHeapAllocatedSize() / 1024;
SQLiteDebug.PagerStats stats = new SQLiteDebug.PagerStats();
SQLiteDebug.getPagerStats(stats);
-
+
// Check to see if we were called by checkin server. If so, print terse format.
boolean doCheckinFormat = false;
if (args != null) {
@@ -1597,79 +1600,79 @@
if ("-c".equals(arg)) doCheckinFormat = true;
}
}
-
+
// For checkin, we print one long comma-separated list of values
if (doCheckinFormat) {
// NOTE: if you change anything significant below, also consider changing
// ACTIVITY_THREAD_CHECKIN_VERSION.
- String processName = (mBoundApplication != null)
+ String processName = (mBoundApplication != null)
? mBoundApplication.processName : "unknown";
-
+
// Header
pw.print(ACTIVITY_THREAD_CHECKIN_VERSION); pw.print(',');
pw.print(Process.myPid()); pw.print(',');
pw.print(processName); pw.print(',');
-
+
// Heap info - max
pw.print(nativeMax); pw.print(',');
pw.print(dalvikMax); pw.print(',');
pw.print("N/A,");
pw.print(nativeMax + dalvikMax); pw.print(',');
-
+
// Heap info - allocated
pw.print(nativeAllocated); pw.print(',');
pw.print(dalvikAllocated); pw.print(',');
pw.print("N/A,");
pw.print(nativeAllocated + dalvikAllocated); pw.print(',');
-
+
// Heap info - free
pw.print(nativeFree); pw.print(',');
pw.print(dalvikFree); pw.print(',');
pw.print("N/A,");
pw.print(nativeFree + dalvikFree); pw.print(',');
-
+
// Heap info - proportional set size
pw.print(memInfo.nativePss); pw.print(',');
pw.print(memInfo.dalvikPss); pw.print(',');
pw.print(memInfo.otherPss); pw.print(',');
pw.print(memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss); pw.print(',');
-
+
// Heap info - shared
- pw.print(nativeShared); pw.print(',');
- pw.print(dalvikShared); pw.print(',');
- pw.print(otherShared); pw.print(',');
+ pw.print(nativeShared); pw.print(',');
+ pw.print(dalvikShared); pw.print(',');
+ pw.print(otherShared); pw.print(',');
pw.print(nativeShared + dalvikShared + otherShared); pw.print(',');
-
+
// Heap info - private
- pw.print(nativePrivate); pw.print(',');
+ pw.print(nativePrivate); pw.print(',');
pw.print(dalvikPrivate); pw.print(',');
pw.print(otherPrivate); pw.print(',');
pw.print(nativePrivate + dalvikPrivate + otherPrivate); pw.print(',');
-
+
// Object counts
pw.print(viewInstanceCount); pw.print(',');
pw.print(viewRootInstanceCount); pw.print(',');
pw.print(appContextInstanceCount); pw.print(',');
pw.print(activityInstanceCount); pw.print(',');
-
+
pw.print(globalAssetCount); pw.print(',');
pw.print(globalAssetManagerCount); pw.print(',');
pw.print(binderLocalObjectCount); pw.print(',');
pw.print(binderProxyObjectCount); pw.print(',');
-
+
pw.print(binderDeathObjectCount); pw.print(',');
pw.print(openSslSocketCount); pw.print(',');
-
+
// SQL
pw.print(sqliteAllocated); pw.print(',');
- pw.print(stats.databaseBytes / 1024); pw.print(',');
+ pw.print(stats.databaseBytes / 1024); pw.print(',');
pw.print(stats.numPagers); pw.print(',');
pw.print((stats.totalBytes - stats.referencedBytes) / 1024); pw.print(',');
pw.print(stats.referencedBytes / 1024); pw.print('\n');
-
+
return;
}
-
+
// otherwise, show human-readable format
printRow(pw, HEAP_COLUMN, "", "native", "dalvik", "other", "total");
printRow(pw, HEAP_COLUMN, "size:", nativeMax, dalvikMax, "N/A", nativeMax + dalvikMax);
@@ -1702,7 +1705,7 @@
printRow(pw, ONE_COUNT_COLUMN, "Death Recipients:", binderDeathObjectCount);
printRow(pw, ONE_COUNT_COLUMN, "OpenSSL Sockets:", openSslSocketCount);
-
+
// SQLite mem info
pw.println(" ");
pw.println(" SQL");
@@ -1711,7 +1714,7 @@
printRow(pw, TWO_COUNT_COLUMNS, "numPagers:", stats.numPagers, "inactivePageKB:",
(stats.totalBytes - stats.referencedBytes) / 1024);
printRow(pw, ONE_COUNT_COLUMN, "activePageKB:", stats.referencedBytes / 1024);
-
+
// Asset details.
String assetAlloc = AssetManager.getAssetAllocations();
if (assetAlloc != null) {
@@ -1727,6 +1730,10 @@
}
private final class H extends Handler {
+ private H() {
+ SamplingProfiler.getInstance().setEventThread(mLooper.getThread());
+ }
+
public static final int LAUNCH_ACTIVITY = 100;
public static final int PAUSE_ACTIVITY = 101;
public static final int PAUSE_ACTIVITY_FINISHING= 102;
@@ -1811,6 +1818,7 @@
} break;
case PAUSE_ACTIVITY:
handlePauseActivity((IBinder)msg.obj, false, msg.arg1 != 0, msg.arg2);
+ maybeSnapshot();
break;
case PAUSE_ACTIVITY_FINISHING:
handlePauseActivity((IBinder)msg.obj, true, msg.arg1 != 0, msg.arg2);
@@ -1853,6 +1861,7 @@
break;
case RECEIVER:
handleReceiver((ReceiverData)msg.obj);
+ maybeSnapshot();
break;
case CREATE_SERVICE:
handleCreateService((CreateServiceData)msg.obj);
@@ -1868,6 +1877,7 @@
break;
case STOP_SERVICE:
handleStopService((IBinder)msg.obj);
+ maybeSnapshot();
break;
case REQUEST_THUMBNAIL:
handleRequestThumbnail((IBinder)msg.obj);
@@ -1907,6 +1917,13 @@
break;
}
}
+
+ void maybeSnapshot() {
+ if (mBoundApplication != null) {
+ SamplingProfilerIntegration.writeSnapshot(
+ mBoundApplication.processName);
+ }
+ }
}
private final class Idler implements MessageQueue.IdleHandler {
@@ -1947,13 +1964,13 @@
final private String mResDir;
final private float mScale;
final private int mHash;
-
+
ResourcesKey(String resDir, float scale) {
mResDir = resDir;
mScale = scale;
mHash = mResDir.hashCode() << 2 + (int) (mScale * 2);
}
-
+
@Override
public int hashCode() {
return mHash;
@@ -2004,7 +2021,7 @@
final ArrayList<ActivityRecord> mRelaunchingActivities
= new ArrayList<ActivityRecord>();
Configuration mPendingConfiguration = null;
-
+
// These can be accessed by multiple threads; mPackages is the lock.
// XXX For now we keep around information about all packages we have
// seen, not removing entries from this map.
@@ -2139,7 +2156,7 @@
return false;
}
}
-
+
ActivityThread() {
}
@@ -2172,11 +2189,11 @@
public Application getApplication() {
return mInitialApplication;
}
-
+
public String getProcessName() {
return mBoundApplication.processName;
}
-
+
public ApplicationContext getSystemContext() {
synchronized (this) {
if (mSystemContext == null) {
@@ -2231,7 +2248,7 @@
}
return aInfo;
}
-
+
public final Activity startActivityNow(Activity parent, String id,
Intent intent, ActivityInfo activityInfo, IBinder token, Bundle state,
Object lastNonConfigurationInstance) {
@@ -2314,7 +2331,7 @@
r.packageInfo = getPackageInfo(aInfo.applicationInfo,
Context.CONTEXT_INCLUDE_CODE);
}
-
+
ComponentName component = r.intent.getComponent();
if (component == null) {
component = r.intent.resolveActivity(
@@ -2346,7 +2363,7 @@
try {
Application app = r.packageInfo.makeApplication(false);
-
+
if (localLOGV) Log.v(TAG, "Performing launch of " + r);
if (localLOGV) Log.v(
TAG, r + ": app=" + app
@@ -2365,7 +2382,7 @@
r.ident, app, r.intent, r.activityInfo, title, r.parent,
r.embeddedID, r.lastNonConfigurationInstance,
r.lastNonConfigurationChildInstances, config);
-
+
if (customIntent != null) {
activity.mIntent = customIntent;
}
@@ -2503,7 +2520,7 @@
}
}
}
-
+
private final void handleNewIntent(NewIntentData data) {
performNewIntents(data.token, data.intents);
}
@@ -2541,7 +2558,7 @@
try {
Application app = packageInfo.makeApplication(false);
-
+
if (localLOGV) Log.v(
TAG, "Performing receive of " + data.intent
+ ": app=" + app
@@ -2598,7 +2615,7 @@
+ " already exists");
return;
}
-
+
BackupAgent agent = null;
String classname = data.appInfo.backupAgentName;
if (classname == null) {
@@ -2652,7 +2669,7 @@
// Tear down a BackupAgent
private final void handleDestroyBackupAgent(CreateBackupAgentData data) {
if (DEBUG_BACKUP) Log.v(TAG, "handleDestroyBackupAgent: " + data);
-
+
PackageInfo packageInfo = getPackageInfoNoCheck(data.appInfo);
String packageName = packageInfo.mPackageName;
BackupAgent agent = mBackupAgents.get(packageName);
@@ -2857,9 +2874,9 @@
}
r.activity.performResume();
- EventLog.writeEvent(LOG_ON_RESUME_CALLED,
+ EventLog.writeEvent(LOG_ON_RESUME_CALLED,
r.activity.getComponentName().getClassName());
-
+
r.paused = false;
r.stopped = false;
if (r.activity.mStartedActivity) {
@@ -2895,7 +2912,7 @@
final int forwardBit = isForward ?
WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0;
-
+
// If the window hasn't yet been added to the window manager,
// and this guy didn't finish itself or start another activity,
// then go ahead and add the window.
@@ -3014,7 +3031,7 @@
if (userLeaving) {
performUserLeavingActivity(r);
}
-
+
r.activity.mConfigChangeFlags |= configChanges;
Bundle state = performPauseActivity(token, finished, true);
@@ -3191,7 +3208,7 @@
+ " win=" + r.window);
updateVisibility(r, show);
-
+
// Tell activity manager we have been stopped.
try {
ActivityManagerNative.getDefault().activityStopped(
@@ -3307,7 +3324,7 @@
try {
r.activity.mCalled = false;
mInstrumentation.callActivityOnPause(r.activity);
- EventLog.writeEvent(LOG_ON_PAUSE_CALLED,
+ EventLog.writeEvent(LOG_ON_PAUSE_CALLED,
r.activity.getComponentName().getClassName());
if (!r.activity.mCalled) {
throw new SuperNotCalledException(
@@ -3364,7 +3381,7 @@
+ ": " + e.toString(), e);
}
}
-
+
}
try {
r.activity.mCalled = false;
@@ -3446,7 +3463,7 @@
unscheduleGcIdler();
Configuration changedConfig = null;
-
+
// First: make sure we have the most recent configuration and most
// recent version of the activity, or skip it if some previous call
// had taken a more recent version.
@@ -3463,38 +3480,38 @@
N--;
}
}
-
+
if (tmp == null) {
return;
}
-
+
if (mPendingConfiguration != null) {
changedConfig = mPendingConfiguration;
mPendingConfiguration = null;
}
}
-
+
// If there was a pending configuration change, execute it first.
if (changedConfig != null) {
handleConfigurationChanged(changedConfig);
}
-
+
ActivityRecord r = mActivities.get(tmp.token);
if (localLOGV) Log.v(TAG, "Handling relaunch of " + r);
if (r == null) {
return;
}
-
+
r.activity.mConfigChangeFlags |= configChanges;
Intent currentIntent = r.activity.mIntent;
-
+
Bundle savedState = null;
if (!r.paused) {
savedState = performPauseActivity(r.token, false, true);
}
-
+
handleDestroyActivity(r.token, false, configChanges, true);
-
+
r.activity = null;
r.window = null;
r.hideForNow = false;
@@ -3518,7 +3535,7 @@
if (savedState != null) {
r.state = savedState;
}
-
+
handleLaunchActivity(r, currentIntent);
}
@@ -3548,7 +3565,7 @@
boolean allActivities, Configuration newConfig) {
ArrayList<ComponentCallbacks> callbacks
= new ArrayList<ComponentCallbacks>();
-
+
if (mActivities.size() > 0) {
Iterator<ActivityRecord> it = mActivities.values().iterator();
while (it.hasNext()) {
@@ -3589,10 +3606,10 @@
for (int i=0; i<N; i++) {
callbacks.add(mAllApplications.get(i));
}
-
+
return callbacks;
}
-
+
private final void performConfigurationChanged(
ComponentCallbacks cb, Configuration config) {
// Only for Activity objects, check that they actually call up to their
@@ -3602,18 +3619,18 @@
if (activity != null) {
activity.mCalled = false;
}
-
+
boolean shouldChangeConfig = false;
if ((activity == null) || (activity.mCurrentConfig == null)) {
shouldChangeConfig = true;
} else {
-
+
// If the new config is the same as the config this Activity
// is already running with then don't bother calling
// onConfigurationChanged
int diff = activity.mCurrentConfig.diff(config);
if (diff != 0) {
-
+
// If this activity doesn't handle any of the config changes
// then don't bother calling onConfigurationChanged as we're
// going to destroy it.
@@ -3622,10 +3639,10 @@
}
}
}
-
+
if (shouldChangeConfig) {
cb.onConfigurationChanged(config);
-
+
if (activity != null) {
if (!activity.mCalled) {
throw new SuperNotCalledException(
@@ -3639,17 +3656,17 @@
}
final void handleConfigurationChanged(Configuration config) {
-
+
synchronized (mRelaunchingActivities) {
if (mPendingConfiguration != null) {
config = mPendingConfiguration;
mPendingConfiguration = null;
}
}
-
+
ArrayList<ComponentCallbacks> callbacks
= new ArrayList<ComponentCallbacks>();
-
+
synchronized(mPackages) {
if (mConfiguration == null) {
mConfiguration = new Configuration();
@@ -3684,10 +3701,10 @@
}
}
}
-
+
callbacks = collectComponentCallbacksLocked(false, config);
}
-
+
final int N = callbacks.size();
for (int i=0; i<N; i++) {
performConfigurationChanged(callbacks.get(i), config);
@@ -3699,7 +3716,7 @@
if (r == null || r.activity == null) {
return;
}
-
+
performConfigurationChanged(r.activity, mConfiguration);
}
@@ -3722,7 +3739,7 @@
Debug.stopMethodTracing();
}
}
-
+
final void handleLowMemory() {
ArrayList<ComponentCallbacks> callbacks
= new ArrayList<ComponentCallbacks>();
@@ -3730,7 +3747,7 @@
synchronized(mPackages) {
callbacks = collectComponentCallbacksLocked(true, null);
}
-
+
final int N = callbacks.size();
for (int i=0; i<N; i++) {
callbacks.get(i).onLowMemory();
@@ -3741,7 +3758,7 @@
int sqliteReleased = SQLiteDatabase.releaseMemory();
EventLog.writeEvent(SQLITE_MEM_RELEASED_EVENT_LOG_TAG, sqliteReleased);
}
-
+
// Ask graphics to free up as much as possible (font/image caches)
Canvas.freeCaches();
@@ -3788,7 +3805,7 @@
== 0) {
Bitmap.setDefaultDensity(DisplayMetrics.DENSITY_DEFAULT);
}
-
+
if (data.debugMode != IApplicationThread.DEBUG_OFF) {
// XXX should have option to change the port.
Debug.changeDebugPort(8100);
@@ -4213,6 +4230,8 @@
}
public static final void main(String[] args) {
+ SamplingProfilerIntegration.start();
+
Process.setArgV0("<pre-initialized>");
Looper.prepareMainLooper();
@@ -4228,8 +4247,11 @@
thread.detach();
String name;
- if (thread.mInitialApplication != null) name = thread.mInitialApplication.getPackageName();
- else name = "<unknown>";
+ if (thread.mInitialApplication != null) {
+ name = thread.mInitialApplication.getPackageName();
+ } else {
+ name = "<unknown>";
+ }
Log.i(TAG, "Main thread of " + name + " is now exiting");
}
}
diff --git a/core/java/android/preference/PreferenceManager.java b/core/java/android/preference/PreferenceManager.java
index a7a3eef..fe3471d 100644
--- a/core/java/android/preference/PreferenceManager.java
+++ b/core/java/android/preference/PreferenceManager.java
@@ -134,7 +134,10 @@
private OnPreferenceTreeClickListener mOnPreferenceTreeClickListener;
- PreferenceManager(Activity activity, int firstRequestCode) {
+ /**
+ * @hide
+ */
+ public PreferenceManager(Activity activity, int firstRequestCode) {
mActivity = activity;
mNextRequestCode = firstRequestCode;
@@ -240,8 +243,9 @@
* hierarchies into.
* @return The root hierarchy (if one was not provided, the new hierarchy's
* root).
+ * @hide
*/
- PreferenceScreen inflateFromResource(Context context, int resId,
+ public PreferenceScreen inflateFromResource(Context context, int resId,
PreferenceScreen rootPreferences) {
// Block commits
setNoCommit(true);
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index a175c37..6e3b282 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -1594,7 +1594,7 @@
"vnd.android.cursor.item/aggregation_exception";
/**
- * The type of exception: {@link #TYPE_KEEP_IN}, {@link #TYPE_KEEP_OUT} or
+ * The type of exception: {@link #TYPE_KEEP_TOGETHER}, {@link #TYPE_KEEP_SEPARATE} or
* {@link #TYPE_AUTOMATIC}.
*
* <P>Type: INTEGER</P>
@@ -1602,33 +1602,45 @@
public static final String TYPE = "type";
/**
- * Allows the provider to automatically decide whether the aggregate
- * contact should include a particular raw contact or not.
+ * Allows the provider to automatically decide whether the specified raw contacts should
+ * be included in the same aggregate contact or not.
*/
public static final int TYPE_AUTOMATIC = 0;
/**
- * Makes sure that the specified raw contact is included in the
- * specified aggregate contact.
+ * Makes sure that the specified raw contacts are included in the same
+ * aggregate contact.
*/
+ public static final int TYPE_KEEP_TOGETHER = 1;
+
+ @Deprecated
public static final int TYPE_KEEP_IN = 1;
/**
- * Makes sure that the specified raw contact is NOT included in the
- * specified aggregate contact.
+ * Makes sure that the specified raw contacts are NOT included in the same
+ * aggregate contact.
*/
+ public static final int TYPE_KEEP_SEPARATE = 2;
+
+ @Deprecated
public static final int TYPE_KEEP_OUT = 2;
- /**
- * A reference to the {@link android.provider.ContactsContract.Contacts#_ID} of the
- * aggregate contact that the rule applies to.
- */
+ @Deprecated
public static final String CONTACT_ID = "contact_id";
+ @Deprecated
+ public static final String RAW_CONTACT_ID = "raw_contact_id";
+
/**
* A reference to the {@link RawContacts#_ID} of the raw contact that the rule applies to.
*/
- public static final String RAW_CONTACT_ID = "raw_contact_id";
+ public static final String RAW_CONTACT_ID1 = "raw_contact_id1";
+
+ /**
+ * A reference to the other {@link RawContacts#_ID} of the raw contact that the rule
+ * applies to.
+ */
+ public static final String RAW_CONTACT_ID2 = "raw_contact_id2";
}
private interface SettingsColumns {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 64e47eb..97955ae 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2984,13 +2984,15 @@
"gtalk_max_conn_history_records";
/**
- * This is gdata url to lookup album and picture info from picasa web.
+ * This is gdata url to lookup album and picture info from picasa web. It also controls
+ * whether url scraping for picasa is enabled (NULL to disable).
*/
public static final String GTALK_PICASA_ALBUM_URL =
"gtalk_picasa_album_url";
/**
- * This is the url to lookup picture info from flickr.
+ * This is the url to lookup picture info from flickr. It also controls
+ * whether url scraping for flickr is enabled (NULL to disable).
*/
public static final String GTALK_FLICKR_PHOTO_INFO_URL =
"gtalk_flickr_photo_info_url";
@@ -3002,12 +3004,19 @@
"gtalk_flickr_photo_url";
/**
- * This is the gdata url to lookup info on a youtube video.
+ * This is the gdata url to lookup info on a youtube video. It also controls
+ * whether url scraping for youtube is enabled (NULL to disable).
*/
public static final String GTALK_YOUTUBE_VIDEO_URL =
"gtalk_youtube_video_url";
/**
+ * Enable/disable GTalk URL scraping for JPG images ("true" to enable).
+ */
+ public static final String GTALK_URL_SCRAPING_FOR_JPG =
+ "gtalk_url_scraping_for_jpg";
+
+ /**
* Chat message lifetime (for pruning old chat messages).
*/
public static final String GTALK_CHAT_MESSAGE_LIFETIME =
@@ -3476,6 +3485,93 @@
"google_calendar_sync_window_update_days";
/**
+ * The number of promoted sources in GlobalSearch.
+ */
+ public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
+ /**
+ * The maximum number of suggestions returned by GlobalSearch.
+ */
+ public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
+ /**
+ * The number of suggestions GlobalSearch will ask each non-web search source for.
+ */
+ public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
+ /**
+ * The number of suggestions the GlobalSearch will ask the web search source for.
+ */
+ public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
+ "search_web_results_override_limit";
+ /**
+ * The number of milliseconds that GlobalSearch will wait for suggestions from
+ * promoted sources before continuing with all other sources.
+ */
+ public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
+ "search_promoted_source_deadline_millis";
+ /**
+ * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
+ */
+ public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
+ /**
+ * The maximum number of milliseconds that GlobalSearch shows the previous results
+ * after receiving a new query.
+ */
+ public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
+ /**
+ * The maximum age of log data used for shortcuts in GlobalSearch.
+ */
+ public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
+ /**
+ * The maximum age of log data used for source ranking in GlobalSearch.
+ */
+ public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
+ "search_max_source_event_age_millis";
+ /**
+ * The minimum number of impressions needed to rank a source in GlobalSearch.
+ */
+ public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
+ "search_min_impressions_for_source_ranking";
+ /**
+ * The minimum number of clicks needed to rank a source in GlobalSearch.
+ */
+ public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
+ "search_min_clicks_for_source_ranking";
+ /**
+ * The maximum number of shortcuts shown by GlobalSearch.
+ */
+ public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
+ /**
+ * The size of the core thread pool for suggestion queries in GlobalSearch.
+ */
+ public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
+ "search_query_thread_core_pool_size";
+ /**
+ * The maximum size of the thread pool for suggestion queries in GlobalSearch.
+ */
+ public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
+ "search_query_thread_max_pool_size";
+ /**
+ * The size of the core thread pool for shortcut refreshing in GlobalSearch.
+ */
+ public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
+ "search_shortcut_refresh_core_pool_size";
+ /**
+ * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
+ */
+ public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
+ "search_shortcut_refresh_max_pool_size";
+ /**
+ * The maximun time that excess threads in the GlobalSeach thread pools will
+ * wait before terminating.
+ */
+ public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
+ "search_thread_keepalive_seconds";
+ /**
+ * The maximum number of concurrent suggestion queries to each source.
+ */
+ public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
+ "search_per_source_concurrent_query_limit";
+
+ /**
* @deprecated
* @hide
*/
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index 8486272..4e6f9ca 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -83,7 +83,7 @@
Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler());
int hasQwerty = getQwertyKeyboard();
-
+
if (Config.LOGV) Log.d(TAG, ">>>>> qwerty keyboard = " + hasQwerty);
if (hasQwerty == 1) {
System.setProperty("qwerty", "1");
@@ -133,13 +133,13 @@
* @param className Fully-qualified class name
* @param argv Argument vector for main()
*/
- private static void invokeStaticMain(String className, String[] argv)
+ private static void invokeStaticMain(String className, String[] argv)
throws ZygoteInit.MethodAndArgsCaller {
-
+
// We want to be fairly aggressive about heap utilization, to avoid
// holding on to a lot of memory that isn't needed.
VMRuntime.getRuntime().setTargetHeapUtilization(0.75f);
-
+
Class<?> cl;
try {
@@ -178,7 +178,7 @@
public static final void main(String[] argv) {
commonInit();
-
+
/*
* Now that we're running in interpreted code, call back into native code
* to run the system.
@@ -187,7 +187,7 @@
if (Config.LOGV) Log.d(TAG, "Leaving RuntimeInit!");
}
-
+
public static final native void finishInit();
/**
@@ -236,7 +236,7 @@
}
// Remaining arguments are passed to the start class's static main
-
+
String startClass = argv[curArg++];
String[] startArgs = new String[argv.length - curArg];
@@ -245,28 +245,28 @@
}
public static final native void zygoteInitNative();
-
+
/**
* Returns 1 if the computer is on. If the computer isn't on, the value returned by this method is undefined.
*/
public static final native int isComputerOn();
/**
- * Turns the computer on if the computer is off. If the computer is on, the behavior of this method is undefined.
+ * Turns the computer on if the computer is off. If the computer is on, the behavior of this method is undefined.
*/
public static final native void turnComputerOn();
/**
- *
+ *
* @return 1 if the device has a qwerty keyboard
*/
public static native int getQwertyKeyboard();
-
+
/**
* Report a fatal error in the current process. If this is a user-process,
* a dialog may be displayed informing the user of the error. This
* function does not return; it forces the current process to exit.
- *
+ *
* @param tag to use when logging the error
* @param t exception that was generated by the error
*/
@@ -405,7 +405,7 @@
/**
* Replay an encoded CrashData record back into a useable CrashData record. This can be
* helpful for providing debugging output after a process error.
- *
+ *
* @param crashDataBytes The byte array containing the encoded crash record
* @return new CrashData record, or null if could not create one.
*/
diff --git a/core/java/com/android/internal/os/SamplingProfilerIntegration.java b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
new file mode 100644
index 0000000..44bcd16
--- /dev/null
+++ b/core/java/com/android/internal/os/SamplingProfilerIntegration.java
@@ -0,0 +1,144 @@
+package com.android.internal.os;
+
+import dalvik.system.SamplingProfiler;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.FileNotFoundException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import android.util.Log;
+import android.os.*;
+import android.net.Uri;
+
+/**
+ * Integrates the framework with Dalvik's sampling profiler.
+ */
+public class SamplingProfilerIntegration {
+
+ private static final String TAG = "SamplingProfilerIntegration";
+
+ private static final boolean enabled;
+ private static final Executor snapshotWriter;
+ static {
+ enabled = "1".equals(SystemProperties.get("persist.sampling_profiler"));
+ if (enabled) {
+ snapshotWriter = Executors.newSingleThreadExecutor();
+ Log.i(TAG, "Profiler is enabled.");
+ } else {
+ snapshotWriter = null;
+ Log.i(TAG, "Profiler is disabled.");
+ }
+ }
+
+ /**
+ * Is profiling enabled?
+ */
+ public static boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * Starts the profiler if profiling is enabled.
+ */
+ public static void start() {
+ if (!enabled) return;
+ SamplingProfiler.getInstance().start(10);
+ }
+
+ /** Whether or not we've created the snapshots dir. */
+ static boolean dirMade = false;
+
+ /** Whether or not a snapshot is being persisted. */
+ static volatile boolean pending;
+
+ /**
+ * Writes a snapshot to the SD card if profiling is enabled.
+ */
+ public static void writeSnapshot(final String name) {
+ if (!enabled) return;
+
+ if (!pending) {
+ pending = true;
+ snapshotWriter.execute(new Runnable() {
+ public void run() {
+ String dir = "/sdcard/snapshots";
+ if (!dirMade) {
+ makeDirectory(dir);
+ dirMade = true;
+ }
+ try {
+ writeSnapshot(dir, name);
+ } finally {
+ pending = false;
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Writes the zygote's snapshot to internal storage if profiling is enabled.
+ */
+ public static void writeZygoteSnapshot() {
+ if (!enabled) return;
+
+ String dir = "/data/zygote/snapshots";
+ makeDirectory(dir);
+ writeSnapshot(dir, "zygote");
+ }
+
+ private static void writeSnapshot(String dir, String name) {
+ byte[] snapshot = SamplingProfiler.getInstance().snapshot();
+ if (snapshot == null) {
+ return;
+ }
+
+ /*
+ * We use the current time as a unique ID. We can't use a counter
+ * because processes restart. This could result in some overlap if
+ * we capture two snapshots in rapid succession.
+ */
+ long start = System.currentTimeMillis();
+ String path = dir + "/" + name.replace(':', '.') + "-"
+ + System.currentTimeMillis() + ".snapshot";
+ try {
+ // Try to open the file a few times. The SD card may not be mounted.
+ FileOutputStream out;
+ int count = 0;
+ while (true) {
+ try {
+ out = new FileOutputStream(path);
+ break;
+ } catch (FileNotFoundException e) {
+ if (++count > 3) {
+ Log.e(TAG, "Could not open " + path + ".");
+ return;
+ }
+
+ // Sleep for a bit and then try again.
+ try {
+ Thread.sleep(2500);
+ } catch (InterruptedException e1) { /* ignore */ }
+ }
+ }
+
+ try {
+ out.write(snapshot);
+ } finally {
+ out.close();
+ }
+ long elapsed = System.currentTimeMillis() - start;
+ Log.i(TAG, "Wrote snapshot for " + name
+ + " in " + elapsed + "ms.");
+ } catch (IOException e) {
+ Log.e(TAG, "Error writing snapshot.", e);
+ }
+ }
+
+ private static void makeDirectory(String dir) {
+ new File(dir).mkdirs();
+ }
+}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index a2d3cd8..404c513 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -19,7 +19,6 @@
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.net.LocalServerSocket;
import android.os.Debug;
@@ -31,6 +30,7 @@
import dalvik.system.VMRuntime;
import dalvik.system.Zygote;
+import dalvik.system.SamplingProfiler;
import java.io.BufferedReader;
import java.io.FileDescriptor;
@@ -73,7 +73,7 @@
* never gets destroyed.
*/
private static Resources mResources;
-
+
/**
* The number of times that the main Zygote loop
* should run before calling gc() again.
@@ -192,7 +192,7 @@
* RuntimeException on failure.
*/
private static ZygoteConnection acceptCommandPeer() {
- try {
+ try {
return new ZygoteConnection(sServerSocket.accept());
} catch (IOException ex) {
throw new RuntimeException(
@@ -251,7 +251,7 @@
*/
private static void preloadClasses() {
final VMRuntime runtime = VMRuntime.getRuntime();
-
+
InputStream is = ZygoteInit.class.getClassLoader().getResourceAsStream(
PRELOADED_CLASSES);
if (is == null) {
@@ -259,7 +259,7 @@
} else {
Log.i(TAG, "Preloading classes...");
long startTime = SystemClock.uptimeMillis();
-
+
// Drop root perms while running static initializers.
setEffectiveGroup(UNPRIVILEGED_GID);
setEffectiveUser(UNPRIVILEGED_UID);
@@ -275,7 +275,7 @@
Debug.startAllocCounting();
try {
- BufferedReader br
+ BufferedReader br
= new BufferedReader(new InputStreamReader(is), 256);
int count = 0;
@@ -394,7 +394,7 @@
*/
private static void preloadResources() {
final VMRuntime runtime = VMRuntime.getRuntime();
-
+
Debug.startAllocCounting();
try {
runtime.gcSoftReferences();
@@ -527,7 +527,7 @@
/**
* Prepare the arguments and fork for the system server process.
*/
- private static boolean startSystemServer()
+ private static boolean startSystemServer()
throws MethodAndArgsCaller, RuntimeException {
/* Hardcoded command line to start the system server */
String args[] = {
@@ -561,8 +561,8 @@
parsedArgs.gids, debugFlags, null);
} catch (IllegalArgumentException ex) {
throw new RuntimeException(ex);
- }
-
+ }
+
/* For child process */
if (pid == 0) {
handleSystemServerProcess(parsedArgs);
@@ -573,6 +573,9 @@
public static void main(String argv[]) {
try {
+ // Start profiling the zygote initialization.
+ SamplingProfilerIntegration.start();
+
registerZygoteSocket();
EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_START,
SystemClock.uptimeMillis());
@@ -582,6 +585,13 @@
EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
SystemClock.uptimeMillis());
+ if (SamplingProfilerIntegration.isEnabled()) {
+ SamplingProfiler sp = SamplingProfiler.getInstance();
+ sp.pause();
+ SamplingProfilerIntegration.writeZygoteSnapshot();
+ sp.shutDown();
+ }
+
// Do an initial gc to clean up after startup
gc();
diff --git a/docs/html/sdk/1.6_r1/index.jd b/docs/html/sdk/1.6_r1/index.jd
index 11d369b..419649e 100644
--- a/docs/html/sdk/1.6_r1/index.jd
+++ b/docs/html/sdk/1.6_r1/index.jd
@@ -5,21 +5,21 @@
sdk.date=September 2009
sdk.win_download=android-sdk-windows-1.6_r1.zip
-sdk.win_bytes=
-sdk.win_checksum=
+sdk.win_bytes=251325064
+sdk.win_checksum=efd6fccd5a6ff6b57585b49393d221d9
sdk.mac_download=android-sdk-mac_x86-1.6_r1.zip
-sdk.mac_bytes=
-sdk.mac_checksum=
+sdk.mac_bytes=238229779
+sdk.mac_checksum=2be1a1ae5d33272be841c97e8a3a3b1c
sdk.linux_download=android-sdk-linux_x86-1.6_r1.tgz
-sdk.linux_bytes=
-sdk.linux_checksum=
+sdk.linux_bytes=229032773
+sdk.linux_checksum=02ff0d0e38d4f464108a5a7f7567b207
adt.zip_download=ADT-0.9.3.zip
adt.zip_version=0.9.3
-adt.zip_bytes=
-adt.zip_checksum=
+adt.zip_bytes=3252487
+adt.zip_checksum=c296488ac35772667c0f49e822156979
@jd:body
diff --git a/libs/rs/java/Fall/res/raw/fall.c b/libs/rs/java/Fall/res/raw/fall.c
index 346006c..e04e1ff 100644
--- a/libs/rs/java/Fall/res/raw/fall.c
+++ b/libs/rs/java/Fall/res/raw/fall.c
@@ -163,6 +163,7 @@
int* current = loadArrayI32(RSID_RIPPLE_MAP, index * rippleMapSize + origin);
int *map = loadArrayI32(RSID_REFRACTION_MAP, 0);
float *vertices = loadTriangleMeshVerticesF(NAMED_WaterMesh);
+ struct vert_s *vert = (struct vert_s *)vertices;
float fw = 1.f / width;
float fh = 1.f / height;
@@ -173,6 +174,8 @@
int w = width - 1;
int wave = *current;
int offset = h * width;
+ struct vert_s *vtx = vert + offset + w;
+
while (w >= 0) {
int nextWave = current[1];
int dx = nextWave - wave;
@@ -188,12 +191,10 @@
v &= ~(v >> 31);
if (v >= height) v = height - 1;
- int index = (offset + w) << 3;
- vertices[index + 3] = u * fw;
- vertices[index + 4] = v * fh;
-
- // Update Z coordinate of the vertex
- vertices[index + 7] = dy * fy;
+ vtx->s = u * fw;
+ vtx->t = v * fh;
+ vtx->z = dy * fy;
+ vtx --;
w -= 1;
current += 1;
@@ -205,31 +206,28 @@
// Compute the normals for lighting
int y = 0;
- int w8 = width << 3;
for ( ; y < height; y += 1) {
int x = 0;
int yOffset = y * width;
- for ( ; x < width; x += 1) {
- int o = ((yOffset + x) << 3);
- int o1 = o + 8 + 5;
- int ow = o + w8 + 5;
- int ow1 = ow + 8;
+ struct vert_s *v = vert;
+ for ( ; x < width; x += 1) {
struct vec3_s n1, n2, n3;
- vec3Sub(&n1, (struct vec3_s *)(vertices + o1 + 5), (struct vec3_s *)(vertices + o + 5));
- vec3Sub(&n2, (struct vec3_s *)(vertices + ow + 5), (struct vec3_s *)(vertices + o + 5));
+ vec3Sub(&n1, (struct vec3_s *)&(v+1)->x, (struct vec3_s *)&v->x);
+ vec3Sub(&n2, (struct vec3_s *)&(v+width)->x, (struct vec3_s *)&v->x);
vec3Cross(&n3, &n1, &n2);
vec3Norm(&n3);
// Average of previous normal and N1 x N2
- vec3Sub(&n1, (struct vec3_s *)(vertices + ow1 + 5), (struct vec3_s *)(vertices + o + 5));
+ vec3Sub(&n1, (struct vec3_s *)&(v+width+1)->x, (struct vec3_s *)&v->x);
vec3Cross(&n2, &n1, &n2);
vec3Add(&n3, &n3, &n2);
vec3Norm(&n3);
- vertices[o + 0] = n3.x;
- vertices[o + 1] = n3.y;
- vertices[o + 2] = -n3.z;
+ v->nx = n3.x;
+ v->ny = n3.y;
+ v->nz = -n3.z;
+ v += 1;
// reset Z
//vertices[(yOffset + x) << 3 + 7] = 0.0f;
@@ -473,7 +471,7 @@
drawRiverbed();
drawSky();
drawLighting();
- //drawLeaves();
+ drawLeaves();
//drawNormals();
return 1;
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 0adce75..6cf64a4 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -56,6 +56,11 @@
glEnable(GL_TEXTURE_2D);
if (rsc->checkVersion1_1()) {
+ if (mPointSpriteEnable) {
+ glEnable(GL_POINT_SPRITE_OES);
+ } else {
+ glDisable(GL_POINT_SPRITE_OES);
+ }
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, mPointSpriteEnable);
}
glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID());
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 5b19f17..d10076b 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -800,6 +800,12 @@
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, s);
}
+static void SC_pointAttenuation(float a, float b, float c)
+{
+ GLfloat params[] = { a, b, c };
+ glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, params);
+}
+
static void SC_hsbToRgb(float h, float s, float b, float* rgb)
{
float red = 0.0f;
@@ -1185,6 +1191,8 @@
"void", "(float, float, float, float)" },
{ "shininess", (void *)&SC_shininess,
"void", "(float)" },
+ { "pointAttenuation", (void *)&SC_pointAttenuation,
+ "void", "(float, float, float)" },
{ "uploadToTexture", (void *)&SC_uploadToTexture,
"void", "(int, int)" },
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index 9ddf972..ec38fe9 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -398,7 +398,8 @@
glEnable(GL_TEXTURE_2D);
// Dithering...
- if (s.flags & ISurfaceComposer::eLayerDither) {
+ bool fast = !(mFlags & DisplayHardware::SLOW_CONFIG);
+ if (fast || s.flags & ISurfaceComposer::eLayerDither) {
glEnable(GL_DITHER);
} else {
glDisable(GL_DITHER);
diff --git a/libs/surfaceflinger/SurfaceFlinger.cpp b/libs/surfaceflinger/SurfaceFlinger.cpp
index a72294a..c78921a 100644
--- a/libs/surfaceflinger/SurfaceFlinger.cpp
+++ b/libs/surfaceflinger/SurfaceFlinger.cpp
@@ -573,8 +573,10 @@
// do this without lock held
const size_t count = ditchedLayers.size();
for (size_t i=0 ; i<count ; i++) {
- //LOGD("ditching layer %p", ditchedLayers[i].get());
- ditchedLayers[i]->ditch();
+ if (ditchedLayers[i] != 0) {
+ //LOGD("ditching layer %p", ditchedLayers[i].get());
+ ditchedLayers[i]->ditch();
+ }
}
}
@@ -1082,6 +1084,8 @@
status_t SurfaceFlinger::addLayer_l(const sp<LayerBase>& layer)
{
+ if (layer == 0)
+ return BAD_VALUE;
ssize_t i = mCurrentState.layersSortedByZ.add(
layer, &LayerBase::compareCurrentStateZ);
sp<LayerBaseClient> lbc = LayerBase::dynamicCast< LayerBaseClient* >(layer.get());
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 1158a71..7c2a7ac 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -18,6 +18,7 @@
import com.android.server.am.ActivityManagerService;
import com.android.server.status.StatusBarService;
+import com.android.internal.os.SamplingProfilerIntegration;
import dalvik.system.VMRuntime;
@@ -41,6 +42,9 @@
import android.util.Log;
import android.accounts.AccountManagerService;
+import java.util.Timer;
+import java.util.TimerTask;
+
class ServerThread extends Thread {
private static final String TAG = "SystemServer";
private final static boolean INCLUDE_DEMO = false;
@@ -452,6 +456,9 @@
public static final int FACTORY_TEST_LOW_LEVEL = 1;
public static final int FACTORY_TEST_HIGH_LEVEL = 2;
+ static Timer timer;
+ static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr
+
/**
* This method is called from Zygote to initialize the system. This will cause the native
* services (SurfaceFlinger, AudioFlinger, etc..) to be started. After that it will call back
@@ -460,6 +467,17 @@
native public static void init1(String[] args);
public static void main(String[] args) {
+ if (SamplingProfilerIntegration.isEnabled()) {
+ SamplingProfilerIntegration.start();
+ timer = new Timer();
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ SamplingProfilerIntegration.writeSnapshot("system_server");
+ }
+ }, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL);
+ }
+
// The system server has to run all of the time, so it needs to be
// as efficient as possible with its memory usage.
VMRuntime.getRuntime().setTargetHeapUtilization(0.8f);
diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
index 7f7855a..d711a80 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java
@@ -713,52 +713,58 @@
case EVENT_GET_AD_DONE:
- isRecordLoadResponse = true;
+ try {
+ isRecordLoadResponse = true;
- ar = (AsyncResult)msg.obj;
- data = (byte[])ar.result;
+ ar = (AsyncResult)msg.obj;
+ data = (byte[])ar.result;
- if (ar.exception != null) {
- break;
- }
+ if (ar.exception != null) {
+ break;
+ }
- Log.d(LOG_TAG, "EF_AD: " +
- IccUtils.bytesToHexString(data));
+ Log.d(LOG_TAG, "EF_AD: " +
+ IccUtils.bytesToHexString(data));
- if (data.length < 3) {
- Log.d(LOG_TAG, "SIMRecords: Corrupt AD data on SIM");
- break;
- }
+ if (data.length < 3) {
+ Log.d(LOG_TAG, "SIMRecords: Corrupt AD data on SIM");
+ break;
+ }
- if (data.length == 3) {
- Log.d(LOG_TAG, "SIMRecords: MNC length not present in EF_AD");
- break;
- }
-
- mncLength = (int)data[3] & 0xf;
-
- if (mncLength == 0xf) {
- if (imsi != null) {
- try {
- int mcc = Integer.parseInt(imsi.substring(0,3));
-
- mncLength = MccTable.smallestDigitsMccForMnc(mcc);
- } catch (NumberFormatException e) {
- mncLength = UNKNOWN;
- Log.e(LOG_TAG, "SIMRecords: Corrupt IMSI!");
- }
- } else {
- // Indicate we got this info, but it didn't contain the length.
- mncLength = UNKNOWN;
-
+ if (data.length == 3) {
Log.d(LOG_TAG, "SIMRecords: MNC length not present in EF_AD");
+ break;
+ }
+
+ mncLength = (int)data[3] & 0xf;
+
+ if (mncLength == 0xf) {
+ mncLength = UNKNOWN;
+ }
+ } finally {
+ if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) {
+ if (imsi != null) {
+ try {
+ int mcc = Integer.parseInt(imsi.substring(0,3));
+
+ mncLength = MccTable.smallestDigitsMccForMnc(mcc);
+ } catch (NumberFormatException e) {
+ mncLength = UNKNOWN;
+ Log.e(LOG_TAG, "SIMRecords: Corrupt IMSI!");
+ }
+ } else {
+ // Indicate we got this info, but it didn't contain the length.
+ mncLength = UNKNOWN;
+
+ Log.d(LOG_TAG, "SIMRecords: MNC length not present in EF_AD");
+ }
+ }
+ if (imsi != null && mncLength != UNKNOWN) {
+ // finally have both imsi and the length of the mnc and can parse
+ // the imsi properly
+ MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
}
}
- if (imsi != null && mncLength != UNKNOWN) {
- // finally have both imsi and the length of the mnc and can parse it properly
- MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
- }
-
break;
case EVENT_GET_SPN_DONE: