content: package top.niunaijun.blackbox.proxy;
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.os.RemoteException;
  
  import top.niunaijun.blackbox.BlackBoxCore;
  import top.niunaijun.blackbox.entity.am.PendingResultData;
  import top.niunaijun.blackbox.proxy.record.ProxyBroadcastRecord;
  
  /**
   * Created by BlackBox on 2022/2/25.
   */
  public class ProxyBroadcastReceiver extends BroadcastReceiver {
      public static final String TAG = "ProxyBroadcastReceiver";
  
      @Override
      public void onReceive(Context context, Intent intent) {
          intent.setExtrasClassLoader(context.getClassLoader());
          ProxyBroadcastRecord record = ProxyBroadcastRecord.create(intent);
          if (record.mIntent == null) {
              return;
          }
          PendingResult pendingResult = goAsync();
          try {
              BlackBoxCore.getBActivityManager().scheduleBroadcastReceiver(record.mIntent, new PendingResultData(pendingResult), record.mUserId);
          } catch (RemoteException e) {
              pendingResult.finish();
          }
      }
  }