Loading services/core/java/com/android/server/am/ActiveServices.java +15 −11 Original line number Diff line number Diff line Loading @@ -602,7 +602,7 @@ public final class ActiveServices { try { final ServiceRecord.StartItem si = r.pendingStarts.get(0); startServiceInnerLocked(this, si.intent, r, false, true, si.callingId, si.mCallingProcessName, r.startRequested); si.mCallingProcessName, r.startRequested, si.mCallingPackageName); } catch (TransactionTooLargeException e) { // Ignore, nobody upstack cares. } Loading Loading @@ -969,7 +969,7 @@ public final class ActiveServices { startServiceInnerLocked(r, service, callingUid, callingPid, getCallingProcessNameLocked(callingUid, callingPid, callingPackage), fgRequired, callerFg, backgroundStartPrivileges); backgroundStartPrivileges, callingPackage); if (res.aliasComponent != null && !realResult.getPackageName().startsWith("!") && !realResult.getPackageName().startsWith("?")) { Loading @@ -990,7 +990,7 @@ public final class ActiveServices { private ComponentName startServiceInnerLocked(ServiceRecord r, Intent service, int callingUid, int callingPid, String callingProcessName, boolean fgRequired, boolean callerFg, BackgroundStartPrivileges backgroundStartPrivileges) BackgroundStartPrivileges backgroundStartPrivileges, String callingPackage) throws TransactionTooLargeException { NeededUriGrants neededGrants = mAm.mUgmInternal.checkGrantUriPermissionFromIntent( service, callingUid, r.packageName, r.userId); Loading @@ -1003,7 +1003,7 @@ public final class ActiveServices { r.delayedStop = false; r.fgRequired = fgRequired; r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(), service, neededGrants, callingUid, callingProcessName)); service, neededGrants, callingUid, callingProcessName, callingPackage)); if (fgRequired) { // We are now effectively running a foreground service. Loading Loading @@ -1088,7 +1088,7 @@ public final class ActiveServices { r.allowBgActivityStartsOnServiceStart(backgroundStartPrivileges); } ComponentName cmp = startServiceInnerLocked(smap, service, r, callerFg, addToStarting, callingUid, callingProcessName, wasStartRequested); callingUid, callingProcessName, wasStartRequested, callingPackage); return cmp; } Loading Loading @@ -1241,7 +1241,7 @@ public final class ActiveServices { try { startServiceInnerLocked(s, serviceIntent, callingUid, callingPid, callingProcessName, fgRequired, callerFg, backgroundStartPrivileges); backgroundStartPrivileges, callingPackage); } catch (TransactionTooLargeException e) { /* ignore - local call */ } Loading Loading @@ -1287,7 +1287,7 @@ public final class ActiveServices { ComponentName startServiceInnerLocked(ServiceMap smap, Intent service, ServiceRecord r, boolean callerFg, boolean addToStarting, int callingUid, String callingProcessName, boolean wasStartRequested) throws TransactionTooLargeException { boolean wasStartRequested, String callingPackage) throws TransactionTooLargeException { synchronized (mAm.mProcessStats.mLock) { final ServiceState stracker = r.getTracker(); if (stracker != null) { Loading Loading @@ -1328,7 +1328,9 @@ public final class ActiveServices { : SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM), getShortProcessNameForStats(callingUid, callingProcessName), getShortServiceNameForStats(r), packageState); packageState, packageName, callingPackage); if (r.startRequested && addToStarting) { boolean first = smap.mStartingBackground.size() == 0; Loading Loading @@ -3661,7 +3663,9 @@ public final class ActiveServices { : SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM), getShortProcessNameForStats(callingUid, callerApp.processName), getShortServiceNameForStats(s), packageState); packageState, s.packageName, callerApp.info.packageName); if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Bind " + s + " with " + b + ": received=" + b.intent.received Loading Loading @@ -5253,7 +5257,7 @@ public final class ActiveServices { // be called. if (r.startRequested && r.callStart && r.pendingStarts.size() == 0) { r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(), null, null, 0, null)); null, null, 0, null, null)); } sendServiceArgsLocked(r, execInFg, true); Loading Loading @@ -6247,7 +6251,7 @@ public final class ActiveServices { stopServiceLocked(sr, true); } else { sr.pendingStarts.add(new ServiceRecord.StartItem(sr, true, sr.getLastStartId(), baseIntent, null, 0, null)); sr.getLastStartId(), baseIntent, null, 0, null, null)); if (sr.app != null && sr.app.getThread() != null) { // We always run in the foreground, since this is called as // part of the "remove task" UI operation. Loading services/core/java/com/android/server/am/BroadcastQueueImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -601,7 +601,9 @@ public class BroadcastQueueImpl extends BroadcastQueue { r.dispatchTime - r.enqueueTime, r.receiverTime - r.dispatchTime, finishTime - r.receiverTime, packageState); packageState, r.curApp.info.packageName, r.callerPackage); } if (state == BroadcastRecord.IDLE) { Slog.w(TAG_BROADCAST, "finishReceiver [" + mQueueName + "] called but state is IDLE"); Loading Loading @@ -780,7 +782,8 @@ public class BroadcastQueueImpl extends BroadcastQueue { BROADCAST_DELIVERY_EVENT_REPORTED__RECEIVER_TYPE__RUNTIME, BROADCAST_DELIVERY_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, dispatchDelay, receiveDelay, 0 /* finish_delay */, SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, app != null ? app.info.packageName : null, callingPackage); } } Loading services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +8 −5 Original line number Diff line number Diff line Loading @@ -1122,7 +1122,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { } r.terminalCount++; notifyFinishReceiver(queue, r, index, receiver); notifyFinishReceiver(queue, app, r, index, receiver); checkFinished = true; } // When entire ordered broadcast finished, deliver final result Loading Loading @@ -1595,9 +1595,10 @@ class BroadcastQueueModernImpl extends BroadcastQueue { * typically for internal bookkeeping. */ private void notifyFinishReceiver(@Nullable BroadcastProcessQueue queue, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { @Nullable ProcessRecord app, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { if (r.wasDeliveryAttempted(index)) { logBroadcastDeliveryEventReported(queue, r, index, receiver); logBroadcastDeliveryEventReported(queue, app, r, index, receiver); } final boolean recordFinished = (r.terminalCount == r.receivers.size()); Loading @@ -1607,7 +1608,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue { } private void logBroadcastDeliveryEventReported(@Nullable BroadcastProcessQueue queue, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { @Nullable ProcessRecord app, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { // Report statistics for each individual receiver final int uid = getReceiverUid(receiver); final int senderUid = (r.callingUid == -1) ? Process.SYSTEM_UID : r.callingUid; Loading @@ -1633,7 +1635,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue { ? SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_STOPPED : SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL; FrameworkStatsLog.write(BROADCAST_DELIVERY_EVENT_REPORTED, uid, senderUid, actionName, receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState); receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState, app != null ? app.info.packageName : null, r.callerPackage); } } Loading services/core/java/com/android/server/am/ContentProviderHelper.java +7 −4 Original line number Diff line number Diff line Loading @@ -263,7 +263,8 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, r.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, cpi.packageName, callingPackage); return holder; } Loading Loading @@ -334,7 +335,8 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, cpr.proc.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, cpi.packageName, callingPackage); } } finally { Binder.restoreCallingIdentity(origId); Loading Loading @@ -511,7 +513,8 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, proc.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, cpi.packageName, callingPackage); } else { final int packageState = ((cpr.appInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) Loading @@ -536,7 +539,7 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, proc.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_COLD, packageState); packageState, cpi.packageName, callingPackage); } cpr.launchingApp = proc; mLaunchingProviders.add(cpr); Loading services/core/java/com/android/server/am/ServiceRecord.java +3 −1 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN final String mCallingProcessName; final Intent intent; final NeededUriGrants neededGrants; final @Nullable String mCallingPackageName; long deliveredTime; int deliveryCount; int doneExecutingCount; Loading @@ -258,7 +259,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN StartItem(ServiceRecord _sr, boolean _taskRemoved, int _id, Intent _intent, NeededUriGrants _neededGrants, int _callingId, String callingProcessName) { String callingProcessName, @Nullable String callingPackageName) { sr = _sr; taskRemoved = _taskRemoved; id = _id; Loading @@ -266,6 +267,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN neededGrants = _neededGrants; callingId = _callingId; mCallingProcessName = callingProcessName; mCallingPackageName = callingPackageName; } UriPermissionOwner getUriPermissionsLocked() { Loading Loading
services/core/java/com/android/server/am/ActiveServices.java +15 −11 Original line number Diff line number Diff line Loading @@ -602,7 +602,7 @@ public final class ActiveServices { try { final ServiceRecord.StartItem si = r.pendingStarts.get(0); startServiceInnerLocked(this, si.intent, r, false, true, si.callingId, si.mCallingProcessName, r.startRequested); si.mCallingProcessName, r.startRequested, si.mCallingPackageName); } catch (TransactionTooLargeException e) { // Ignore, nobody upstack cares. } Loading Loading @@ -969,7 +969,7 @@ public final class ActiveServices { startServiceInnerLocked(r, service, callingUid, callingPid, getCallingProcessNameLocked(callingUid, callingPid, callingPackage), fgRequired, callerFg, backgroundStartPrivileges); backgroundStartPrivileges, callingPackage); if (res.aliasComponent != null && !realResult.getPackageName().startsWith("!") && !realResult.getPackageName().startsWith("?")) { Loading @@ -990,7 +990,7 @@ public final class ActiveServices { private ComponentName startServiceInnerLocked(ServiceRecord r, Intent service, int callingUid, int callingPid, String callingProcessName, boolean fgRequired, boolean callerFg, BackgroundStartPrivileges backgroundStartPrivileges) BackgroundStartPrivileges backgroundStartPrivileges, String callingPackage) throws TransactionTooLargeException { NeededUriGrants neededGrants = mAm.mUgmInternal.checkGrantUriPermissionFromIntent( service, callingUid, r.packageName, r.userId); Loading @@ -1003,7 +1003,7 @@ public final class ActiveServices { r.delayedStop = false; r.fgRequired = fgRequired; r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(), service, neededGrants, callingUid, callingProcessName)); service, neededGrants, callingUid, callingProcessName, callingPackage)); if (fgRequired) { // We are now effectively running a foreground service. Loading Loading @@ -1088,7 +1088,7 @@ public final class ActiveServices { r.allowBgActivityStartsOnServiceStart(backgroundStartPrivileges); } ComponentName cmp = startServiceInnerLocked(smap, service, r, callerFg, addToStarting, callingUid, callingProcessName, wasStartRequested); callingUid, callingProcessName, wasStartRequested, callingPackage); return cmp; } Loading Loading @@ -1241,7 +1241,7 @@ public final class ActiveServices { try { startServiceInnerLocked(s, serviceIntent, callingUid, callingPid, callingProcessName, fgRequired, callerFg, backgroundStartPrivileges); backgroundStartPrivileges, callingPackage); } catch (TransactionTooLargeException e) { /* ignore - local call */ } Loading Loading @@ -1287,7 +1287,7 @@ public final class ActiveServices { ComponentName startServiceInnerLocked(ServiceMap smap, Intent service, ServiceRecord r, boolean callerFg, boolean addToStarting, int callingUid, String callingProcessName, boolean wasStartRequested) throws TransactionTooLargeException { boolean wasStartRequested, String callingPackage) throws TransactionTooLargeException { synchronized (mAm.mProcessStats.mLock) { final ServiceState stracker = r.getTracker(); if (stracker != null) { Loading Loading @@ -1328,7 +1328,9 @@ public final class ActiveServices { : SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM), getShortProcessNameForStats(callingUid, callingProcessName), getShortServiceNameForStats(r), packageState); packageState, packageName, callingPackage); if (r.startRequested && addToStarting) { boolean first = smap.mStartingBackground.size() == 0; Loading Loading @@ -3661,7 +3663,9 @@ public final class ActiveServices { : SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM), getShortProcessNameForStats(callingUid, callerApp.processName), getShortServiceNameForStats(s), packageState); packageState, s.packageName, callerApp.info.packageName); if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Bind " + s + " with " + b + ": received=" + b.intent.received Loading Loading @@ -5253,7 +5257,7 @@ public final class ActiveServices { // be called. if (r.startRequested && r.callStart && r.pendingStarts.size() == 0) { r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(), null, null, 0, null)); null, null, 0, null, null)); } sendServiceArgsLocked(r, execInFg, true); Loading Loading @@ -6247,7 +6251,7 @@ public final class ActiveServices { stopServiceLocked(sr, true); } else { sr.pendingStarts.add(new ServiceRecord.StartItem(sr, true, sr.getLastStartId(), baseIntent, null, 0, null)); sr.getLastStartId(), baseIntent, null, 0, null, null)); if (sr.app != null && sr.app.getThread() != null) { // We always run in the foreground, since this is called as // part of the "remove task" UI operation. Loading
services/core/java/com/android/server/am/BroadcastQueueImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -601,7 +601,9 @@ public class BroadcastQueueImpl extends BroadcastQueue { r.dispatchTime - r.enqueueTime, r.receiverTime - r.dispatchTime, finishTime - r.receiverTime, packageState); packageState, r.curApp.info.packageName, r.callerPackage); } if (state == BroadcastRecord.IDLE) { Slog.w(TAG_BROADCAST, "finishReceiver [" + mQueueName + "] called but state is IDLE"); Loading Loading @@ -780,7 +782,8 @@ public class BroadcastQueueImpl extends BroadcastQueue { BROADCAST_DELIVERY_EVENT_REPORTED__RECEIVER_TYPE__RUNTIME, BROADCAST_DELIVERY_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, dispatchDelay, receiveDelay, 0 /* finish_delay */, SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, app != null ? app.info.packageName : null, callingPackage); } } Loading
services/core/java/com/android/server/am/BroadcastQueueModernImpl.java +8 −5 Original line number Diff line number Diff line Loading @@ -1122,7 +1122,7 @@ class BroadcastQueueModernImpl extends BroadcastQueue { } r.terminalCount++; notifyFinishReceiver(queue, r, index, receiver); notifyFinishReceiver(queue, app, r, index, receiver); checkFinished = true; } // When entire ordered broadcast finished, deliver final result Loading Loading @@ -1595,9 +1595,10 @@ class BroadcastQueueModernImpl extends BroadcastQueue { * typically for internal bookkeeping. */ private void notifyFinishReceiver(@Nullable BroadcastProcessQueue queue, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { @Nullable ProcessRecord app, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { if (r.wasDeliveryAttempted(index)) { logBroadcastDeliveryEventReported(queue, r, index, receiver); logBroadcastDeliveryEventReported(queue, app, r, index, receiver); } final boolean recordFinished = (r.terminalCount == r.receivers.size()); Loading @@ -1607,7 +1608,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue { } private void logBroadcastDeliveryEventReported(@Nullable BroadcastProcessQueue queue, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { @Nullable ProcessRecord app, @NonNull BroadcastRecord r, int index, @NonNull Object receiver) { // Report statistics for each individual receiver final int uid = getReceiverUid(receiver); final int senderUid = (r.callingUid == -1) ? Process.SYSTEM_UID : r.callingUid; Loading @@ -1633,7 +1635,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue { ? SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_STOPPED : SERVICE_REQUEST_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL; FrameworkStatsLog.write(BROADCAST_DELIVERY_EVENT_REPORTED, uid, senderUid, actionName, receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState); receiverType, type, dispatchDelay, receiveDelay, finishDelay, packageState, app != null ? app.info.packageName : null, r.callerPackage); } } Loading
services/core/java/com/android/server/am/ContentProviderHelper.java +7 −4 Original line number Diff line number Diff line Loading @@ -263,7 +263,8 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, r.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, cpi.packageName, callingPackage); return holder; } Loading Loading @@ -334,7 +335,8 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, cpr.proc.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, cpi.packageName, callingPackage); } } finally { Binder.restoreCallingIdentity(origId); Loading Loading @@ -511,7 +513,8 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, proc.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM, PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL); PROVIDER_ACQUISITION_EVENT_REPORTED__PACKAGE_STOPPED_STATE__PACKAGE_STATE_NORMAL, cpi.packageName, callingPackage); } else { final int packageState = ((cpr.appInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) Loading @@ -536,7 +539,7 @@ public class ContentProviderHelper { PROVIDER_ACQUISITION_EVENT_REPORTED, proc.uid, callingUid, PROVIDER_ACQUISITION_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_COLD, packageState); packageState, cpi.packageName, callingPackage); } cpr.launchingApp = proc; mLaunchingProviders.add(cpr); Loading
services/core/java/com/android/server/am/ServiceRecord.java +3 −1 Original line number Diff line number Diff line Loading @@ -249,6 +249,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN final String mCallingProcessName; final Intent intent; final NeededUriGrants neededGrants; final @Nullable String mCallingPackageName; long deliveredTime; int deliveryCount; int doneExecutingCount; Loading @@ -258,7 +259,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN StartItem(ServiceRecord _sr, boolean _taskRemoved, int _id, Intent _intent, NeededUriGrants _neededGrants, int _callingId, String callingProcessName) { String callingProcessName, @Nullable String callingPackageName) { sr = _sr; taskRemoved = _taskRemoved; id = _id; Loading @@ -266,6 +267,7 @@ final class ServiceRecord extends Binder implements ComponentName.WithComponentN neededGrants = _neededGrants; callingId = _callingId; mCallingProcessName = callingProcessName; mCallingPackageName = callingPackageName; } UriPermissionOwner getUriPermissionsLocked() { Loading