Loading core/java/android/app/ActivityThread.java +4 −1 Original line number Diff line number Diff line Loading @@ -2495,7 +2495,6 @@ public final class ActivityThread { " did not call through to super.onPostCreate()"); } } r.state = null; } r.paused = true; Loading Loading @@ -2526,6 +2525,7 @@ public final class ActivityThread { if (a != null) { r.createdConfig = new Configuration(mConfiguration); Bundle oldState = r.state; handleResumeActivity(r.token, false, r.isForward); if (!r.activity.mFinished && r.startsNotResumed) { Loading @@ -2541,6 +2541,9 @@ public final class ActivityThread { try { r.activity.mCalled = false; mInstrumentation.callActivityOnPause(r.activity); // We need to keep around the original state, in case // we need to be created again. r.state = oldState; if (!r.activity.mCalled) { throw new SuperNotCalledException( "Activity " + r.intent.getComponent().toShortString() + Loading core/java/com/android/internal/os/BatteryStatsImpl.java +21 −3 Original line number Diff line number Diff line Loading @@ -59,6 +59,13 @@ public final class BatteryStatsImpl extends BatteryStats { // Current on-disk Parcel version private static final int VERSION = 42; // The maximum number of names wakelocks we will keep track of // per uid; once the limit is reached, we batch the remaining wakelocks // in to one common name. private static final int MAX_WAKELOCKS_PER_UID = 20; private static final String BATCHED_WAKELOCK_NAME = "*overflow*"; private static int sNumSpeedSteps; private final File mFile; Loading Loading @@ -1757,8 +1764,13 @@ public final class BatteryStatsImpl extends BatteryStats { String wakelockName = in.readString(); Uid.Wakelock wakelock = new Wakelock(); wakelock.readFromParcelLocked(unpluggables, in); if (mWakelockStats.size() < MAX_WAKELOCKS_PER_UID) { // We will just drop some random set of wakelocks if // the previous run of the system was an older version // that didn't impose a limit. mWakelockStats.put(wakelockName, wakelock); } } int numSensors = in.readInt(); mSensorStats.clear(); Loading Loading @@ -2582,10 +2594,16 @@ public final class BatteryStatsImpl extends BatteryStats { public StopwatchTimer getWakeTimerLocked(String name, int type) { Wakelock wl = mWakelockStats.get(name); if (wl == null) { if (mWakelockStats.size() > MAX_WAKELOCKS_PER_UID) { name = BATCHED_WAKELOCK_NAME; wl = mWakelockStats.get(name); } if (wl == null) { wl = new Wakelock(); mWakelockStats.put(name, wl); } } StopwatchTimer t = null; switch (type) { case WAKE_TYPE_PARTIAL: Loading services/java/com/android/server/PackageManagerService.java +15 −3 Original line number Diff line number Diff line Loading @@ -5704,6 +5704,18 @@ class PackageManagerService extends IPackageManager.Stub { // remove permissions associated with package mSettings.updateSharedUserPermsLP(deletedPs, mGlobalGids); } if (deletedPs != null) { // remove from preferred activities. ArrayList<PreferredActivity> removed = new ArrayList<PreferredActivity>(); for (PreferredActivity pa : mSettings.mPreferredActivities.filterSet()) { if (pa.mActivity.getPackageName().equals(deletedPs.name)) { removed.add(pa); } } for (PreferredActivity pa : removed) { mSettings.mPreferredActivities.removeFilter(pa); } } // Save settings now mSettings.writeLP(); } Loading Loading @@ -7461,9 +7473,9 @@ class PackageManagerService extends IPackageManager.Stub { Log.w(TAG, "Trying to update system app code path from " + p.codePathString + " to " + codePath.toString()); } else { // Let the app continue with previous uid if code path changes. reportSettingsProblem(Log.WARN, "Package " + name + " codePath changed from " + p.codePath // Just a change in the code path is not an issue, but // let's log a message about it. Log.i(TAG, "Package " + name + " codePath changed from " + p.codePath + " to " + codePath + "; Retaining data and using new"); } } Loading services/java/com/android/server/am/ActivityManagerService.java +35 −10 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_PROCESSES = localLOGV || false; static final boolean DEBUG_PROVIDER = localLOGV || false; static final boolean DEBUG_URI_PERMISSION = localLOGV || false; static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_RESULTS = localLOGV || false; static final boolean DEBUG_BACKUP = localLOGV || false; Loading Loading @@ -968,6 +969,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen static final int PROC_START_TIMEOUT_MSG = 20; static final int DO_PENDING_ACTIVITY_LAUNCHES_MSG = 21; static final int KILL_APPLICATION_MSG = 22; static final int FINALIZE_PENDING_INTENT_MSG = 23; AlertDialog mUidAlert; Loading Loading @@ -1189,6 +1191,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen forceStopPackageLocked(pkg, uid, restart, false, true); } } break; case FINALIZE_PENDING_INTENT_MSG: { ((PendingIntentRecord)msg.obj).completeFinalize(); } break; } } }; Loading Loading @@ -3599,10 +3604,18 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } synchronized(this) { int callingPid; int callingUid; if (caller == null) { callingPid = Binder.getCallingPid(); callingUid = Binder.getCallingUid(); } else { callingPid = callingUid = -1; } final long origId = Binder.clearCallingIdentity(); int res = startActivityLocked(caller, intent, resolvedType, grantedUriPermissions, grantedMode, aInfo, resultTo, resultWho, requestCode, -1, -1, resultTo, resultWho, requestCode, callingPid, callingUid, onlyIfNeeded, componentSpecified); Binder.restoreCallingIdentity(origId); return res; Loading Loading @@ -6166,10 +6179,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen return; } if (DEBUG_URI_PERMISSION) Log.v(TAG, "Requested grant " + targetPkg + " permission to " + uri); final IPackageManager pm = ActivityThread.getPackageManager(); // If this is not a content: uri, we can't do anything with it. if (!ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) { if (DEBUG_URI_PERMISSION) Log.v(TAG, "Can't grant URI permission for non-content URI: " + uri); return; } Loading @@ -6195,6 +6213,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen try { targetUid = pm.getPackageUid(targetPkg); if (targetUid < 0) { if (DEBUG_URI_PERMISSION) Log.v(TAG, "Can't grant URI permission no uid for: " + targetPkg); return; } } catch (RemoteException ex) { Loading @@ -6204,17 +6224,12 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // First... does the target actually need this permission? if (checkHoldingPermissionsLocked(pm, pi, targetUid, modeFlags)) { // No need to grant the target this permission. if (DEBUG_URI_PERMISSION) Log.v(TAG, "Target " + targetPkg + " already has full permission to " + uri); return; } // Second... maybe someone else has already granted the // permission? if (checkUriPermissionLocked(uri, targetUid, modeFlags)) { // No need to grant the target this permission. return; } // Third... is the provider allowing granting of URI permissions? // Second... is the provider allowing granting of URI permissions? if (!pi.grantUriPermissions) { throw new SecurityException("Provider " + pi.packageName + "/" + pi.name Loading @@ -6239,7 +6254,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } // Fourth... does the caller itself have permission to access // Third... does the caller itself have permission to access // this uri? if (!checkHoldingPermissionsLocked(pm, pi, callingUid, modeFlags)) { if (!checkUriPermissionLocked(uri, callingUid, modeFlags)) { Loading @@ -6252,6 +6267,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // to the uri, and the target doesn't. Let's now give this to // the target. if (DEBUG_URI_PERMISSION) Log.v(TAG, "Granting " + targetPkg + " permission to " + uri); HashMap<Uri, UriPermission> targetUris = mGrantedUriPermissions.get(targetUid); if (targetUris == null) { Loading Loading @@ -6325,6 +6343,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen HashMap<Uri, UriPermission> perms = mGrantedUriPermissions.get(perm.uid); if (perms != null) { if (DEBUG_URI_PERMISSION) Log.v(TAG, "Removing " + perm.uid + " permission to " + perm.uri); perms.remove(perm.uri); if (perms.size() == 0) { mGrantedUriPermissions.remove(perm.uid); Loading Loading @@ -6364,6 +6384,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen return; } if (DEBUG_URI_PERMISSION) Log.v(TAG, "Revoking all granted permissions to " + uri); final IPackageManager pm = ActivityThread.getPackageManager(); final String authority = uri.getAuthority(); Loading Loading @@ -6422,6 +6445,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen continue toploop; } } if (DEBUG_URI_PERMISSION) Log.v(TAG, "Revoking " + perm.uid + " permission to " + perm.uri); perm.clearModes(modeFlags); if (perm.modeFlags == 0) { it.remove(); Loading services/java/com/android/server/am/PendingIntentRecord.java +16 −7 Original line number Diff line number Diff line Loading @@ -262,7 +262,17 @@ class PendingIntentRecord extends IIntentSender.Stub { } protected void finalize() throws Throwable { try { if (!canceled) { owner.mHandler.sendMessage(owner.mHandler.obtainMessage( ActivityManagerService.FINALIZE_PENDING_INTENT_MSG, this)); } } finally { super.finalize(); } } public void completeFinalize() { synchronized(owner) { WeakReference<PendingIntentRecord> current = owner.mIntentSenderRecords.get(key); Loading @@ -271,7 +281,6 @@ class PendingIntentRecord extends IIntentSender.Stub { } } } } void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("uid="); pw.print(uid); Loading Loading
core/java/android/app/ActivityThread.java +4 −1 Original line number Diff line number Diff line Loading @@ -2495,7 +2495,6 @@ public final class ActivityThread { " did not call through to super.onPostCreate()"); } } r.state = null; } r.paused = true; Loading Loading @@ -2526,6 +2525,7 @@ public final class ActivityThread { if (a != null) { r.createdConfig = new Configuration(mConfiguration); Bundle oldState = r.state; handleResumeActivity(r.token, false, r.isForward); if (!r.activity.mFinished && r.startsNotResumed) { Loading @@ -2541,6 +2541,9 @@ public final class ActivityThread { try { r.activity.mCalled = false; mInstrumentation.callActivityOnPause(r.activity); // We need to keep around the original state, in case // we need to be created again. r.state = oldState; if (!r.activity.mCalled) { throw new SuperNotCalledException( "Activity " + r.intent.getComponent().toShortString() + Loading
core/java/com/android/internal/os/BatteryStatsImpl.java +21 −3 Original line number Diff line number Diff line Loading @@ -59,6 +59,13 @@ public final class BatteryStatsImpl extends BatteryStats { // Current on-disk Parcel version private static final int VERSION = 42; // The maximum number of names wakelocks we will keep track of // per uid; once the limit is reached, we batch the remaining wakelocks // in to one common name. private static final int MAX_WAKELOCKS_PER_UID = 20; private static final String BATCHED_WAKELOCK_NAME = "*overflow*"; private static int sNumSpeedSteps; private final File mFile; Loading Loading @@ -1757,8 +1764,13 @@ public final class BatteryStatsImpl extends BatteryStats { String wakelockName = in.readString(); Uid.Wakelock wakelock = new Wakelock(); wakelock.readFromParcelLocked(unpluggables, in); if (mWakelockStats.size() < MAX_WAKELOCKS_PER_UID) { // We will just drop some random set of wakelocks if // the previous run of the system was an older version // that didn't impose a limit. mWakelockStats.put(wakelockName, wakelock); } } int numSensors = in.readInt(); mSensorStats.clear(); Loading Loading @@ -2582,10 +2594,16 @@ public final class BatteryStatsImpl extends BatteryStats { public StopwatchTimer getWakeTimerLocked(String name, int type) { Wakelock wl = mWakelockStats.get(name); if (wl == null) { if (mWakelockStats.size() > MAX_WAKELOCKS_PER_UID) { name = BATCHED_WAKELOCK_NAME; wl = mWakelockStats.get(name); } if (wl == null) { wl = new Wakelock(); mWakelockStats.put(name, wl); } } StopwatchTimer t = null; switch (type) { case WAKE_TYPE_PARTIAL: Loading
services/java/com/android/server/PackageManagerService.java +15 −3 Original line number Diff line number Diff line Loading @@ -5704,6 +5704,18 @@ class PackageManagerService extends IPackageManager.Stub { // remove permissions associated with package mSettings.updateSharedUserPermsLP(deletedPs, mGlobalGids); } if (deletedPs != null) { // remove from preferred activities. ArrayList<PreferredActivity> removed = new ArrayList<PreferredActivity>(); for (PreferredActivity pa : mSettings.mPreferredActivities.filterSet()) { if (pa.mActivity.getPackageName().equals(deletedPs.name)) { removed.add(pa); } } for (PreferredActivity pa : removed) { mSettings.mPreferredActivities.removeFilter(pa); } } // Save settings now mSettings.writeLP(); } Loading Loading @@ -7461,9 +7473,9 @@ class PackageManagerService extends IPackageManager.Stub { Log.w(TAG, "Trying to update system app code path from " + p.codePathString + " to " + codePath.toString()); } else { // Let the app continue with previous uid if code path changes. reportSettingsProblem(Log.WARN, "Package " + name + " codePath changed from " + p.codePath // Just a change in the code path is not an issue, but // let's log a message about it. Log.i(TAG, "Package " + name + " codePath changed from " + p.codePath + " to " + codePath + "; Retaining data and using new"); } } Loading
services/java/com/android/server/am/ActivityManagerService.java +35 −10 Original line number Diff line number Diff line Loading @@ -135,6 +135,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_PROCESSES = localLOGV || false; static final boolean DEBUG_PROVIDER = localLOGV || false; static final boolean DEBUG_URI_PERMISSION = localLOGV || false; static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_RESULTS = localLOGV || false; static final boolean DEBUG_BACKUP = localLOGV || false; Loading Loading @@ -968,6 +969,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen static final int PROC_START_TIMEOUT_MSG = 20; static final int DO_PENDING_ACTIVITY_LAUNCHES_MSG = 21; static final int KILL_APPLICATION_MSG = 22; static final int FINALIZE_PENDING_INTENT_MSG = 23; AlertDialog mUidAlert; Loading Loading @@ -1189,6 +1191,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen forceStopPackageLocked(pkg, uid, restart, false, true); } } break; case FINALIZE_PENDING_INTENT_MSG: { ((PendingIntentRecord)msg.obj).completeFinalize(); } break; } } }; Loading Loading @@ -3599,10 +3604,18 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } synchronized(this) { int callingPid; int callingUid; if (caller == null) { callingPid = Binder.getCallingPid(); callingUid = Binder.getCallingUid(); } else { callingPid = callingUid = -1; } final long origId = Binder.clearCallingIdentity(); int res = startActivityLocked(caller, intent, resolvedType, grantedUriPermissions, grantedMode, aInfo, resultTo, resultWho, requestCode, -1, -1, resultTo, resultWho, requestCode, callingPid, callingUid, onlyIfNeeded, componentSpecified); Binder.restoreCallingIdentity(origId); return res; Loading Loading @@ -6166,10 +6179,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen return; } if (DEBUG_URI_PERMISSION) Log.v(TAG, "Requested grant " + targetPkg + " permission to " + uri); final IPackageManager pm = ActivityThread.getPackageManager(); // If this is not a content: uri, we can't do anything with it. if (!ContentResolver.SCHEME_CONTENT.equals(uri.getScheme())) { if (DEBUG_URI_PERMISSION) Log.v(TAG, "Can't grant URI permission for non-content URI: " + uri); return; } Loading @@ -6195,6 +6213,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen try { targetUid = pm.getPackageUid(targetPkg); if (targetUid < 0) { if (DEBUG_URI_PERMISSION) Log.v(TAG, "Can't grant URI permission no uid for: " + targetPkg); return; } } catch (RemoteException ex) { Loading @@ -6204,17 +6224,12 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // First... does the target actually need this permission? if (checkHoldingPermissionsLocked(pm, pi, targetUid, modeFlags)) { // No need to grant the target this permission. if (DEBUG_URI_PERMISSION) Log.v(TAG, "Target " + targetPkg + " already has full permission to " + uri); return; } // Second... maybe someone else has already granted the // permission? if (checkUriPermissionLocked(uri, targetUid, modeFlags)) { // No need to grant the target this permission. return; } // Third... is the provider allowing granting of URI permissions? // Second... is the provider allowing granting of URI permissions? if (!pi.grantUriPermissions) { throw new SecurityException("Provider " + pi.packageName + "/" + pi.name Loading @@ -6239,7 +6254,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } // Fourth... does the caller itself have permission to access // Third... does the caller itself have permission to access // this uri? if (!checkHoldingPermissionsLocked(pm, pi, callingUid, modeFlags)) { if (!checkUriPermissionLocked(uri, callingUid, modeFlags)) { Loading @@ -6252,6 +6267,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // to the uri, and the target doesn't. Let's now give this to // the target. if (DEBUG_URI_PERMISSION) Log.v(TAG, "Granting " + targetPkg + " permission to " + uri); HashMap<Uri, UriPermission> targetUris = mGrantedUriPermissions.get(targetUid); if (targetUris == null) { Loading Loading @@ -6325,6 +6343,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen HashMap<Uri, UriPermission> perms = mGrantedUriPermissions.get(perm.uid); if (perms != null) { if (DEBUG_URI_PERMISSION) Log.v(TAG, "Removing " + perm.uid + " permission to " + perm.uri); perms.remove(perm.uri); if (perms.size() == 0) { mGrantedUriPermissions.remove(perm.uid); Loading Loading @@ -6364,6 +6384,9 @@ public final class ActivityManagerService extends ActivityManagerNative implemen return; } if (DEBUG_URI_PERMISSION) Log.v(TAG, "Revoking all granted permissions to " + uri); final IPackageManager pm = ActivityThread.getPackageManager(); final String authority = uri.getAuthority(); Loading Loading @@ -6422,6 +6445,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen continue toploop; } } if (DEBUG_URI_PERMISSION) Log.v(TAG, "Revoking " + perm.uid + " permission to " + perm.uri); perm.clearModes(modeFlags); if (perm.modeFlags == 0) { it.remove(); Loading
services/java/com/android/server/am/PendingIntentRecord.java +16 −7 Original line number Diff line number Diff line Loading @@ -262,7 +262,17 @@ class PendingIntentRecord extends IIntentSender.Stub { } protected void finalize() throws Throwable { try { if (!canceled) { owner.mHandler.sendMessage(owner.mHandler.obtainMessage( ActivityManagerService.FINALIZE_PENDING_INTENT_MSG, this)); } } finally { super.finalize(); } } public void completeFinalize() { synchronized(owner) { WeakReference<PendingIntentRecord> current = owner.mIntentSenderRecords.get(key); Loading @@ -271,7 +281,6 @@ class PendingIntentRecord extends IIntentSender.Stub { } } } } void dump(PrintWriter pw, String prefix) { pw.print(prefix); pw.print("uid="); pw.print(uid); Loading