Throw exceptions if obtain ActivityStarter before system ready

RWC was null while starting home activity during system boot up.
Throw exceptions now if that happens again.

Also add warning logs if any unknown failures during ATM#onTransact.

Bug: 174713714
Bug: 173221781
Test: build and run
Change-Id: I5f3414d98198144af7bc0a07c7dbfafd529790e8
This commit is contained in:
Louis Chang
2020-12-23 12:13:42 +08:00
parent e295da00ac
commit b7844e5b07
2 changed files with 19 additions and 0 deletions

View File

@@ -279,6 +279,9 @@ class ActivityStarter {
ActivityStarter starter = mStarterPool.acquire();
if (starter == null) {
if (mService.mRootWindowContainer == null) {
throw new IllegalStateException("Too early to start activity.");
}
starter = new ActivityStarter(mController, mService, mSupervisor, mInterceptor);
}

View File

@@ -183,6 +183,7 @@ import android.os.IUserManager;
import android.os.LocaleList;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.PowerManager;
import android.os.PowerManagerInternal;
import android.os.Process;
@@ -4938,6 +4939,21 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
return allUids.contains(uid);
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
try {
return super.onTransact(code, data, reply, flags);
} catch (RuntimeException e) {
if (!(e instanceof SecurityException)) {
Slog.w(TAG, "Activity Task Manager onTransact aborts "
+ " UID:" + Binder.getCallingUid()
+ " PID:" + Binder.getCallingPid(), e);
}
throw e;
}
}
final class H extends Handler {
static final int REPORT_TIME_TRACKER_MSG = 1;