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

Commit a28942c5 authored by Amit Mahajan's avatar Amit Mahajan Committed by Automerger Merge Worker
Browse files

Merge "Bind WapPushManagerService regardless of DirectBoot status" am: dc929cf3 am: 63da3d86

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1335716

Change-Id: Iccf48a5e7f1b6c593eb64f03a5fb948392c5f5f9
parents 1d0661a1 63da3d86
Loading
Loading
Loading
Loading
+1 −34
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -73,32 +72,6 @@ public class WapPushOverSms implements ServiceConnection {
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private volatile IWapPushManager mWapPushManager;

    /** Broadcast receiver that binds to WapPushManager when the user unlocks the phone for the
     *  first time after reboot and the credential-encrypted storage is available.
     */
    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(final Context context, Intent intent) {
            Rlog.d(TAG, "Received broadcast " + intent.getAction());
            if (Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) {
                new BindServiceThread(mContext).start();
            }
        }
    };

    private class BindServiceThread extends Thread {
        private final Context context;

        private BindServiceThread(Context context) {
            this.context = context;
        }

        @Override
        public void run() {
            bindWapPushManagerService(context);
        }
    }

    private void bindWapPushManagerService(Context context) {
        Intent intent = new Intent(IWapPushManager.class.getName());
        ComponentName comp = resolveSystemService(context.getPackageManager(), intent);
@@ -158,13 +131,7 @@ public class WapPushOverSms implements ServiceConnection {

        UserManager userManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);

        if (userManager.isUserUnlocked()) {
        bindWapPushManagerService(mContext);
        } else {
            IntentFilter userFilter = new IntentFilter();
            userFilter.addAction(Intent.ACTION_USER_UNLOCKED);
            context.registerReceiver(mBroadcastReceiver, userFilter);
        }
    }

    public void dispose() {