Merge "Add a new ANR category on BIND_APPLICATION_TIMEOUT" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
dee442c635
@@ -58,6 +58,7 @@ public class TimeoutRecord {
|
|||||||
int APP_REGISTERED = 7;
|
int APP_REGISTERED = 7;
|
||||||
int SHORT_FGS_TIMEOUT = 8;
|
int SHORT_FGS_TIMEOUT = 8;
|
||||||
int JOB_SERVICE = 9;
|
int JOB_SERVICE = 9;
|
||||||
|
int APP_START = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Kind of timeout, e.g. BROADCAST_RECEIVER, etc. */
|
/** Kind of timeout, e.g. BROADCAST_RECEIVER, etc. */
|
||||||
@@ -186,4 +187,10 @@ public class TimeoutRecord {
|
|||||||
public static TimeoutRecord forJobService(String reason) {
|
public static TimeoutRecord forJobService(String reason) {
|
||||||
return TimeoutRecord.endingNow(TimeoutKind.JOB_SERVICE, reason);
|
return TimeoutRecord.endingNow(TimeoutKind.JOB_SERVICE, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Record for app startup timeout. */
|
||||||
|
@NonNull
|
||||||
|
public static TimeoutRecord forAppStart(String reason) {
|
||||||
|
return TimeoutRecord.endingNow(TimeoutKind.APP_START, reason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -559,6 +559,10 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
// How long we wait for a launched process to attach to the activity manager
|
// How long we wait for a launched process to attach to the activity manager
|
||||||
// before we decide it's never going to come up for real.
|
// before we decide it's never going to come up for real.
|
||||||
static final int PROC_START_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
static final int PROC_START_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||||
|
|
||||||
|
// How long we wait for a launched process to complete its app startup before we ANR.
|
||||||
|
static final int BIND_APPLICATION_TIMEOUT = 10 * 1000 * Build.HW_TIMEOUT_MULTIPLIER;
|
||||||
|
|
||||||
// How long we wait to kill an application zygote, after the last process using
|
// How long we wait to kill an application zygote, after the last process using
|
||||||
// it has gone away.
|
// it has gone away.
|
||||||
static final int KILL_APP_ZYGOTE_DELAY_MS = 5 * 1000;
|
static final int KILL_APP_ZYGOTE_DELAY_MS = 5 * 1000;
|
||||||
@@ -1624,6 +1628,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
static final int UPDATE_CACHED_APP_HIGH_WATERMARK = 79;
|
static final int UPDATE_CACHED_APP_HIGH_WATERMARK = 79;
|
||||||
static final int ADD_UID_TO_OBSERVER_MSG = 80;
|
static final int ADD_UID_TO_OBSERVER_MSG = 80;
|
||||||
static final int REMOVE_UID_FROM_OBSERVER_MSG = 81;
|
static final int REMOVE_UID_FROM_OBSERVER_MSG = 81;
|
||||||
|
static final int BIND_APPLICATION_TIMEOUT_MSG = 82;
|
||||||
|
|
||||||
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
|
static final int FIRST_BROADCAST_QUEUE_MSG = 200;
|
||||||
|
|
||||||
@@ -1976,6 +1981,16 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
case UPDATE_CACHED_APP_HIGH_WATERMARK: {
|
case UPDATE_CACHED_APP_HIGH_WATERMARK: {
|
||||||
mAppProfiler.mCachedAppsWatermarkData.updateCachedAppsSnapshot((long) msg.obj);
|
mAppProfiler.mCachedAppsWatermarkData.updateCachedAppsSnapshot((long) msg.obj);
|
||||||
} break;
|
} break;
|
||||||
|
case BIND_APPLICATION_TIMEOUT_MSG: {
|
||||||
|
ProcessRecord app = (ProcessRecord) msg.obj;
|
||||||
|
|
||||||
|
final String anrMessage;
|
||||||
|
synchronized (app) {
|
||||||
|
anrMessage = "Process " + app + " failed to complete startup";
|
||||||
|
}
|
||||||
|
|
||||||
|
mAnrHelper.appNotResponding(app, TimeoutRecord.forAppStart(anrMessage));
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4734,6 +4749,12 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
app.getDisabledCompatChanges(), serializedSystemFontMap,
|
app.getDisabledCompatChanges(), serializedSystemFontMap,
|
||||||
app.getStartElapsedTime(), app.getStartUptime());
|
app.getStartElapsedTime(), app.getStartUptime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Message msg = mHandler.obtainMessage(BIND_APPLICATION_TIMEOUT_MSG);
|
||||||
|
msg.obj = app;
|
||||||
|
mHandler.sendMessageDelayed(msg, BIND_APPLICATION_TIMEOUT);
|
||||||
|
mHandler.removeMessages(PROC_START_TIMEOUT_MSG, app);
|
||||||
|
|
||||||
if (profilerInfo != null) {
|
if (profilerInfo != null) {
|
||||||
profilerInfo.closeFd();
|
profilerInfo.closeFd();
|
||||||
profilerInfo = null;
|
profilerInfo = null;
|
||||||
@@ -4808,7 +4829,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (app != null && app.getStartUid() == uid && app.getStartSeq() == startSeq) {
|
if (app != null && app.getStartUid() == uid && app.getStartSeq() == startSeq) {
|
||||||
mHandler.removeMessages(PROC_START_TIMEOUT_MSG, app);
|
mHandler.removeMessages(BIND_APPLICATION_TIMEOUT_MSG, app);
|
||||||
} else {
|
} else {
|
||||||
Slog.wtf(TAG, "Mismatched or missing ProcessRecord: " + app + ". Pid: " + pid
|
Slog.wtf(TAG, "Mismatched or missing ProcessRecord: " + app + ". Pid: " + pid
|
||||||
+ ". Uid: " + uid);
|
+ ". Uid: " + uid);
|
||||||
|
|||||||
Reference in New Issue
Block a user