Don't show notification again if coming from notification

This commit is contained in:
topjohnwu 2017-02-17 09:26:17 +08:00
parent ac44f05811
commit 1d70d0fe94
3 changed files with 12 additions and 12 deletions

View File

@ -47,7 +47,6 @@ public class MagiskManager extends Application {
public boolean isSuClient = false;
public String suVersion = null;
public boolean disabled = false;
public boolean isNotified = false;
// Data
public ValueSortedMap<String, Repo> repoMap;

View File

@ -39,6 +39,7 @@ public class SplashActivity extends Activity{
boolean started = Utils.isValidShellResponse(ret) && Integer.parseInt(ret.get(0)) != 0;
// Initialize the update check service, notify every 3 hours
if (!"install".equals(getIntent().getStringExtra(MainActivity.SECTION))) {
ComponentName service = new ComponentName(magiskManager, UpdateCheckService.class);
JobInfo jobInfo = new JobInfo.Builder(UPDATE_SERVICE_ID, service)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
@ -47,6 +48,7 @@ public class SplashActivity extends Activity{
.build();
JobScheduler scheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
scheduler.schedule(jobInfo);
}
// Now fire all async tasks
new GetBootBlocks(this).exec();
@ -62,7 +64,7 @@ public class SplashActivity extends Activity{
}
}.exec();
new LoadApps(this).exec();
new CheckUpdates(this, true){
new CheckUpdates(this, !"install".equals(getIntent().getStringExtra(MainActivity.SECTION))){
@Override
protected void onPostExecute(Void v) {
super.onPostExecute(v);

View File

@ -25,7 +25,7 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
public CheckUpdates(Context context, boolean b) {
this(context);
showNotification = b && !magiskManager.isNotified;
showNotification = b;
}
public CheckUpdates(Context context) {
@ -49,7 +49,6 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
@Override
protected void onPostExecute(Void v) {
if (magiskManager.magiskVersion < magiskManager.remoteMagiskVersion && showNotification) {
magiskManager.isNotified = true;
NotificationCompat.Builder builder = new NotificationCompat.Builder(magiskManager);
builder.setSmallIcon(R.drawable.ic_magisk)
.setContentTitle(magiskManager.getString(R.string.magisk_update_title))