Loading apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java +33 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Message; import android.os.RemoteException; import android.util.Log; import com.android.internal.os.DebugStore; import com.android.internal.os.SomeArgs; import java.lang.ref.WeakReference; Loading Loading @@ -79,6 +80,9 @@ public abstract class JobServiceEngine { /** Message that the network to use has changed. */ private static final int MSG_INFORM_OF_NETWORK_CHANGE = 8; private static final boolean DEBUG_STORE_ENABLED = com.android.internal.os.Flags.debugStoreEnabled(); private final IJobService mBinder; /** Loading Loading @@ -125,6 +129,12 @@ public abstract class JobServiceEngine { JobServiceEngine service = mService.get(); if (service != null) { Message m = Message.obtain(service.mHandler, MSG_EXECUTE_JOB, jobParams); if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleStartJob( System.identityHashCode(m.obj), jobParams.getJobId(), jobParams.getJobNamespace()); } m.sendToTarget(); } } Loading @@ -144,6 +154,12 @@ public abstract class JobServiceEngine { JobServiceEngine service = mService.get(); if (service != null) { Message m = Message.obtain(service.mHandler, MSG_STOP_JOB, jobParams); if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleStopJob( System.identityHashCode(m.obj), jobParams.getJobId(), jobParams.getJobNamespace()); } m.sendToTarget(); } } Loading @@ -164,6 +180,11 @@ public abstract class JobServiceEngine { switch (msg.what) { case MSG_EXECUTE_JOB: { final JobParameters params = (JobParameters) msg.obj; long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordStartJob(System.identityHashCode(params)); } try { params.enableCleaner(); boolean workOngoing = JobServiceEngine.this.onStartJob(params); Loading @@ -174,17 +195,29 @@ public abstract class JobServiceEngine { } catch (Exception e) { Log.e(TAG, "Error while executing job: " + params.getJobId()); throw new RuntimeException(e); } finally { if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } break; } case MSG_STOP_JOB: { final JobParameters params = (JobParameters) msg.obj; long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordStopJob(System.identityHashCode(params)); } try { boolean ret = JobServiceEngine.this.onStopJob(params); ackStopMessage(params, ret); } catch (Exception e) { Log.e(TAG, "Application unable to handle onStopJob.", e); throw new RuntimeException(e); } finally { if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } break; } Loading core/java/android/app/ActivityThread.java +31 −28 Original line number Diff line number Diff line Loading @@ -1157,19 +1157,15 @@ public final class ActivityThread extends ClientTransactionHandler CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) { long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordScheduleReceiver(); } updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, sendingUid, sendingPackage); r.info = info; sendMessage(H.RECEIVER, r); if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); DebugStore.recordScheduleBroadcastReceive(System.identityHashCode(r), intent); } sendMessage(H.RECEIVER, r); } public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { Loading Loading @@ -1219,6 +1215,9 @@ public final class ActivityThread extends ClientTransactionHandler Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleCreateService. token=" + token); } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleServiceCreate(System.identityHashCode(s), info); } sendMessage(H.CREATE_SERVICE, s); } Loading @@ -1241,6 +1240,9 @@ public final class ActivityThread extends ClientTransactionHandler Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleBindService. token=" + token + " bindSeq=" + bindSeq); } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleServiceBind(System.identityHashCode(s), s.intent); } sendMessage(H.BIND_SERVICE, s); } Loading Loading @@ -1274,6 +1276,9 @@ public final class ActivityThread extends ClientTransactionHandler Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleServiceArgs. token=" + token + " startId=" + s.startId); } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleServiceStart(System.identityHashCode(s), s.args); } sendMessage(H.SERVICE_ARGS, s); } } Loading Loading @@ -1341,6 +1346,9 @@ public final class ActivityThread extends ClientTransactionHandler FileDescriptor applicationSharedMemoryFd, long startRequestedElapsedTime, long startRequestedUptime) { if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleBindApplication(); } if (services != null) { if (false) { // Test code to make sure the app could see the passed-in services. Loading Loading @@ -1518,10 +1526,6 @@ public final class ActivityThread extends ClientTransactionHandler boolean sticky, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) throws RemoteException { long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordScheduleRegisteredReceiver(); } updateProcessState(processState, false); // We can't modify IIntentReceiver due to UnsupportedAppUsage, so Loading @@ -1546,9 +1550,6 @@ public final class ActivityThread extends ClientTransactionHandler receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); } if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } @Override Loading Loading @@ -2548,7 +2549,7 @@ public final class ActivityThread extends ClientTransactionHandler Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "bindApplication"); if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordHandleBindApplication(); DebugStore.recordBindApplication(); } AppBindData data = (AppBindData)msg.obj; handleBindApplication(data); Loading @@ -2575,20 +2576,10 @@ public final class ActivityThread extends ClientTransactionHandler } } ReceiverData receiverData = (ReceiverData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordBroadcastReceive( receiverData.intent, System.identityHashCode(receiverData)); } try { handleReceiver(receiverData); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); shouldLogLongMessage = false; } } break; case CREATE_SERVICE: Loading @@ -2598,7 +2589,9 @@ public final class ActivityThread extends ClientTransactionHandler } CreateServiceData createServiceData = (CreateServiceData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordServiceCreate(createServiceData.info); debugStoreId = DebugStore.recordServiceCreate( System.identityHashCode(msg.obj)); } try { Loading @@ -2619,7 +2612,8 @@ public final class ActivityThread extends ClientTransactionHandler BindServiceData bindData = (BindServiceData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordServiceBind(bindData.rebind, bindData.intent); DebugStore.recordServiceBind( System.identityHashCode(msg.obj)); } try { handleBindService(bindData); Loading Loading @@ -2647,8 +2641,9 @@ public final class ActivityThread extends ClientTransactionHandler } ServiceArgsData serviceData = (ServiceArgsData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordServiceOnStart(serviceData.startId, serviceData.flags, serviceData.args); debugStoreId = DebugStore.recordServiceStart( System.identityHashCode(msg.obj)); } try { Loading Loading @@ -5051,6 +5046,11 @@ public final class ActivityThread extends ClientTransactionHandler + ": " + e.toString(), e); } long debugStoreId = -1; if(DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordBroadcastReceive(System.identityHashCode(data), receiver.getClass().getSimpleName()); } try { if (localLOGV) Slog.v( TAG, "Performing receive of " + data.intent Loading @@ -5075,6 +5075,9 @@ public final class ActivityThread extends ClientTransactionHandler } } finally { sCurrentBroadcastIntent.set(null); if(DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } if (receiver.getPendingResult() != null) { Loading core/java/android/app/LoadedApk.java +6 −1 Original line number Diff line number Diff line Loading @@ -1829,7 +1829,8 @@ public final class LoadedApk { if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordBroadcastReceiveReg( intent, System.identityHashCode(this)); System.identityHashCode(this), receiver.getClass().getName()); } try { Loading Loading @@ -1935,6 +1936,10 @@ public final class LoadedApk { + " seq=" + seq + " to " + mReceiver); } } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleBroadcastReceiveReg(System.identityHashCode(args), intent); } if (intent == null || !mActivityThread.post(args.getRunnable())) { IActivityManager mgr = ActivityManager.getService(); if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG, Loading Loading
apex/jobscheduler/framework/java/android/app/job/JobServiceEngine.java +33 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.os.Message; import android.os.RemoteException; import android.util.Log; import com.android.internal.os.DebugStore; import com.android.internal.os.SomeArgs; import java.lang.ref.WeakReference; Loading Loading @@ -79,6 +80,9 @@ public abstract class JobServiceEngine { /** Message that the network to use has changed. */ private static final int MSG_INFORM_OF_NETWORK_CHANGE = 8; private static final boolean DEBUG_STORE_ENABLED = com.android.internal.os.Flags.debugStoreEnabled(); private final IJobService mBinder; /** Loading Loading @@ -125,6 +129,12 @@ public abstract class JobServiceEngine { JobServiceEngine service = mService.get(); if (service != null) { Message m = Message.obtain(service.mHandler, MSG_EXECUTE_JOB, jobParams); if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleStartJob( System.identityHashCode(m.obj), jobParams.getJobId(), jobParams.getJobNamespace()); } m.sendToTarget(); } } Loading @@ -144,6 +154,12 @@ public abstract class JobServiceEngine { JobServiceEngine service = mService.get(); if (service != null) { Message m = Message.obtain(service.mHandler, MSG_STOP_JOB, jobParams); if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleStopJob( System.identityHashCode(m.obj), jobParams.getJobId(), jobParams.getJobNamespace()); } m.sendToTarget(); } } Loading @@ -164,6 +180,11 @@ public abstract class JobServiceEngine { switch (msg.what) { case MSG_EXECUTE_JOB: { final JobParameters params = (JobParameters) msg.obj; long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordStartJob(System.identityHashCode(params)); } try { params.enableCleaner(); boolean workOngoing = JobServiceEngine.this.onStartJob(params); Loading @@ -174,17 +195,29 @@ public abstract class JobServiceEngine { } catch (Exception e) { Log.e(TAG, "Error while executing job: " + params.getJobId()); throw new RuntimeException(e); } finally { if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } break; } case MSG_STOP_JOB: { final JobParameters params = (JobParameters) msg.obj; long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordStopJob(System.identityHashCode(params)); } try { boolean ret = JobServiceEngine.this.onStopJob(params); ackStopMessage(params, ret); } catch (Exception e) { Log.e(TAG, "Application unable to handle onStopJob.", e); throw new RuntimeException(e); } finally { if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } break; } Loading
core/java/android/app/ActivityThread.java +31 −28 Original line number Diff line number Diff line Loading @@ -1157,19 +1157,15 @@ public final class ActivityThread extends ClientTransactionHandler CompatibilityInfo compatInfo, int resultCode, String data, Bundle extras, boolean ordered, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) { long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordScheduleReceiver(); } updateProcessState(processState, false); ReceiverData r = new ReceiverData(intent, resultCode, data, extras, ordered, false, assumeDelivered, mAppThread.asBinder(), sendingUser, sendingUid, sendingPackage); r.info = info; sendMessage(H.RECEIVER, r); if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); DebugStore.recordScheduleBroadcastReceive(System.identityHashCode(r), intent); } sendMessage(H.RECEIVER, r); } public final void scheduleReceiverList(List<ReceiverInfo> info) throws RemoteException { Loading Loading @@ -1219,6 +1215,9 @@ public final class ActivityThread extends ClientTransactionHandler Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleCreateService. token=" + token); } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleServiceCreate(System.identityHashCode(s), info); } sendMessage(H.CREATE_SERVICE, s); } Loading @@ -1241,6 +1240,9 @@ public final class ActivityThread extends ClientTransactionHandler Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleBindService. token=" + token + " bindSeq=" + bindSeq); } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleServiceBind(System.identityHashCode(s), s.intent); } sendMessage(H.BIND_SERVICE, s); } Loading Loading @@ -1274,6 +1276,9 @@ public final class ActivityThread extends ClientTransactionHandler Trace.instant(Trace.TRACE_TAG_ACTIVITY_MANAGER, "scheduleServiceArgs. token=" + token + " startId=" + s.startId); } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleServiceStart(System.identityHashCode(s), s.args); } sendMessage(H.SERVICE_ARGS, s); } } Loading Loading @@ -1341,6 +1346,9 @@ public final class ActivityThread extends ClientTransactionHandler FileDescriptor applicationSharedMemoryFd, long startRequestedElapsedTime, long startRequestedUptime) { if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleBindApplication(); } if (services != null) { if (false) { // Test code to make sure the app could see the passed-in services. Loading Loading @@ -1518,10 +1526,6 @@ public final class ActivityThread extends ClientTransactionHandler boolean sticky, boolean assumeDelivered, int sendingUser, int processState, int sendingUid, String sendingPackage) throws RemoteException { long debugStoreId = -1; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordScheduleRegisteredReceiver(); } updateProcessState(processState, false); // We can't modify IIntentReceiver due to UnsupportedAppUsage, so Loading @@ -1546,9 +1550,6 @@ public final class ActivityThread extends ClientTransactionHandler receiver.performReceive(intent, resultCode, dataStr, extras, ordered, sticky, sendingUser); } if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } @Override Loading Loading @@ -2548,7 +2549,7 @@ public final class ActivityThread extends ClientTransactionHandler Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "bindApplication"); if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordHandleBindApplication(); DebugStore.recordBindApplication(); } AppBindData data = (AppBindData)msg.obj; handleBindApplication(data); Loading @@ -2575,20 +2576,10 @@ public final class ActivityThread extends ClientTransactionHandler } } ReceiverData receiverData = (ReceiverData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordBroadcastReceive( receiverData.intent, System.identityHashCode(receiverData)); } try { handleReceiver(receiverData); } finally { Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); if (DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); shouldLogLongMessage = false; } } break; case CREATE_SERVICE: Loading @@ -2598,7 +2589,9 @@ public final class ActivityThread extends ClientTransactionHandler } CreateServiceData createServiceData = (CreateServiceData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordServiceCreate(createServiceData.info); debugStoreId = DebugStore.recordServiceCreate( System.identityHashCode(msg.obj)); } try { Loading @@ -2619,7 +2612,8 @@ public final class ActivityThread extends ClientTransactionHandler BindServiceData bindData = (BindServiceData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordServiceBind(bindData.rebind, bindData.intent); DebugStore.recordServiceBind( System.identityHashCode(msg.obj)); } try { handleBindService(bindData); Loading Loading @@ -2647,8 +2641,9 @@ public final class ActivityThread extends ClientTransactionHandler } ServiceArgsData serviceData = (ServiceArgsData) msg.obj; if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordServiceOnStart(serviceData.startId, serviceData.flags, serviceData.args); debugStoreId = DebugStore.recordServiceStart( System.identityHashCode(msg.obj)); } try { Loading Loading @@ -5051,6 +5046,11 @@ public final class ActivityThread extends ClientTransactionHandler + ": " + e.toString(), e); } long debugStoreId = -1; if(DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordBroadcastReceive(System.identityHashCode(data), receiver.getClass().getSimpleName()); } try { if (localLOGV) Slog.v( TAG, "Performing receive of " + data.intent Loading @@ -5075,6 +5075,9 @@ public final class ActivityThread extends ClientTransactionHandler } } finally { sCurrentBroadcastIntent.set(null); if(DEBUG_STORE_ENABLED) { DebugStore.recordEventEnd(debugStoreId); } } if (receiver.getPendingResult() != null) { Loading
core/java/android/app/LoadedApk.java +6 −1 Original line number Diff line number Diff line Loading @@ -1829,7 +1829,8 @@ public final class LoadedApk { if (DEBUG_STORE_ENABLED) { debugStoreId = DebugStore.recordBroadcastReceiveReg( intent, System.identityHashCode(this)); System.identityHashCode(this), receiver.getClass().getName()); } try { Loading Loading @@ -1935,6 +1936,10 @@ public final class LoadedApk { + " seq=" + seq + " to " + mReceiver); } } if (DEBUG_STORE_ENABLED) { DebugStore.recordScheduleBroadcastReceiveReg(System.identityHashCode(args), intent); } if (intent == null || !mActivityThread.post(args.getRunnable())) { IActivityManager mgr = ActivityManager.getService(); if (ActivityThread.DEBUG_BROADCAST) Slog.i(ActivityThread.TAG, Loading