Merge "Print correct timeout messages in JobServiceContext" into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
70f7bc45cd
@@ -261,6 +261,13 @@ public final class JobServiceContext implements ServiceConnection {
|
|||||||
return mRunningJob;
|
return mRunningJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used only for debugging. Will return <code>"<null>"</code> if there is no job running.
|
||||||
|
*/
|
||||||
|
private String getRunningJobNameLocked() {
|
||||||
|
return mRunningJob != null ? mRunningJob.toShortString() : "<null>";
|
||||||
|
}
|
||||||
|
|
||||||
/** Called externally when a job that was scheduled for execution should be cancelled. */
|
/** Called externally when a job that was scheduled for execution should be cancelled. */
|
||||||
void cancelExecutingJobLocked(int reason, String debugReason) {
|
void cancelExecutingJobLocked(int reason, String debugReason) {
|
||||||
doCancelLocked(reason, debugReason);
|
doCancelLocked(reason, debugReason);
|
||||||
@@ -522,7 +529,7 @@ public final class JobServiceContext implements ServiceConnection {
|
|||||||
/** Start the job on the service. */
|
/** Start the job on the service. */
|
||||||
private void handleServiceBoundLocked() {
|
private void handleServiceBoundLocked() {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "handleServiceBound for " + mRunningJob.toShortString());
|
Slog.d(TAG, "handleServiceBound for " + getRunningJobNameLocked());
|
||||||
}
|
}
|
||||||
if (mVerb != VERB_BINDING) {
|
if (mVerb != VERB_BINDING) {
|
||||||
Slog.e(TAG, "Sending onStartJob for a job that isn't pending. "
|
Slog.e(TAG, "Sending onStartJob for a job that isn't pending. "
|
||||||
@@ -639,36 +646,34 @@ public final class JobServiceContext implements ServiceConnection {
|
|||||||
private void handleOpTimeoutLocked() {
|
private void handleOpTimeoutLocked() {
|
||||||
switch (mVerb) {
|
switch (mVerb) {
|
||||||
case VERB_BINDING:
|
case VERB_BINDING:
|
||||||
Slog.w(TAG, "Time-out while trying to bind " + mRunningJob.toShortString() +
|
Slog.w(TAG, "Time-out while trying to bind " + getRunningJobNameLocked()
|
||||||
", dropping.");
|
+ ", dropping.");
|
||||||
closeAndCleanupJobLocked(false /* needsReschedule */, "timed out while binding");
|
closeAndCleanupJobLocked(false /* needsReschedule */, "timed out while binding");
|
||||||
break;
|
break;
|
||||||
case VERB_STARTING:
|
case VERB_STARTING:
|
||||||
// Client unresponsive - wedged or failed to respond in time. We don't really
|
// Client unresponsive - wedged or failed to respond in time. We don't really
|
||||||
// know what happened so let's log it and notify the JobScheduler
|
// know what happened so let's log it and notify the JobScheduler
|
||||||
// FINISHED/NO-RETRY.
|
// FINISHED/NO-RETRY.
|
||||||
Slog.w(TAG, "No response from client for onStartJob " +
|
Slog.w(TAG, "No response from client for onStartJob "
|
||||||
mRunningJob != null ? mRunningJob.toShortString() : "<null>");
|
+ getRunningJobNameLocked());
|
||||||
closeAndCleanupJobLocked(false /* needsReschedule */, "timed out while starting");
|
closeAndCleanupJobLocked(false /* needsReschedule */, "timed out while starting");
|
||||||
break;
|
break;
|
||||||
case VERB_STOPPING:
|
case VERB_STOPPING:
|
||||||
// At least we got somewhere, so fail but ask the JobScheduler to reschedule.
|
// At least we got somewhere, so fail but ask the JobScheduler to reschedule.
|
||||||
Slog.w(TAG, "No response from client for onStopJob " +
|
Slog.w(TAG, "No response from client for onStopJob "
|
||||||
mRunningJob != null ? mRunningJob.toShortString() : "<null>");
|
+ getRunningJobNameLocked());
|
||||||
closeAndCleanupJobLocked(true /* needsReschedule */, "timed out while stopping");
|
closeAndCleanupJobLocked(true /* needsReschedule */, "timed out while stopping");
|
||||||
break;
|
break;
|
||||||
case VERB_EXECUTING:
|
case VERB_EXECUTING:
|
||||||
// Not an error - client ran out of time.
|
// Not an error - client ran out of time.
|
||||||
Slog.i(TAG, "Client timed out while executing (no jobFinished received), " +
|
Slog.i(TAG, "Client timed out while executing (no jobFinished received), " +
|
||||||
"sending onStop: " +
|
"sending onStop: " + getRunningJobNameLocked());
|
||||||
mRunningJob != null ? mRunningJob.toShortString() : "<null>");
|
|
||||||
mParams.setStopReason(JobParameters.REASON_TIMEOUT);
|
mParams.setStopReason(JobParameters.REASON_TIMEOUT);
|
||||||
sendStopMessageLocked("timeout while executing");
|
sendStopMessageLocked("timeout while executing");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Slog.e(TAG, "Handling timeout for an invalid job state: " +
|
Slog.e(TAG, "Handling timeout for an invalid job state: "
|
||||||
mRunningJob != null ? mRunningJob.toShortString() : "<null>"
|
+ getRunningJobNameLocked() + ", dropping.");
|
||||||
+ ", dropping.");
|
|
||||||
closeAndCleanupJobLocked(false /* needsReschedule */, "invalid timeout");
|
closeAndCleanupJobLocked(false /* needsReschedule */, "invalid timeout");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user