Add WTF when a system server wrapper can't be found

2nd try -- enable it only within the system server.

This is to detect someone trying to access system services too
early during a boot.

Bug: 149406139
Test: Boot with "adb logcat | grep -w SystemServiceRegistry" and make sure no wtf is logged
Change-Id: I64c6776cedaeb534d98621db2955d585e6846b8d
This commit is contained in:
Makoto Onuki
2020-02-18 12:38:21 -08:00
parent c068acb6ae
commit a455e5e281
2 changed files with 43 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ import android.annotation.StringRes;
import android.app.ActivityThread;
import android.app.AppCompatCallbacks;
import android.app.INotificationManager;
import android.app.SystemServiceRegistry;
import android.app.usage.UsageStatsManagerInternal;
import android.content.ContentResolver;
import android.content.Context;
@@ -513,6 +514,8 @@ public final class SystemServer {
Looper.getMainLooper().setSlowLogThresholdMs(
SLOW_DISPATCH_THRESHOLD_MS, SLOW_DELIVERY_THRESHOLD_MS);
SystemServiceRegistry.sEnableServiceNotFoundWtf = true;
// Initialize native services.
System.loadLibrary("android_servers");