mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
Stop using deprecated startActivityAndCollapse(Intent)
This commit is contained in:
parent
a1d00b47fe
commit
7c1a954e4d
3 changed files with 24 additions and 5 deletions
|
@ -1,5 +1,7 @@
|
||||||
package com.beemdevelopment.aegis.services;
|
package com.beemdevelopment.aegis.services;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
@ -22,6 +24,7 @@ public class LaunchAppTileService extends TileService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StartActivityAndCollapseDeprecated")
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -30,6 +33,12 @@ public class LaunchAppTileService extends TileService {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
intent.setAction(Intent.ACTION_MAIN);
|
intent.setAction(Intent.ACTION_MAIN);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
int flags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE;
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, flags);
|
||||||
|
startActivityAndCollapse(pendingIntent);
|
||||||
|
} else {
|
||||||
startActivityAndCollapse(intent);
|
startActivityAndCollapse(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.beemdevelopment.aegis.services;
|
package com.beemdevelopment.aegis.services;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.service.quicksettings.Tile;
|
import android.service.quicksettings.Tile;
|
||||||
|
@ -22,6 +24,7 @@ public class LaunchScannerTileService extends TileService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("StartActivityAndCollapseDeprecated")
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
|
@ -31,6 +34,12 @@ public class LaunchScannerTileService extends TileService {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
intent.setAction(Intent.ACTION_MAIN);
|
intent.setAction(Intent.ACTION_MAIN);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||||
|
int flags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE;
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, flags);
|
||||||
|
startActivityAndCollapse(pendingIntent);
|
||||||
|
} else {
|
||||||
startActivityAndCollapse(intent);
|
startActivityAndCollapse(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -47,7 +47,8 @@ public class NotificationService extends Service {
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setContentIntent(pendingIntent);
|
.setContentIntent(pendingIntent);
|
||||||
|
|
||||||
startForeground(NOTIFICATION_VAULT_UNLOCKED, builder.build());
|
// NOTE: Disabled for now. See issue: #1047
|
||||||
|
//startForeground(NOTIFICATION_VAULT_UNLOCKED, builder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue