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

Commit 968b2db0 authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Revert "Avoid running RegisteredServicesCache tasks on main thread"

This reverts commit 8f35d505.

Reason for revert: possibly b/184141588

Change-Id: I8c6262ec8ce5561f8d398a81492b6f5217dba834
parent 8f35d505
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.util.Xml;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.ArrayUtils;

import libcore.io.IoUtils;
@@ -162,20 +161,18 @@ public abstract class RegisteredServicesCache<V> {
        intentFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
        intentFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
        intentFilter.addDataScheme("package");
        Handler handler = BackgroundThread.getHandler();
        mContext.registerReceiverAsUser(
                mPackageReceiver, UserHandle.ALL, intentFilter, null, handler);
        mContext.registerReceiverAsUser(mPackageReceiver, UserHandle.ALL, intentFilter, null, null);

        // Register for events related to sdcard installation.
        IntentFilter sdFilter = new IntentFilter();
        sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
        sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
        mContext.registerReceiver(mExternalReceiver, sdFilter, null, handler);
        mContext.registerReceiver(mExternalReceiver, sdFilter);

        // Register for user-related events
        IntentFilter userFilter = new IntentFilter();
        sdFilter.addAction(Intent.ACTION_USER_REMOVED);
        mContext.registerReceiver(mUserRemovedReceiver, userFilter, null, handler);
        mContext.registerReceiver(mUserRemovedReceiver, userFilter);
    }

    private void handlePackageEvent(Intent intent, int userId) {
@@ -268,7 +265,7 @@ public abstract class RegisteredServicesCache<V> {

    public void setListener(RegisteredServicesCacheListener<V> listener, Handler handler) {
        if (handler == null) {
            handler = BackgroundThread.getHandler();
            handler = new Handler(mContext.getMainLooper());
        }
        synchronized (this) {
            mHandler = handler;
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ public class AccountManagerService
        mAppOpsManager = mContext.getSystemService(AppOpsManager.class);
        mHandler = new MessageHandler(injector.getMessageHandlerLooper());
        mAuthenticatorCache = mInjector.getAccountAuthenticatorCache();
        mAuthenticatorCache.setListener(this, mHandler);
        mAuthenticatorCache.setListener(this, null /* Handler */);

        sThis.set(this);