summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityThread.java200
-rw-r--r--core/java/android/app/ContextImpl.java2
-rw-r--r--core/java/android/webkit/FrameLoader.java5
-rw-r--r--core/java/android/webkit/HTML5VideoViewProxy.java12
-rw-r--r--core/java/android/webkit/LoadListener.java1
-rw-r--r--core/java/android/webkit/WebTextView.java7
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_throttle_warning.pngbin2639 -> 0 bytes
-rw-r--r--core/res/res/drawable-hdpi/stat_sys_throttled.pngbin2503 -> 1187 bytes
-rw-r--r--core/res/res/drawable-mdpi/stat_sys_throttle_warning.pngbin1670 -> 0 bytes
-rw-r--r--core/res/res/drawable-mdpi/stat_sys_throttled.pngbin1519 -> 770 bytes
-rw-r--r--media/java/android/media/AudioService.java3
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.cpp5
-rw-r--r--services/java/com/android/server/PackageManagerService.java10
-rw-r--r--services/java/com/android/server/ThrottleService.java97
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java12
-rw-r--r--services/java/com/android/server/am/BroadcastRecord.java4
16 files changed, 227 insertions, 131 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index a556a32..fd84859 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -150,13 +150,13 @@ public final class ActivityThread {
public static IPackageManager getPackageManager() {
if (sPackageManager != null) {
- //Log.v("PackageManager", "returning cur default = " + sPackageManager);
+ //Slog.v("PackageManager", "returning cur default = " + sPackageManager);
return sPackageManager;
}
IBinder b = ServiceManager.getService("package");
- //Log.v("PackageManager", "default service binder = " + b);
+ //Slog.v("PackageManager", "default service binder = " + b);
sPackageManager = IPackageManager.Stub.asInterface(b);
- //Log.v("PackageManager", "default service = " + sPackageManager);
+ //Slog.v("PackageManager", "default service = " + sPackageManager);
return sPackageManager;
}
@@ -170,7 +170,7 @@ public final class ActivityThread {
}
DisplayMetrics metrics = mDisplayMetrics = new DisplayMetrics();
mDisplay.getMetrics(metrics);
- //Log.i("foo", "New metrics: w=" + metrics.widthPixels + " h="
+ //Slog.i("foo", "New metrics: w=" + metrics.widthPixels + " h="
// + metrics.heightPixels + " den=" + metrics.density
// + " xdpi=" + metrics.xdpi + " ydpi=" + metrics.ydpi);
return metrics;
@@ -189,14 +189,14 @@ public final class ActivityThread {
synchronized (mPackages) {
// Resources is app scale dependent.
if (false) {
- Log.w(TAG, "getTopLevelResources: " + resDir + " / "
+ Slog.w(TAG, "getTopLevelResources: " + resDir + " / "
+ compInfo.applicationScale);
}
WeakReference<Resources> wr = mActiveResources.get(key);
r = wr != null ? wr.get() : null;
if (r != null && r.getAssets().isUpToDate()) {
if (false) {
- Log.w(TAG, "Returning cached resources " + r + " " + resDir
+ Slog.w(TAG, "Returning cached resources " + r + " " + resDir
+ ": appScale=" + r.getCompatibilityInfo().applicationScale);
}
return r;
@@ -204,7 +204,7 @@ public final class ActivityThread {
}
//if (r != null) {
- // Log.w(TAG, "Throwing away out-of-date resources!!!! "
+ // Slog.w(TAG, "Throwing away out-of-date resources!!!! "
// + r + " " + resDir);
//}
@@ -213,11 +213,11 @@ public final class ActivityThread {
return null;
}
- //Log.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
+ //Slog.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
DisplayMetrics metrics = getDisplayMetricsLocked(false);
r = new Resources(assets, metrics, getConfiguration(), compInfo);
if (false) {
- Log.i(TAG, "Created app resources " + resDir + " " + r + ": "
+ Slog.i(TAG, "Created app resources " + resDir + " " + r + ": "
+ r.getConfiguration() + " appScale="
+ r.getCompatibilityInfo().applicationScale);
}
@@ -306,7 +306,7 @@ public final class ActivityThread {
mSystemContext.getResources().updateConfiguration(
mainThread.getConfiguration(),
mainThread.getDisplayMetricsLocked(false));
- //Log.i(TAG, "Created system resources "
+ //Slog.i(TAG, "Created system resources "
// + mSystemContext.getResources() + ": "
// + mSystemContext.getResources().getConfiguration());
}
@@ -465,7 +465,7 @@ public final class ActivityThread {
* create the class loader.
*/
- if (localLOGV) Log.v(TAG, "Class path: " + zip);
+ if (localLOGV) Slog.v(TAG, "Class path: " + zip);
mClassLoader =
ApplicationLoaders.getDefault().getClassLoader(
@@ -692,7 +692,7 @@ public final class ActivityThread {
}
}
mUnregisteredReceivers.remove(context);
- //Log.i(TAG, "Receiver registrations: " + mReceivers);
+ //Slog.i(TAG, "Receiver registrations: " + mReceivers);
HashMap<ServiceConnection, ServiceDispatcher> smap =
mServices.remove(context);
if (smap != null) {
@@ -714,7 +714,7 @@ public final class ActivityThread {
}
}
mUnboundServices.remove(context);
- //Log.i(TAG, "Service registrations: " + mServices);
+ //Slog.i(TAG, "Service registrations: " + mServices);
}
public IIntentReceiver getReceiverDispatcher(BroadcastReceiver r,
@@ -810,8 +810,8 @@ public final class ActivityThread {
ReceiverDispatcher rd = mDispatcher.get();
if (DEBUG_BROADCAST) {
int seq = intent.getIntExtra("seq", -1);
- Log.i(TAG, "Receiving broadcast " + intent.getAction() + " seq=" + seq
- + " to " + rd);
+ Slog.i(TAG, "Receiving broadcast " + intent.getAction() + " seq=" + seq
+ + " to " + (rd != null ? rd.mReceiver : null));
}
if (rd != null) {
rd.performReceive(intent, resultCode, data, extras,
@@ -821,9 +821,8 @@ public final class ActivityThread {
// receiver in this process, but before it could be delivered the
// receiver was unregistered. Acknowledge the broadcast on its
// behalf so that the system's broadcast sequence can continue.
- if (DEBUG_BROADCAST) {
- Log.i(TAG, "Broadcast to unregistered receiver");
- }
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing broadcast to unregistered receiver");
IActivityManager mgr = ActivityManagerNative.getDefault();
try {
mgr.finishReceiver(this, resultCode, data, extras, false);
@@ -855,16 +854,29 @@ public final class ActivityThread {
BroadcastReceiver receiver = mReceiver;
if (DEBUG_BROADCAST) {
int seq = mCurIntent.getIntExtra("seq", -1);
- Log.i(TAG, "Dispatching broadcast " + mCurIntent.getAction()
+ Slog.i(TAG, "Dispatching broadcast " + mCurIntent.getAction()
+ " seq=" + seq + " to " + mReceiver);
+ Slog.i(TAG, " mRegistered=" + mRegistered
+ + " mCurOrdered=" + mCurOrdered);
}
+
+ IActivityManager mgr = ActivityManagerNative.getDefault();
+ Intent intent = mCurIntent;
+ mCurIntent = null;
+
if (receiver == null) {
+ if (mRegistered && mCurOrdered) {
+ try {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing null broadcast to " + mReceiver);
+ mgr.finishReceiver(mIIntentReceiver,
+ mCurCode, mCurData, mCurMap, false);
+ } catch (RemoteException ex) {
+ }
+ }
return;
}
- IActivityManager mgr = ActivityManagerNative.getDefault();
- Intent intent = mCurIntent;
- mCurIntent = null;
try {
ClassLoader cl = mReceiver.getClass().getClassLoader();
intent.setExtrasClassLoader(cl);
@@ -880,6 +892,8 @@ public final class ActivityThread {
} catch (Exception e) {
if (mRegistered && mCurOrdered) {
try {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing failed broadcast to " + mReceiver);
mgr.finishReceiver(mIIntentReceiver,
mCurCode, mCurData, mCurMap, false);
} catch (RemoteException ex) {
@@ -894,6 +908,8 @@ public final class ActivityThread {
}
if (mRegistered && mCurOrdered) {
try {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing broadcast to " + mReceiver);
mgr.finishReceiver(mIIntentReceiver,
receiver.getResultCode(),
receiver.getResultData(),
@@ -961,7 +977,7 @@ public final class ActivityThread {
String data, Bundle extras, boolean ordered, boolean sticky) {
if (DEBUG_BROADCAST) {
int seq = intent.getIntExtra("seq", -1);
- Log.i(TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq
+ Slog.i(TAG, "Enqueueing broadcast " + intent.getAction() + " seq=" + seq
+ " to " + mReceiver);
}
Args args = new Args();
@@ -972,9 +988,11 @@ public final class ActivityThread {
args.mCurOrdered = ordered;
args.mCurSticky = sticky;
if (!mActivityThread.post(args)) {
- if (mRegistered) {
+ if (mRegistered && ordered) {
IActivityManager mgr = ActivityManagerNative.getDefault();
try {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing sync broadcast to " + mReceiver);
mgr.finishReceiver(mIIntentReceiver, args.mCurCode,
args.mCurData, args.mCurMap, false);
} catch (RemoteException ex) {
@@ -2133,7 +2151,7 @@ public final class ActivityThread {
IActivityManager am = ActivityManagerNative.getDefault();
ActivityRecord prev;
do {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Reporting idle of " + a +
" finished=" +
(a.activity != null ? a.activity.mFinished : false));
@@ -2252,7 +2270,7 @@ public final class ActivityThread {
ref = mResourcePackages.get(packageName);
}
PackageInfo packageInfo = ref != null ? ref.get() : null;
- //Log.i(TAG, "getPackageInfo " + packageName + ": " + packageInfo);
+ //Slog.i(TAG, "getPackageInfo " + packageName + ": " + packageInfo);
if (packageInfo != null && (packageInfo.mResources == null
|| packageInfo.mResources.getAssets().isUpToDate())) {
if (packageInfo.isSecurityViolation()
@@ -2319,7 +2337,7 @@ public final class ActivityThread {
PackageInfo packageInfo = ref != null ? ref.get() : null;
if (packageInfo == null || (packageInfo.mResources != null
&& !packageInfo.mResources.getAssets().isUpToDate())) {
- if (localLOGV) Log.v(TAG, (includeCode ? "Loading code package "
+ if (localLOGV) Slog.v(TAG, (includeCode ? "Loading code package "
: "Loading resource-only package ") + aInfo.packageName
+ " (in " + (mBoundApplication != null
? mBoundApplication.processName : null)
@@ -2402,7 +2420,7 @@ public final class ActivityThread {
context.getResources().updateConfiguration(
getConfiguration(), getDisplayMetricsLocked(false));
mSystemContext = context;
- //Log.i(TAG, "Created system resources " + context.getResources()
+ //Slog.i(TAG, "Created system resources " + context.getResources()
// + ": " + context.getResources().getConfiguration());
}
}
@@ -2442,10 +2460,10 @@ public final class ActivityThread {
void doGcIfNeeded() {
mGcIdlerScheduled = false;
final long now = SystemClock.uptimeMillis();
- //Log.i(TAG, "**** WE MIGHT WANT TO GC: then=" + Binder.getLastGcTime()
+ //Slog.i(TAG, "**** WE MIGHT WANT TO GC: then=" + Binder.getLastGcTime()
// + "m now=" + now);
if ((BinderInternal.getLastGcTime()+MIN_TIME_BETWEEN_GCS) < now) {
- //Log.i(TAG, "**** WE DO, WE DO WANT TO GC!");
+ //Slog.i(TAG, "**** WE DO, WE DO WANT TO GC!");
BinderInternal.forceGc("bg");
}
}
@@ -2481,7 +2499,7 @@ public final class ActivityThread {
} else {
name = "(Intent " + intent + ").getComponent() returned null";
}
- Log.v(TAG, "Performing launch: action=" + intent.getAction()
+ Slog.v(TAG, "Performing launch: action=" + intent.getAction()
+ ", comp=" + name
+ ", token=" + token);
}
@@ -2495,7 +2513,7 @@ public final class ActivityThread {
public final void sendActivityResult(
IBinder token, String id, int requestCode,
int resultCode, Intent data) {
- if (DEBUG_RESULTS) Log.v(TAG, "sendActivityResult: id=" + id
+ if (DEBUG_RESULTS) Slog.v(TAG, "sendActivityResult: id=" + id
+ " req=" + requestCode + " res=" + resultCode + " data=" + data);
ArrayList<ResultInfo> list = new ArrayList<ResultInfo>();
list.add(new ResultInfo(id, requestCode, resultCode, data));
@@ -2514,7 +2532,7 @@ public final class ActivityThread {
private final void queueOrSendMessage(int what, Object obj, int arg1, int arg2) {
synchronized (this) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "SCHEDULE " + what + " " + mH.codeToString(what)
+ ": " + arg1 + " / " + obj);
Message msg = Message.obtain();
@@ -2576,8 +2594,8 @@ public final class ActivityThread {
try {
Application app = r.packageInfo.makeApplication(false, mInstrumentation);
- if (localLOGV) Log.v(TAG, "Performing launch of " + r);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(TAG, "Performing launch of " + r);
+ if (localLOGV) Slog.v(
TAG, r + ": app=" + app
+ ", appName=" + app.getPackageName()
+ ", pkg=" + r.packageInfo.getPackageName()
@@ -2590,7 +2608,7 @@ public final class ActivityThread {
appContext.setOuterContext(activity);
CharSequence title = r.activityInfo.loadLabel(appContext.getPackageManager());
Configuration config = new Configuration(mConfiguration);
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Launching activity "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Launching activity "
+ r.activityInfo.name + " with config " + config);
activity.attach(appContext, this, getInstrumentation(), r.token,
r.ident, app, r.intent, r.activityInfo, title, r.parent,
@@ -2659,7 +2677,7 @@ public final class ActivityThread {
// we are back active so skip it.
unscheduleGcIdler();
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Handling launch of " + r);
Activity a = performLaunchActivity(r, customIntent);
@@ -2765,6 +2783,8 @@ public final class ActivityThread {
receiver = (BroadcastReceiver)cl.loadClass(component).newInstance();
} catch (Exception e) {
try {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing failed broadcast to " + data.intent.getComponent());
mgr.finishReceiver(mAppThread.asBinder(), data.resultCode,
data.resultData, data.resultExtras, data.resultAbort);
} catch (RemoteException ex) {
@@ -2777,7 +2797,7 @@ public final class ActivityThread {
try {
Application app = packageInfo.makeApplication(false, mInstrumentation);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Performing receive of " + data.intent
+ ": app=" + app
+ ", appName=" + app.getPackageName()
@@ -2794,6 +2814,8 @@ public final class ActivityThread {
data.intent);
} catch (Exception e) {
try {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing failed broadcast to " + data.intent.getComponent());
mgr.finishReceiver(mAppThread.asBinder(), data.resultCode,
data.resultData, data.resultExtras, data.resultAbort);
} catch (RemoteException ex) {
@@ -2807,11 +2829,15 @@ public final class ActivityThread {
try {
if (data.sync) {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing ordered broadcast to " + data.intent.getComponent());
mgr.finishReceiver(
mAppThread.asBinder(), receiver.getResultCode(),
receiver.getResultData(), receiver.getResultExtras(false),
receiver.getAbortBroadcast());
} else {
+ if (DEBUG_BROADCAST) Slog.i(TAG,
+ "Finishing broadcast to " + data.intent.getComponent());
mgr.finishReceiver(mAppThread.asBinder(), 0, null, null, false);
}
} catch (RemoteException ex) {
@@ -2820,7 +2846,7 @@ public final class ActivityThread {
// Instantiate a BackupAgent and tell it that it's alive
private final void handleCreateBackupAgent(CreateBackupAgentData data) {
- if (DEBUG_BACKUP) Log.v(TAG, "handleCreateBackupAgent: " + data);
+ if (DEBUG_BACKUP) Slog.v(TAG, "handleCreateBackupAgent: " + data);
// no longer idle; we have backup work to do
unscheduleGcIdler();
@@ -2829,7 +2855,7 @@ public final class ActivityThread {
PackageInfo packageInfo = getPackageInfoNoCheck(data.appInfo);
String packageName = packageInfo.mPackageName;
if (mBackupAgents.get(packageName) != null) {
- Log.d(TAG, "BackupAgent " + " for " + packageName
+ Slog.d(TAG, "BackupAgent " + " for " + packageName
+ " already exists");
return;
}
@@ -2851,7 +2877,7 @@ public final class ActivityThread {
agent = (BackupAgent) cl.loadClass(data.appInfo.backupAgentName).newInstance();
// set up the agent's context
- if (DEBUG_BACKUP) Log.v(TAG, "Initializing BackupAgent "
+ if (DEBUG_BACKUP) Slog.v(TAG, "Initializing BackupAgent "
+ data.appInfo.backupAgentName);
ContextImpl context = new ContextImpl();
@@ -2886,7 +2912,7 @@ public final class ActivityThread {
// Tear down a BackupAgent
private final void handleDestroyBackupAgent(CreateBackupAgentData data) {
- if (DEBUG_BACKUP) Log.v(TAG, "handleDestroyBackupAgent: " + data);
+ if (DEBUG_BACKUP) Slog.v(TAG, "handleDestroyBackupAgent: " + data);
PackageInfo packageInfo = getPackageInfoNoCheck(data.appInfo);
String packageName = packageInfo.mPackageName;
@@ -2924,7 +2950,7 @@ public final class ActivityThread {
}
try {
- if (localLOGV) Log.v(TAG, "Creating service " + data.info.name);
+ if (localLOGV) Slog.v(TAG, "Creating service " + data.info.name);
ContextImpl context = new ContextImpl();
context.init(packageInfo, null, this);
@@ -3049,7 +3075,7 @@ public final class ActivityThread {
Service s = mServices.remove(token);
if (s != null) {
try {
- if (localLOGV) Log.v(TAG, "Destroying service " + s);
+ if (localLOGV) Slog.v(TAG, "Destroying service " + s);
s.onDestroy();
Context context = s.getBaseContext();
if (context instanceof ContextImpl) {
@@ -3070,13 +3096,13 @@ public final class ActivityThread {
}
}
}
- //Log.i(TAG, "Running services: " + mServices);
+ //Slog.i(TAG, "Running services: " + mServices);
}
public final ActivityRecord performResumeActivity(IBinder token,
boolean clearHide) {
ActivityRecord r = mActivities.get(token);
- if (localLOGV) Log.v(TAG, "Performing resume of " + r
+ if (localLOGV) Slog.v(TAG, "Performing resume of " + r
+ " finished=" + r.activity.mFinished);
if (r != null && !r.activity.mFinished) {
if (clearHide) {
@@ -3122,7 +3148,7 @@ public final class ActivityThread {
if (r != null) {
final Activity a = r.activity;
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Resume " + r + " started activity: " +
a.mStartedActivity + ", hideForNow: " + r.hideForNow
+ ", finished: " + a.mFinished);
@@ -3159,7 +3185,7 @@ public final class ActivityThread {
// we started another activity, then don't yet make the
// window visible.
} else if (!willBeVisible) {
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Launch " + r + " mStartedActivity set");
r.hideForNow = true;
}
@@ -3169,12 +3195,12 @@ public final class ActivityThread {
if (!r.activity.mFinished && willBeVisible
&& r.activity.mDecor != null && !r.hideForNow) {
if (r.newConfig != null) {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Resuming activity "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Resuming activity "
+ r.activityInfo.name + " with newConfig " + r.newConfig);
performConfigurationChanged(r.activity, r.newConfig);
r.newConfig = null;
}
- if (localLOGV) Log.v(TAG, "Resuming " + r + " with isForward="
+ if (localLOGV) Slog.v(TAG, "Resuming " + r + " with isForward="
+ isForward);
WindowManager.LayoutParams l = r.window.getAttributes();
if ((l.softInputMode
@@ -3198,7 +3224,7 @@ public final class ActivityThread {
r.nextIdle = mNewActivities;
mNewActivities = r;
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Scheduling idle handler for " + r);
Looper.myQueue().addIdleHandler(new Idler());
@@ -3256,7 +3282,7 @@ public final class ActivityThread {
boolean userLeaving, int configChanges) {
ActivityRecord r = mActivities.get(token);
if (r != null) {
- //Log.v(TAG, "userLeaving=" + userLeaving + " handling pause of " + r);
+ //Slog.v(TAG, "userLeaving=" + userLeaving + " handling pause of " + r);
if (userLeaving) {
performUserLeavingActivity(r);
}
@@ -3351,7 +3377,7 @@ public final class ActivityThread {
private final void performStopActivityInner(ActivityRecord r,
StopInfo info, boolean keepShown) {
- if (localLOGV) Log.v(TAG, "Performing stop of " + r);
+ if (localLOGV) Slog.v(TAG, "Performing stop of " + r);
if (r != null) {
if (!keepShown && r.stopped) {
if (r.activity.mFinished) {
@@ -3412,7 +3438,7 @@ public final class ActivityThread {
}
}
if (r.newConfig != null) {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Updating activity vis "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Updating activity vis "
+ r.activityInfo.name + " with new config " + r.newConfig);
performConfigurationChanged(r.activity, r.newConfig);
r.newConfig = null;
@@ -3434,7 +3460,7 @@ public final class ActivityThread {
StopInfo info = new StopInfo();
performStopActivityInner(r, info, show);
- if (localLOGV) Log.v(
+ if (localLOGV) Slog.v(
TAG, "Finishing stop of " + r + ": show=" + show
+ " win=" + r.window);
@@ -3469,7 +3495,7 @@ public final class ActivityThread {
r.stopped = false;
}
if (r.activity.mDecor != null) {
- if (Config.LOGV) Log.v(
+ if (Config.LOGV) Slog.v(
TAG, "Handle window " + r + " visibility: " + show);
updateVisibility(r, show);
}
@@ -3483,7 +3509,7 @@ public final class ActivityThread {
if (ri.mData != null) {
ri.mData.setExtrasClassLoader(r.activity.getClassLoader());
}
- if (DEBUG_RESULTS) Log.v(TAG,
+ if (DEBUG_RESULTS) Slog.v(TAG,
"Delivering result to activity " + r + " : " + ri);
r.activity.dispatchActivityResult(ri.mResultWho,
ri.mRequestCode, ri.mResultCode, ri.mData);
@@ -3500,7 +3526,7 @@ public final class ActivityThread {
private final void handleSendResult(ResultData res) {
ActivityRecord r = mActivities.get(res.token);
- if (DEBUG_RESULTS) Log.v(TAG, "Handling send result to " + r);
+ if (DEBUG_RESULTS) Slog.v(TAG, "Handling send result to " + r);
if (r != null) {
final boolean resumed = !r.paused;
if (!r.activity.mFinished && r.activity.mDecor != null
@@ -3545,7 +3571,7 @@ public final class ActivityThread {
private final ActivityRecord performDestroyActivity(IBinder token, boolean finishing,
int configChanges, boolean getNonConfigInstance) {
ActivityRecord r = mActivities.get(token);
- if (localLOGV) Log.v(TAG, "Performing finish of " + r);
+ if (localLOGV) Slog.v(TAG, "Performing finish of " + r);
if (r != null) {
r.activity.mConfigChangeFlags |= configChanges;
if (finishing) {
@@ -3695,7 +3721,7 @@ public final class ActivityThread {
Configuration changedConfig = null;
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Relaunching activity "
+ tmp.token + " with configChanges=0x"
+ Integer.toHexString(configChanges));
@@ -3717,7 +3743,7 @@ public final class ActivityThread {
}
if (tmp == null) {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Abort, activity not relaunching!");
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Abort, activity not relaunching!");
return;
}
@@ -3741,7 +3767,7 @@ public final class ActivityThread {
}
}
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Relaunching activity "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Relaunching activity "
+ tmp.token + ": changedConfig=" + changedConfig);
// If there was a pending configuration change, execute it first.
@@ -3750,7 +3776,7 @@ public final class ActivityThread {
}
ActivityRecord r = mActivities.get(tmp.token);
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Handling relaunch of " + r);
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handling relaunch of " + r);
if (r == null) {
return;
}
@@ -3836,7 +3862,7 @@ public final class ActivityThread {
// the activity manager may, before then, decide the
// activity needs to be destroyed to handle its new
// configuration.
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Setting activity "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Setting activity "
+ ar.activityInfo.name + " newConfig=" + newConfig);
ar.newConfig = newConfig;
}
@@ -3895,7 +3921,7 @@ public final class ActivityThread {
}
}
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Config callback " + cb
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Config callback " + cb
+ ": shouldChangeConfig=" + shouldChangeConfig);
if (shouldChangeConfig) {
cb.onConfigurationChanged(config);
@@ -3917,7 +3943,7 @@ public final class ActivityThread {
mResConfiguration = new Configuration();
}
if (!mResConfiguration.isOtherSeqNewer(config)) {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Skipping new config: curSeq="
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Skipping new config: curSeq="
+ mResConfiguration.seq + ", newSeq=" + config.seq);
return false;
}
@@ -3932,7 +3958,7 @@ public final class ActivityThread {
Resources.updateSystemConfiguration(config, dm);
ContextImpl.ApplicationPackageManager.configurationChanged();
- //Log.i(TAG, "Configuration changed in " + currentPackageName());
+ //Slog.i(TAG, "Configuration changed in " + currentPackageName());
Iterator<WeakReference<Resources>> it =
mActiveResources.values().iterator();
@@ -3942,13 +3968,13 @@ public final class ActivityThread {
WeakReference<Resources> v = it.next();
Resources r = v.get();
if (r != null) {
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Changing resources "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Changing resources "
+ r + " config to: " + config);
r.updateConfiguration(config, dm);
- //Log.i(TAG, "Updated app resources " + v.getKey()
+ //Slog.i(TAG, "Updated app resources " + v.getKey()
// + " " + r + ": " + r.getConfiguration());
} else {
- //Log.i(TAG, "Removing old resources " + v.getKey());
+ //Slog.i(TAG, "Removing old resources " + v.getKey());
it.remove();
}
}
@@ -3972,7 +3998,7 @@ public final class ActivityThread {
return;
}
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle configuration changed: "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle configuration changed: "
+ config);
applyConfigurationToResourcesLocked(config);
@@ -4002,7 +4028,7 @@ public final class ActivityThread {
return;
}
- if (DEBUG_CONFIGURATION) Log.v(TAG, "Handle activity config changed: "
+ if (DEBUG_CONFIGURATION) Slog.v(TAG, "Handle activity config changed: "
+ r.activityInfo.name);
performConfigurationChanged(r.activity, mConfiguration);
@@ -4095,7 +4121,7 @@ public final class ActivityThread {
// XXX should have option to change the port.
Debug.changeDebugPort(8100);
if (data.debugMode == IApplicationThread.DEBUG_WAIT) {
- Log.w(TAG, "Application " + data.info.getPackageName()
+ Slog.w(TAG, "Application " + data.info.getPackageName()
+ " is waiting for the debugger on port 8100...");
IActivityManager mgr = ActivityManagerNative.getDefault();
@@ -4112,7 +4138,7 @@ public final class ActivityThread {
}
} else {
- Log.w(TAG, "Application " + data.info.getPackageName()
+ Slog.w(TAG, "Application " + data.info.getPackageName()
+ " can be debugged on port 8100...");
}
}
@@ -4208,7 +4234,7 @@ public final class ActivityThread {
if (mBoundApplication.profileFile != null && mBoundApplication.handlingProfiling) {
Debug.stopMethodTracing();
}
- //Log.i(TAG, "am: " + ActivityManagerNative.getDefault()
+ //Slog.i(TAG, "am: " + ActivityManagerNative.getDefault()
// + ", app thr: " + mAppThread);
try {
am.finishInstrumentation(mAppThread, resultCode, results);
@@ -4275,12 +4301,12 @@ public final class ActivityThread {
IContentProvider prov = installProvider(context, holder.provider,
holder.info, true);
- //Log.i(TAG, "noReleaseNeeded=" + holder.noReleaseNeeded);
+ //Slog.i(TAG, "noReleaseNeeded=" + holder.noReleaseNeeded);
if (holder.noReleaseNeeded || holder.provider == null) {
// We are not going to release the provider if it is an external
// provider that doesn't care about being released, or if it is
// a local provider running in this process.
- //Log.i(TAG, "*** NO RELEASE NEEDED");
+ //Slog.i(TAG, "*** NO RELEASE NEEDED");
synchronized(mProviderMap) {
mProviderRefCountMap.put(prov.asBinder(), new ProviderRefCount(10000));
}
@@ -4312,7 +4338,7 @@ public final class ActivityThread {
synchronized(mProviderMap) {
ProviderRefCount prc = mProviderRefCountMap.get(jBinder);
if(prc == null) {
- if(localLOGV) Log.v(TAG, "releaseProvider::Weird shouldnt be here");
+ if(localLOGV) Slog.v(TAG, "releaseProvider::Weird shouldnt be here");
return false;
} else {
prc.count--;
@@ -4344,7 +4370,7 @@ public final class ActivityThread {
if (name != null) {
try {
- if(localLOGV) Log.v(TAG, "removeProvider::Invoking " +
+ if(localLOGV) Slog.v(TAG, "removeProvider::Invoking " +
"ActivityManagerNative.removeContentProvider(" + name);
ActivityManagerNative.getDefault().removeContentProvider(
getApplicationThread(), name);
@@ -4370,10 +4396,10 @@ public final class ActivityThread {
if (myBinder == providerBinder) {
//find if its published by this process itself
if(pr.mLocalProvider != null) {
- if(localLOGV) Log.i(TAG, "removeProvider::found local provider returning");
+ if(localLOGV) Slog.i(TAG, "removeProvider::found local provider returning");
return name;
}
- if(localLOGV) Log.v(TAG, "removeProvider::Not local provider Unlinking " +
+ if(localLOGV) Slog.v(TAG, "removeProvider::Not local provider Unlinking " +
"death recipient");
//content provider is in another process
myBinder.unlinkToDeath(pr, 0);
@@ -4392,7 +4418,7 @@ public final class ActivityThread {
synchronized(mProviderMap) {
ProviderRecord pr = mProviderMap.get(name);
if (pr.mProvider.asBinder() == provider.asBinder()) {
- Log.i(TAG, "Removing dead content provider: " + name);
+ Slog.i(TAG, "Removing dead content provider: " + name);
ProviderRecord removed = mProviderMap.remove(name);
if (removed != null) {
removed.mProvider.asBinder().unlinkToDeath(removed, 0);
@@ -4404,7 +4430,7 @@ public final class ActivityThread {
final void removeDeadProviderLocked(String name, IContentProvider provider) {
ProviderRecord pr = mProviderMap.get(name);
if (pr.mProvider.asBinder() == provider.asBinder()) {
- Log.i(TAG, "Removing dead content provider: " + name);
+ Slog.i(TAG, "Removing dead content provider: " + name);
ProviderRecord removed = mProviderMap.remove(name);
if (removed != null) {
removed.mProvider.asBinder().unlinkToDeath(removed, 0);
@@ -4417,7 +4443,7 @@ public final class ActivityThread {
ContentProvider localProvider = null;
if (provider == null) {
if (noisy) {
- Log.d(TAG, "Loading provider " + info.authority + ": "
+ Slog.d(TAG, "Loading provider " + info.authority + ": "
+ info.name);
}
Context c = null;
@@ -4452,7 +4478,7 @@ public final class ActivityThread {
info.applicationInfo.sourceDir);
return null;
}
- if (Config.LOGV) Log.v(
+ if (Config.LOGV) Slog.v(
TAG, "Instantiating local provider " + info.name);
// XXX Need to create the correct context for this provider.
localProvider.attachInfo(c, info);
@@ -4465,7 +4491,7 @@ public final class ActivityThread {
return null;
}
} else if (localLOGV) {
- Log.v(TAG, "Installing external provider " + info.authority + ": "
+ Slog.v(TAG, "Installing external provider " + info.authority + ": "
+ info.name);
}
@@ -4586,6 +4612,6 @@ public final class ActivityThread {
String name = (thread.mInitialApplication != null)
? thread.mInitialApplication.getPackageName()
: "<unknown>";
- Log.i(TAG, "Main thread of " + name + " is now exiting");
+ Slog.i(TAG, "Main thread of " + name + " is now exiting");
}
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 9019af6..fd0edaa 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -796,7 +796,7 @@ class ContextImpl extends Context {
scheduler = mMainThread.getHandler();
}
rd = new ActivityThread.PackageInfo.ReceiverDispatcher(
- receiver, context, scheduler, null, false).getIIntentReceiver();
+ receiver, context, scheduler, null, true).getIIntentReceiver();
}
}
try {
diff --git a/core/java/android/webkit/FrameLoader.java b/core/java/android/webkit/FrameLoader.java
index 906264a..7fd993a 100644
--- a/core/java/android/webkit/FrameLoader.java
+++ b/core/java/android/webkit/FrameLoader.java
@@ -102,8 +102,9 @@ class FrameLoader {
com.android.internal.R.string.httpErrorBadUrl));
return false;
}
- // Make sure it is correctly URL encoded before sending the request
- if (!URLUtil.verifyURLEncoding(url)) {
+ // Make sure the host part of the url is correctly
+ // encoded before sending the request
+ if (!URLUtil.verifyURLEncoding(mListener.host())) {
mListener.error(EventHandler.ERROR_BAD_URL,
mListener.getContext().getString(
com.android.internal.R.string.httpErrorBadUrl));
diff --git a/core/java/android/webkit/HTML5VideoViewProxy.java b/core/java/android/webkit/HTML5VideoViewProxy.java
index eee8025..eda2e72 100644
--- a/core/java/android/webkit/HTML5VideoViewProxy.java
+++ b/core/java/android/webkit/HTML5VideoViewProxy.java
@@ -132,6 +132,7 @@ class HTML5VideoViewProxy extends Handler
if (mVideoView.isPlaying()) {
mVideoView.stopPlayback();
}
+ mCurrentProxy.dispatchOnEnded();
mCurrentProxy = null;
mLayout.removeView(mVideoView);
mVideoView = null;
@@ -154,7 +155,7 @@ class HTML5VideoViewProxy extends Handler
if (mCurrentProxy != null) {
// Some other video is already playing. Notify the caller that its playback ended.
- proxy.playbackEnded();
+ proxy.dispatchOnEnded();
return;
}
@@ -245,7 +246,10 @@ class HTML5VideoViewProxy extends Handler
// MediaPlayer.OnCompletionListener;
public void onCompletion(MediaPlayer mp) {
- playbackEnded();
+ // The video ended by itself, so we need to
+ // send a message to the UI thread to dismiss
+ // the video view and to return to the WebView.
+ sendMessage(obtainMessage(ENDED));
}
// MediaPlayer.OnErrorListener
@@ -254,11 +258,9 @@ class HTML5VideoViewProxy extends Handler
return false;
}
- public void playbackEnded() {
+ public void dispatchOnEnded() {
Message msg = Message.obtain(mWebCoreHandler, ENDED);
mWebCoreHandler.sendMessage(msg);
- // also send a message to ourselves to return to the WebView
- sendMessage(obtainMessage(ENDED));
}
public void onTimeupdate() {
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index 12b8c74..e0f8bc0 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -476,6 +476,7 @@ class LoadListener extends Handler implements EventHandler {
}
WebViewWorker.CacheEncoding ce = new WebViewWorker.CacheEncoding();
ce.mEncoding = mEncoding;
+ ce.mListener = this;
WebViewWorker.getHandler().obtainMessage(
WebViewWorker.MSG_UPDATE_CACHE_ENCODING, ce).sendToTarget();
}
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 870f512..dc952e6 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -343,6 +343,7 @@ import java.util.ArrayList;
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
+ if (mInSetTextAndKeepSelection) return;
// This code is copied from TextView.onDraw(). That code does not get
// executed, however, because the WebTextView does not draw, allowing
// webkit's drawing to show through.
@@ -799,8 +800,14 @@ import java.util.ArrayList;
/* package */ void setTextAndKeepSelection(String text) {
mPreChange = text.toString();
Editable edit = (Editable) getText();
+ int selStart = Selection.getSelectionStart(edit);
+ int selEnd = Selection.getSelectionEnd(edit);
mInSetTextAndKeepSelection = true;
edit.replace(0, edit.length(), text);
+ int newLength = edit.length();
+ if (selStart > newLength) selStart = newLength;
+ if (selEnd > newLength) selEnd = newLength;
+ Selection.setSelection(edit, selStart, selEnd);
mInSetTextAndKeepSelection = false;
updateCachedTextfield();
}
diff --git a/core/res/res/drawable-hdpi/stat_sys_throttle_warning.png b/core/res/res/drawable-hdpi/stat_sys_throttle_warning.png
deleted file mode 100644
index c42b00c..0000000
--- a/core/res/res/drawable-hdpi/stat_sys_throttle_warning.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/stat_sys_throttled.png b/core/res/res/drawable-hdpi/stat_sys_throttled.png
index e43fbae..33c0521 100644
--- a/core/res/res/drawable-hdpi/stat_sys_throttled.png
+++ b/core/res/res/drawable-hdpi/stat_sys_throttled.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_throttle_warning.png b/core/res/res/drawable-mdpi/stat_sys_throttle_warning.png
deleted file mode 100644
index 3688803..0000000
--- a/core/res/res/drawable-mdpi/stat_sys_throttle_warning.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/stat_sys_throttled.png b/core/res/res/drawable-mdpi/stat_sys_throttled.png
index efb64ad..97ac427 100644
--- a/core/res/res/drawable-mdpi/stat_sys_throttled.png
+++ b/core/res/res/drawable-mdpi/stat_sys_throttled.png
Binary files differ
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 9ab02f0..3e38e53 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1128,6 +1128,9 @@ public class AudioService extends IAudioService.Stub {
if (direction == AudioManager.ADJUST_RAISE) {
// exiting silent mode
newRingerMode = AudioManager.RINGER_MODE_NORMAL;
+ } else {
+ // prevent last audible index to reach 0
+ adjustVolumeIndex = false;
}
}
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index fed4f95..d2e9e83 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -743,6 +743,11 @@ player_type getPlayerType(const char* url)
}
}
+ // Use PV_PLAYER for rtsp for now
+ if (!strncasecmp(url, "rtsp://", 7)) {
+ return PV_PLAYER;
+ }
+
return getDefaultPlayerType();
}
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 2ad1bd5..e68effa 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -181,6 +181,8 @@ class PackageManagerService extends IPackageManager.Stub {
static final int SCAN_NEW_INSTALL = 1<<4;
static final int SCAN_NO_PATHS = 1<<5;
+ static final int REMOVE_CHATTY = 1<<16;
+
static final ComponentName DEFAULT_CONTAINER_COMPONENT = new ComponentName(
"com.android.defcontainer",
"com.android.defcontainer.DefaultContainerService");
@@ -6092,7 +6094,8 @@ class PackageManagerService extends IPackageManager.Stub {
}
synchronized (mInstallLock) {
- res = deletePackageLI(packageName, deleteCodeAndResources, flags, info);
+ res = deletePackageLI(packageName, deleteCodeAndResources,
+ flags | REMOVE_CHATTY, info);
}
if(res && sendBroadCast) {
@@ -6158,7 +6161,7 @@ class PackageManagerService extends IPackageManager.Stub {
if (outInfo != null) {
outInfo.removedPackage = packageName;
}
- removePackageLI(p, true);
+ removePackageLI(p, (flags&REMOVE_CHATTY) != 0);
// Retrieve object to delete permissions for shared user later on
PackageSetting deletedPs;
synchronized (mPackages) {
@@ -9625,8 +9628,7 @@ class PackageManagerService extends IPackageManager.Stub {
continue;
}
// Parse package
- int parseFlags = PackageParser.PARSE_CHATTY |
- PackageParser.PARSE_ON_SDCARD | mDefParseFlags;
+ int parseFlags = PackageParser.PARSE_ON_SDCARD | mDefParseFlags;
doGc = true;
synchronized (mInstallLock) {
final PackageParser.Package pkg = scanPackageLI(new File(codePath),
diff --git a/services/java/com/android/server/ThrottleService.java b/services/java/com/android/server/ThrottleService.java
index 71557f5..9333dd8 100644
--- a/services/java/com/android/server/ThrottleService.java
+++ b/services/java/com/android/server/ThrottleService.java
@@ -28,11 +28,11 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
-import android.content.SharedPreferences;
import android.database.ContentObserver;
import android.net.IThrottleManager;
import android.net.ThrottleManager;
import android.os.Binder;
+import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -48,7 +48,12 @@ import android.util.Slog;
import com.android.internal.telephony.TelephonyProperties;
+import java.io.BufferedWriter;
+import java.io.File;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.Calendar;
import java.util.GregorianCalendar;
@@ -353,6 +358,8 @@ public class ThrottleService extends IThrottleManager.Stub {
onResetAlarm();
+ onPollAlarm();
+
Intent broadcast = new Intent(ThrottleManager.POLICY_CHANGED_ACTION);
mContext.sendBroadcast(broadcast);
}
@@ -418,7 +425,7 @@ public class ThrottleService extends IThrottleManager.Stub {
}
mNotificationManager.cancel(com.android.internal.R.drawable.
- stat_sys_throttle_warning);
+ stat_sys_throttled);
postNotification(com.android.internal.R.string.throttled_notification_title,
com.android.internal.R.string.throttled_notification_message,
@@ -453,18 +460,18 @@ public class ThrottleService extends IThrottleManager.Stub {
if (mWarningNotificationSent == false) {
mWarningNotificationSent = true;
mNotificationManager.cancel(com.android.internal.R.drawable.
- stat_sys_throttle_warning);
+ stat_sys_throttled);
postNotification(com.android.internal.R.string.
throttle_warning_notification_title,
com.android.internal.R.string.
throttle_warning_notification_message,
- com.android.internal.R.drawable.stat_sys_throttle_warning,
+ com.android.internal.R.drawable.stat_sys_throttled,
0);
}
} else {
if (mWarningNotificationSent == true) {
mNotificationManager.cancel(com.android.internal.R.drawable.
- stat_sys_throttle_warning);
+ stat_sys_throttled);
mWarningNotificationSent =false;
}
}
@@ -512,7 +519,6 @@ public class ThrottleService extends IThrottleManager.Stub {
broadcast.putExtra(ThrottleManager.EXTRA_THROTTLE_LEVEL, -1);
mContext.sendStickyBroadcast(broadcast);
}
- mNotificationManager.cancel(com.android.internal.R.drawable.stat_sys_throttle_warning);
mNotificationManager.cancel(com.android.internal.R.drawable.stat_sys_throttled);
mWarningNotificationSent = false;
}
@@ -591,7 +597,6 @@ public class ThrottleService extends IThrottleManager.Stub {
ThrottleService mParent;
Context mContext;
- SharedPreferences mSharedPreferences;
DataRecorder(Context context, ThrottleService parent) {
mContext = context;
@@ -605,9 +610,6 @@ public class ThrottleService extends IThrottleManager.Stub {
mPeriodStart = Calendar.getInstance();
mPeriodEnd = Calendar.getInstance();
- mSharedPreferences = mContext.getSharedPreferences("ThrottleData",
- android.content.Context.MODE_PRIVATE);
-
zeroData(0);
retrieve();
}
@@ -698,24 +700,35 @@ public class ThrottleService extends IThrottleManager.Stub {
record();
}
- private void record() {
- // serialize into a secure setting
+ private File getDataFile() {
+ File dataDir = Environment.getDataDirectory();
+ File throttleDir = new File(dataDir, "system/throttle");
+ throttleDir.mkdirs();
+ File dataFile = new File(throttleDir, "data");
+ return dataFile;
+ }
+
+ private static final int DATA_FILE_VERSION = 1;
+ private void record() {
+ // 1 int version
// 1 int mPeriodCount
// 13*6 long[PERIOD_COUNT] mPeriodRxData
// 13*6 long[PERIOD_COUNT] mPeriodTxData
// 1 int mCurrentPeriod
// 13 long periodStartMS
// 13 long periodEndMS
- // 199 chars max
+ // 200 chars max
StringBuilder builder = new StringBuilder();
+ builder.append(DATA_FILE_VERSION);
+ builder.append(":");
builder.append(mPeriodCount);
builder.append(":");
- for(int i=0; i < mPeriodCount; i++) {
+ for(int i = 0; i < mPeriodCount; i++) {
builder.append(mPeriodRxData[i]);
builder.append(":");
}
- for(int i=0; i < mPeriodCount; i++) {
+ for(int i = 0; i < mPeriodCount; i++) {
builder.append(mPeriodTxData[i]);
builder.append(":");
}
@@ -726,32 +739,64 @@ public class ThrottleService extends IThrottleManager.Stub {
builder.append(mPeriodEnd.getTimeInMillis());
builder.append(":");
- SharedPreferences.Editor editor = mSharedPreferences.edit();
-
- editor.putString("Data", builder.toString());
- editor.commit();
+ BufferedWriter out = null;
+ try {
+ out = new BufferedWriter(new FileWriter(getDataFile()),256);
+ out.write(builder.toString());
+ } catch (IOException e) {
+ Slog.e(TAG, "Error writing data file");
+ return;
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (Exception e) {}
+ }
+ }
}
private void retrieve() {
- String data = mSharedPreferences.getString("Data", "");
-// String data = Settings.Secure.getString(mContext.getContentResolver(),
-// Settings.Secure.THROTTLE_VALUE);
+ File f = getDataFile();
+ byte[] buffer;
+ FileInputStream s = null;
+ try {
+ buffer = new byte[(int)f.length()];
+ s = new FileInputStream(f);
+ s.read(buffer);
+ } catch (IOException e) {
+ Slog.e(TAG, "Error reading data file");
+ return;
+ } finally {
+ if (s != null) {
+ try {
+ s.close();
+ } catch (Exception e) {}
+ }
+ }
+ String data = new String(buffer);
if (data == null || data.length() == 0) return;
-
synchronized (mParent) {
String[] parsed = data.split(":");
int parsedUsed = 0;
- if (parsed.length < 6) return;
+ if (parsed.length < 6) {
+ Slog.e(TAG, "reading data file with insufficient length - ignoring");
+ return;
+ }
+
+ if (Integer.parseInt(parsed[parsedUsed++]) != DATA_FILE_VERSION) {
+ Slog.e(TAG, "reading data file with bad version - ignoring");
+ return;
+ }
mPeriodCount = Integer.parseInt(parsed[parsedUsed++]);
if (parsed.length != 4 + (2 * mPeriodCount)) return;
mPeriodRxData = new long[mPeriodCount];
- for(int i=0; i < mPeriodCount; i++) {
+ for(int i = 0; i < mPeriodCount; i++) {
mPeriodRxData[i] = Long.parseLong(parsed[parsedUsed++]);
}
mPeriodTxData = new long[mPeriodCount];
- for(int i=0; i < mPeriodCount; i++) {
+ for(int i = 0; i < mPeriodCount; i++) {
mPeriodTxData[i] = Long.parseLong(parsed[parsedUsed++]);
}
mCurrentPeriod = Integer.parseInt(parsed[parsedUsed++]);
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index b6f323d..1486a1d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -9905,7 +9905,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
}
if (mOrderedBroadcasts.size() > 0) {
pw.println(" ");
- pw.println(" Active serialized broadcasts:");
+ pw.println(" Active ordered broadcasts:");
}
for (int i=mOrderedBroadcasts.size()-1; i>=0; i--) {
pw.println(" Serialized Broadcast #" + i + ":");
@@ -12919,7 +12919,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
try {
if (DEBUG_BROADCAST_LIGHT) {
int seq = r.intent.getIntExtra("seq", -1);
- Slog.i(TAG, "Delivering to " + filter.receiverList.app
+ Slog.i(TAG, "Delivering to " + filter
+ " (seq=" + seq + "): " + r);
}
performReceive(filter.receiverList.app, filter.receiverList.receiver,
@@ -12959,7 +12959,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
if (DEBUG_BROADCAST) Slog.v(TAG, "processNextBroadcast: "
+ mParallelBroadcasts.size() + " broadcasts, "
- + mOrderedBroadcasts.size() + " serialized broadcasts");
+ + mOrderedBroadcasts.size() + " ordered broadcasts");
updateCpuStats();
@@ -12977,7 +12977,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
for (int i=0; i<N; i++) {
Object target = r.receivers.get(i);
if (DEBUG_BROADCAST) Slog.v(TAG,
- "Delivering non-serialized to registered "
+ "Delivering non-ordered to registered "
+ target + ": " + r);
deliverToRegisteredReceiver(r, (BroadcastFilter)target, false);
}
@@ -13115,12 +13115,14 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
// a direct call.
BroadcastFilter filter = (BroadcastFilter)nextReceiver;
if (DEBUG_BROADCAST) Slog.v(TAG,
- "Delivering serialized to registered "
+ "Delivering ordered to registered "
+ filter + ": " + r);
deliverToRegisteredReceiver(r, filter, r.ordered);
if (r.receiver == null || !r.ordered) {
// The receiver has already finished, so schedule to
// process the next one.
+ if (DEBUG_BROADCAST) Slog.v(TAG, "Quick finishing: ordered="
+ + r.ordered + " receiver=" + r.receiver);
r.state = BroadcastRecord.IDLE;
scheduleBroadcastsLocked();
}
diff --git a/services/java/com/android/server/am/BroadcastRecord.java b/services/java/com/android/server/am/BroadcastRecord.java
index 75c9600..c3f0b3e 100644
--- a/services/java/com/android/server/am/BroadcastRecord.java
+++ b/services/java/com/android/server/am/BroadcastRecord.java
@@ -126,7 +126,9 @@ class BroadcastRecord extends Binder {
pw.println(prefix + "curApp=" + curApp);
pw.println(prefix + "curComponent="
+ (curComponent != null ? curComponent.toShortString() : "--"));
- pw.println(prefix + "curSourceDir=" + curReceiver.applicationInfo.sourceDir);
+ if (curReceiver != null && curReceiver.applicationInfo != null) {
+ pw.println(prefix + "curSourceDir=" + curReceiver.applicationInfo.sourceDir);
+ }
}
String stateStr = " (?)";
switch (state) {