@Nullable
    public static Intent registerReceiver(@NonNull Context context,
                                          @Nullable BroadcastReceiver receiver, @NonNull IntentFilter filter,
                                          @Nullable String broadcastPermission,
                                          @Nullable Handler scheduler, @RegisterReceiverFlags int flags) {
        if (((flags & RECEIVER_VISIBLE_TO_INSTANT_APPS) != 0) && ((flags & RECEIVER_NOT_EXPORTED)
                != 0)) {
            throw new IllegalArgumentException("Cannot specify both "
                    + "RECEIVER_VISIBLE_TO_INSTANT_APPS and RECEIVER_NOT_EXPORTED");
        }

        if ((flags & RECEIVER_VISIBLE_TO_INSTANT_APPS) != 0) {
            flags |= RECEIVER_EXPORTED;
        }

        if (((flags & RECEIVER_EXPORTED) == 0) && ((flags & RECEIVER_NOT_EXPORTED) == 0)) {
            throw new IllegalArgumentException("One of either RECEIVER_EXPORTED or "
                    + "RECEIVER_NOT_EXPORTED is required");
        }

        if (((flags & RECEIVER_EXPORTED) != 0) && ((flags & RECEIVER_NOT_EXPORTED) != 0)) {
            throw new IllegalArgumentException("Cannot specify both RECEIVER_EXPORTED and "
                    + "RECEIVER_NOT_EXPORTED");
        }

        if (BuildCompat.isAtLeastT()) {
            return Api33Impl.registerReceiver(context, receiver, filter, broadcastPermission,
                    scheduler, flags);
        }
        if (Build.VERSION.SDK_INT >= 26) {
            return Api26Impl.registerReceiver(context, receiver, filter, broadcastPermission,
                    scheduler, flags);
        }
        if (((flags & RECEIVER_NOT_EXPORTED) != 0) && (broadcastPermission == null)) {
            String permission = obtainAndCheckReceiverPermission(context);
            return context.registerReceiver(receiver, filter, permission, scheduler /* handler */);
        }
        return context.registerReceiver(receiver, filter, broadcastPermission,
                scheduler);
    }
Register a broadcast receiver.

@param context             Context to retrieve service from.
@param receiver            The BroadcastReceiver to handle the broadcast.
@param filter              Selects the Intent broadcasts to be received.
@param broadcastPermission String naming a permission that a broadcaster must hold in
                           order to send and Intent to you. If null, no permission is
                           required.
@param scheduler           Handler identifying the thread will receive the Intent. If
                           null, the main thread of the process will be used.
@param flags               Specify one of {@link #RECEIVER_EXPORTED}, if you wish for your
                           receiver to be able to receiver broadcasts from other
                           applications, or {@link #RECEIVER_NOT_EXPORTED} if you only want
                           your receiver to be able to receive broadcasts from the system
                           or your own app.
@return The first sticky intent found that matches <var>filter</var>,
or null if there are none.
@see Context#registerReceiver(BroadcastReceiver, IntentFilter, String, Handler, int)
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/ContextCompat.java