Loading services/core/java/com/android/server/am/ActiveServices.java +46 −2 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; import android.os.TransactionTooLargeException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -3163,8 +3164,20 @@ public final class ActiveServices { return false; } final int callingPid = Binder.getCallingPid(); final long origId = Binder.clearCallingIdentity(); try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { String info; if (clist.size() > 0) { final ConnectionRecord r = clist.get(0); info = r.binding.service.shortInstanceName + " from " + r.clientProcessName; } else { info = Integer.toString(callingPid); } Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "unbindServiceLocked: " + info); } while (clist.size() > 0) { ConnectionRecord r = clist.get(0); removeConnectionLocked(r, null, null, true); Loading Loading @@ -3192,6 +3205,7 @@ public final class ActiveServices { mAm.updateOomAdjPendingTargetsLocked(OomAdjuster.OOM_ADJ_REASON_UNBIND_SERVICE); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Binder.restoreCallingIdentity(origId); } Loading Loading @@ -4155,6 +4169,22 @@ public final class ActiveServices { boolean whileRestarting, boolean permissionsReviewRequired, boolean packageFrozen, boolean enqueueOomAdj) throws TransactionTooLargeException { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "bringUpServiceLocked: " + r.shortInstanceName); } return bringUpServiceInnerLocked(r, intentFlags, execInFg, whileRestarting, permissionsReviewRequired, packageFrozen, enqueueOomAdj); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } private String bringUpServiceInnerLocked(ServiceRecord r, int intentFlags, boolean execInFg, boolean whileRestarting, boolean permissionsReviewRequired, boolean packageFrozen, boolean enqueueOomAdj) throws TransactionTooLargeException { if (r.app != null && r.app.getThread() != null) { sendServiceArgsLocked(r, execInFg, false); return null; Loading Loading @@ -4229,6 +4259,10 @@ public final class ActiveServices { final UidRecord uidRecord = app.getUidRecord(); if (thread != null) { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "realStartServiceLocked: " + r.shortInstanceName); } app.addPackage(r.appInfo.packageName, r.appInfo.longVersionCode, mAm.mProcessStats); realStartServiceLocked(r, app, thread, pid, uidRecord, execInFg, Loading @@ -4238,6 +4272,8 @@ public final class ActiveServices { throw e; } catch (RemoteException e) { Slog.w(TAG, "Exception when starting service " + r.shortInstanceName, e); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } // If a dead object exception was thrown -- fall through to Loading Loading @@ -5115,8 +5151,16 @@ public final class ActiveServices { i--; proc.addPackage(sr.appInfo.packageName, sr.appInfo.longVersionCode, mAm.mProcessStats); try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "realStartServiceLocked: " + sr.shortInstanceName); } realStartServiceLocked(sr, proc, thread, pid, uidRecord, sr.createdFromFg, true); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } didSomething = true; if (!isServiceNeededLocked(sr, false, false)) { // We were waiting for this service to start, but it is actually no Loading services/core/java/com/android/server/am/ActivityManagerService.java +60 −23 Original line number Diff line number Diff line Loading @@ -12515,21 +12515,27 @@ public class ActivityManagerService extends IActivityManager.Stub if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "*** startService: " + service + " type=" + resolvedType + " fg=" + requireForeground); synchronized(this) { final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); ComponentName res; try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "startService: " + "intent=" + service + ", caller=" + callingPackage + ", fgRequired=" + requireForeground); } synchronized (this) { res = mServices.startServiceLocked(caller, service, resolvedType, callingPid, callingUid, requireForeground, callingPackage, callingFeatureId, userId); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Binder.restoreCallingIdentity(origId); } return res; } } @Override public int stopService(IApplicationThread caller, Intent service, Loading @@ -12540,9 +12546,16 @@ public class ActivityManagerService extends IActivityManager.Stub throw new IllegalArgumentException("File descriptors passed in Intent"); } try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "stopService: " + service); } synchronized (this) { return mServices.stopServiceLocked(caller, service, resolvedType, userId); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } @Override Loading @@ -12565,9 +12578,18 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public boolean stopServiceToken(ComponentName className, IBinder token, int startId) { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "stopServiceToken: " + (className != null ? className.toShortString() : ("from " + Binder.getCallingPid()))); } synchronized (this) { return mServices.stopServiceTokenLocked(className, token, startId); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } @Override Loading Loading @@ -12714,9 +12736,16 @@ public class ActivityManagerService extends IActivityManager.Stub } public boolean unbindService(IServiceConnection connection) { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "unbindService"); } synchronized (this) { return mServices.unbindServiceLocked(connection); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } public void publishService(IBinder token, Intent intent, IBinder service) { Loading Loading @@ -17042,22 +17071,30 @@ public class ActivityManagerService extends IActivityManager.Stub int userId, boolean allowBackgroundActivityStarts, @Nullable IBinder backgroundActivityStartsToken) throws TransactionTooLargeException { synchronized(ActivityManagerService.this) { if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, if (DEBUG_SERVICE) { Slog.v(TAG_SERVICE, "startServiceInPackage: " + service + " type=" + resolvedType); } final long origId = Binder.clearCallingIdentity(); ComponentName res; try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "startServiceInPackage: " + "intent=" + service + ", caller=" + callingPackage + ", fgRequired=" + fgRequired); } synchronized (ActivityManagerService.this) { res = mServices.startServiceLocked(null, service, resolvedType, -1, uid, fgRequired, callingPackage, callingFeatureId, userId, allowBackgroundActivityStarts, backgroundActivityStartsToken); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Binder.restoreCallingIdentity(origId); } return res; } } // The arguments here are untyped because the base ActivityManagerInternal class // doesn't have compile-time visibility into ActivityServiceConnectionHolder or Loading
services/core/java/com/android/server/am/ActiveServices.java +46 −2 Original line number Diff line number Diff line Loading @@ -140,6 +140,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; import android.os.TransactionTooLargeException; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -3163,8 +3164,20 @@ public final class ActiveServices { return false; } final int callingPid = Binder.getCallingPid(); final long origId = Binder.clearCallingIdentity(); try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { String info; if (clist.size() > 0) { final ConnectionRecord r = clist.get(0); info = r.binding.service.shortInstanceName + " from " + r.clientProcessName; } else { info = Integer.toString(callingPid); } Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "unbindServiceLocked: " + info); } while (clist.size() > 0) { ConnectionRecord r = clist.get(0); removeConnectionLocked(r, null, null, true); Loading Loading @@ -3192,6 +3205,7 @@ public final class ActiveServices { mAm.updateOomAdjPendingTargetsLocked(OomAdjuster.OOM_ADJ_REASON_UNBIND_SERVICE); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Binder.restoreCallingIdentity(origId); } Loading Loading @@ -4155,6 +4169,22 @@ public final class ActiveServices { boolean whileRestarting, boolean permissionsReviewRequired, boolean packageFrozen, boolean enqueueOomAdj) throws TransactionTooLargeException { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "bringUpServiceLocked: " + r.shortInstanceName); } return bringUpServiceInnerLocked(r, intentFlags, execInFg, whileRestarting, permissionsReviewRequired, packageFrozen, enqueueOomAdj); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } private String bringUpServiceInnerLocked(ServiceRecord r, int intentFlags, boolean execInFg, boolean whileRestarting, boolean permissionsReviewRequired, boolean packageFrozen, boolean enqueueOomAdj) throws TransactionTooLargeException { if (r.app != null && r.app.getThread() != null) { sendServiceArgsLocked(r, execInFg, false); return null; Loading Loading @@ -4229,6 +4259,10 @@ public final class ActiveServices { final UidRecord uidRecord = app.getUidRecord(); if (thread != null) { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "realStartServiceLocked: " + r.shortInstanceName); } app.addPackage(r.appInfo.packageName, r.appInfo.longVersionCode, mAm.mProcessStats); realStartServiceLocked(r, app, thread, pid, uidRecord, execInFg, Loading @@ -4238,6 +4272,8 @@ public final class ActiveServices { throw e; } catch (RemoteException e) { Slog.w(TAG, "Exception when starting service " + r.shortInstanceName, e); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } // If a dead object exception was thrown -- fall through to Loading Loading @@ -5115,8 +5151,16 @@ public final class ActiveServices { i--; proc.addPackage(sr.appInfo.packageName, sr.appInfo.longVersionCode, mAm.mProcessStats); try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "realStartServiceLocked: " + sr.shortInstanceName); } realStartServiceLocked(sr, proc, thread, pid, uidRecord, sr.createdFromFg, true); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } didSomething = true; if (!isServiceNeededLocked(sr, false, false)) { // We were waiting for this service to start, but it is actually no Loading
services/core/java/com/android/server/am/ActivityManagerService.java +60 −23 Original line number Diff line number Diff line Loading @@ -12515,21 +12515,27 @@ public class ActivityManagerService extends IActivityManager.Stub if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "*** startService: " + service + " type=" + resolvedType + " fg=" + requireForeground); synchronized(this) { final int callingPid = Binder.getCallingPid(); final int callingUid = Binder.getCallingUid(); final long origId = Binder.clearCallingIdentity(); ComponentName res; try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "startService: " + "intent=" + service + ", caller=" + callingPackage + ", fgRequired=" + requireForeground); } synchronized (this) { res = mServices.startServiceLocked(caller, service, resolvedType, callingPid, callingUid, requireForeground, callingPackage, callingFeatureId, userId); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Binder.restoreCallingIdentity(origId); } return res; } } @Override public int stopService(IApplicationThread caller, Intent service, Loading @@ -12540,9 +12546,16 @@ public class ActivityManagerService extends IActivityManager.Stub throw new IllegalArgumentException("File descriptors passed in Intent"); } try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "stopService: " + service); } synchronized (this) { return mServices.stopServiceLocked(caller, service, resolvedType, userId); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } @Override Loading @@ -12565,9 +12578,18 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public boolean stopServiceToken(ComponentName className, IBinder token, int startId) { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "stopServiceToken: " + (className != null ? className.toShortString() : ("from " + Binder.getCallingPid()))); } synchronized (this) { return mServices.stopServiceTokenLocked(className, token, startId); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } @Override Loading Loading @@ -12714,9 +12736,16 @@ public class ActivityManagerService extends IActivityManager.Stub } public boolean unbindService(IServiceConnection connection) { try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "unbindService"); } synchronized (this) { return mServices.unbindServiceLocked(connection); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } public void publishService(IBinder token, Intent intent, IBinder service) { Loading Loading @@ -17042,22 +17071,30 @@ public class ActivityManagerService extends IActivityManager.Stub int userId, boolean allowBackgroundActivityStarts, @Nullable IBinder backgroundActivityStartsToken) throws TransactionTooLargeException { synchronized(ActivityManagerService.this) { if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, if (DEBUG_SERVICE) { Slog.v(TAG_SERVICE, "startServiceInPackage: " + service + " type=" + resolvedType); } final long origId = Binder.clearCallingIdentity(); ComponentName res; try { if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "startServiceInPackage: " + "intent=" + service + ", caller=" + callingPackage + ", fgRequired=" + fgRequired); } synchronized (ActivityManagerService.this) { res = mServices.startServiceLocked(null, service, resolvedType, -1, uid, fgRequired, callingPackage, callingFeatureId, userId, allowBackgroundActivityStarts, backgroundActivityStartsToken); } } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); Binder.restoreCallingIdentity(origId); } return res; } } // The arguments here are untyped because the base ActivityManagerInternal class // doesn't have compile-time visibility into ActivityServiceConnectionHolder or