Skip to content

Commit 16297b4

Browse files
committed
fix: Bypass security auth by ActionReceiver
1 parent d00f3ef commit 16297b4

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

app/src/main/java/deltazero/amarok/QuickHideService.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.hjq.window.EasyWindow;
2323
import com.hjq.window.draggable.SpringDraggable;
2424

25-
import deltazero.amarok.receivers.ActionReceiver;
2625
import deltazero.amarok.ui.MainActivity;
2726

2827
public class QuickHideService extends LifecycleService {
@@ -31,7 +30,6 @@ public class QuickHideService extends LifecycleService {
3130
private ImageView ivPanicButton;
3231

3332
private PendingIntent activityPendingIntent;
34-
private NotificationCompat.Action action;
3533
private static final String CHANNEL_ID = "QUICK_HIDE_CHANNEL";
3634
private static final int NOTIFICATION_ID = 1;
3735

@@ -46,14 +44,6 @@ public void onCreate() {
4644
getString(R.string.notification_channel_name), NotificationManager.IMPORTANCE_DEFAULT);
4745
getSystemService(NotificationManager.class).createNotificationChannel(channel);
4846

49-
Intent actionIntent = new Intent(this, ActionReceiver.class);
50-
actionIntent.setAction("deltazero.amarok.HIDE");
51-
PendingIntent actionPendingIntent = PendingIntent.getBroadcast(this, 1,
52-
actionIntent, PendingIntent.FLAG_IMMUTABLE);
53-
action = new NotificationCompat.Action.Builder(
54-
R.drawable.ic_paw,
55-
getString(R.string.hide), actionPendingIntent).build();
56-
5747
activityPendingIntent = PendingIntent.getActivity(this, 0,
5848
new Intent(this, MainActivity.class), PendingIntent.FLAG_IMMUTABLE);
5949

@@ -79,7 +69,6 @@ public int onStartCommand(Intent intent, int flags, int startId) {
7969
.setSmallIcon(R.drawable.ic_paw)
8070
.setContentIntent(activityPendingIntent)
8171
.setOngoing(true)
82-
.addAction(action)
8372
.build();
8473

8574
if (Build.VERSION.SDK_INT >= 34) {

app/src/main/java/deltazero/amarok/receivers/ActionReceiver.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
import deltazero.amarok.Hider;
1212
import deltazero.amarok.R;
13+
import deltazero.amarok.ui.SecurityAuthForQSActivity;
14+
import deltazero.amarok.utils.SecurityUtil;
1315

1416
public class ActionReceiver extends BroadcastReceiver {
1517
@Override
@@ -24,7 +26,10 @@ public void onReceive(Context context, Intent intent) {
2426
if (Objects.equals(intent.getAction(), "deltazero.amarok.HIDE")) {
2527
Hider.hide(context);
2628
} else if (Objects.equals(intent.getAction(), "deltazero.amarok.UNHIDE")) {
27-
Hider.unhide(context);
29+
if (SecurityUtil.isUnlockRequired())
30+
context.startActivity(new Intent(context, SecurityAuthForQSActivity.class)
31+
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
32+
else Hider.unhide(context);
2833
} else {
2934
Log.w("ActionReceiver", "Invalid action: " + intent.getAction());
3035
Toast.makeText(context, context.getString(R.string.invalid_action, intent.getAction()),

0 commit comments

Comments
 (0)