Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d79d203b authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Bring back wtf() for missing services.

Publish DropBox extremely early during boot process so that it can
pick up wtf() calls while booting.

Bug: 28634953
Change-Id: Ie71d53fc125ebc47fa08ef59a8b7e4f66f2e805c
parent 5a0bd229
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -831,7 +831,7 @@ final class SystemServiceRegistry {
                        service = createService(ctx);
                        cache[mCacheIndex] = service;
                    } catch (ServiceNotFoundException e) {
                        Log.w(TAG, e.getMessage(), e);
                        Log.wtf(TAG, e.getMessage(), e);
                    }
                }
                return (T)service;
@@ -855,7 +855,7 @@ final class SystemServiceRegistry {
                    try {
                        mCachedInstance = createService();
                    } catch (ServiceNotFoundException e) {
                        Log.w(TAG, e.getMessage(), e);
                        Log.wtf(TAG, e.getMessage(), e);
                    }
                }
                return mCachedInstance;
@@ -888,7 +888,7 @@ final class SystemServiceRegistry {
                    try {
                        mCachedInstance = createService(appContext != null ? appContext : ctx);
                    } catch (ServiceNotFoundException e) {
                        Log.w(TAG, e.getMessage(), e);
                        Log.wtf(TAG, e.getMessage(), e);
                    }
                }
                return mCachedInstance;
+15 −14
Original line number Diff line number Diff line
@@ -179,7 +179,16 @@ public final class DropBoxManagerService extends SystemService {

    @Override
    public void onStart() {
        // Set up intent receivers
        publishBinderService(Context.DROPBOX_SERVICE, mStub);

        // The real work gets done lazily in init() -- that way service creation always
        // succeeds, and things like disk problems cause individual method failures.
    }

    @Override
    public void onBootPhase(int phase) {
        switch (phase) {
            case PHASE_SYSTEM_SERVICES_READY:
                IntentFilter filter = new IntentFilter();
                filter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW);
                getContext().registerReceiver(mReceiver, filter);
@@ -192,16 +201,8 @@ public final class DropBoxManagerService extends SystemService {
                            mReceiver.onReceive(getContext(), (Intent) null);
                        }
                    });
                break;

        publishBinderService(Context.DROPBOX_SERVICE, mStub);

        // The real work gets done lazily in init() -- that way service creation always
        // succeeds, and things like disk problems cause individual method failures.
    }

    @Override
    public void onBootPhase(int phase) {
        switch (phase) {
            case PHASE_BOOT_COMPLETED:
                mBooted = true;
                break;
+4 −3
Original line number Diff line number Diff line
@@ -13734,11 +13734,12 @@ public final class ActivityManagerService extends ActivityManagerNative
        // NOTE -- this must never acquire the ActivityManagerService lock,
        // otherwise the watchdog may be prevented from resetting the system.
        final String dropboxTag = processClass(process) + "_" + eventType;
        final DropBoxManager dbox = (DropBoxManager)
                mContext.getSystemService(Context.DROPBOX_SERVICE);
        // Bail early if not published yet
        if (ServiceManager.getService(Context.DROPBOX_SERVICE) == null) return;
        final DropBoxManager dbox = mContext.getSystemService(DropBoxManager.class);
        // Exit early if the dropbox isn't configured to accept this report type.
        final String dropboxTag = processClass(process) + "_" + eventType;
        if (dbox == null || !dbox.isTagEnabled(dropboxTag)) return;
        // Rate-limit how often we're willing to do the heavy lifting below to
+3 −2
Original line number Diff line number Diff line
@@ -498,6 +498,9 @@ public final class SystemServer {
     * Starts some essential services that are not tangled up in the bootstrap process.
     */
    private void startCoreServices() {
        // Records errors and logs, for example wtf()
        mSystemServiceManager.startService(DropBoxManagerService.class);

        // Tracks the battery level.  Requires LightService.
        mSystemServiceManager.startService(BatteryService.class);

@@ -930,8 +933,6 @@ public final class SystemServer {
                Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
            }

            mSystemServiceManager.startService(DropBoxManagerService.class);

            if (!disableNonCoreServices && context.getResources().getBoolean(
                        R.bool.config_enableWallpaperService)) {
                traceBeginAndSlog("StartWallpaperManagerService");