mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-08-22 10:09:39 +00:00
Specify RECEIVER_EXPORTED/RECEIVER_NOT_EXPORTED for sdk34
This commit is contained in:
parent
a4bd82be8a
commit
04ef608f7a
@ -48,6 +48,7 @@ import androidx.appcompat.app.ActionBar;
|
|||||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.view.GravityCompat;
|
import androidx.core.view.GravityCompat;
|
||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@ -890,7 +891,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
};
|
};
|
||||||
final IntentFilter intentFilter = new IntentFilter();
|
final IntentFilter intentFilter = new IntentFilter();
|
||||||
intentFilter.addAction(VideoDetailFragment.ACTION_PLAYER_STARTED);
|
intentFilter.addAction(VideoDetailFragment.ACTION_PLAYER_STARTED);
|
||||||
registerReceiver(broadcastReceiver, intentFilter);
|
ContextCompat.registerReceiver(this, broadcastReceiver, intentFilter,
|
||||||
|
ContextCompat.RECEIVER_EXPORTED);
|
||||||
|
|
||||||
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
|
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
|
||||||
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.
|
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.
|
||||||
|
@ -1423,7 +1423,8 @@ public final class VideoDetailFragment
|
|||||||
intentFilter.addAction(ACTION_SHOW_MAIN_PLAYER);
|
intentFilter.addAction(ACTION_SHOW_MAIN_PLAYER);
|
||||||
intentFilter.addAction(ACTION_HIDE_MAIN_PLAYER);
|
intentFilter.addAction(ACTION_HIDE_MAIN_PLAYER);
|
||||||
intentFilter.addAction(ACTION_PLAYER_STARTED);
|
intentFilter.addAction(ACTION_PLAYER_STARTED);
|
||||||
activity.registerReceiver(broadcastReceiver, intentFilter);
|
ContextCompat.registerReceiver(activity, broadcastReceiver, intentFilter,
|
||||||
|
ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ import androidx.core.app.NotificationCompat
|
|||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
import androidx.core.app.PendingIntentCompat
|
import androidx.core.app.PendingIntentCompat
|
||||||
import androidx.core.app.ServiceCompat
|
import androidx.core.app.ServiceCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.core.Flowable
|
import io.reactivex.rxjava3.core.Flowable
|
||||||
import io.reactivex.rxjava3.disposables.Disposable
|
import io.reactivex.rxjava3.disposables.Disposable
|
||||||
@ -200,7 +201,7 @@ class FeedLoadService : Service() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
registerReceiver(broadcastReceiver, IntentFilter(ACTION_CANCEL))
|
ContextCompat.registerReceiver(this, broadcastReceiver, IntentFilter(ACTION_CANCEL), ContextCompat.RECEIVER_NOT_EXPORTED)
|
||||||
}
|
}
|
||||||
|
|
||||||
// /////////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -60,6 +60,7 @@ import android.view.LayoutInflater;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.math.MathUtils;
|
import androidx.core.math.MathUtils;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
@ -764,7 +765,8 @@ public final class Player implements PlaybackListener, Listener {
|
|||||||
private void registerBroadcastReceiver() {
|
private void registerBroadcastReceiver() {
|
||||||
// Try to unregister current first
|
// Try to unregister current first
|
||||||
unregisterBroadcastReceiver();
|
unregisterBroadcastReceiver();
|
||||||
context.registerReceiver(broadcastReceiver, intentFilter);
|
ContextCompat.registerReceiver(context, broadcastReceiver, intentFilter,
|
||||||
|
ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterBroadcastReceiver() {
|
private void unregisterBroadcastReceiver() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user