From dbf749e78144612933c00eed5a413843ec2fe3af Mon Sep 17 00:00:00 2001 From: Tim Su Date: Tue, 2 Feb 2010 18:53:04 -0800 Subject: [PATCH] Updated Astrid task killer warning, and make task killer search every startup. --- res/values/strings.xml | 2 +- .../astrid/utilities/StartupReceiver.java | 39 ++++++++++++------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b9caf3412..8f4980808 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -376,7 +376,7 @@ It looks like you are using a task killer application! Please add Astrid to the exclusion list for your task killer. Otherwise, if Astrid gets killed, it will not let you know when your tasks are due.\n \n -(note: No Astrid\'s were harmed in making this message.) +In other words: don\'t kill Astrid! diff --git a/src/com/timsu/astrid/utilities/StartupReceiver.java b/src/com/timsu/astrid/utilities/StartupReceiver.java index b7633a9dd..fb605b9df 100644 --- a/src/com/timsu/astrid/utilities/StartupReceiver.java +++ b/src/com/timsu/astrid/utilities/StartupReceiver.java @@ -62,8 +62,6 @@ public class StartupReceiver extends BroadcastReceiver { } } - showTaskKillerHelp(context); - Preferences.setCurrentVersion(context, finalVersion); } @@ -84,6 +82,9 @@ public class StartupReceiver extends BroadcastReceiver { Intent intent = new Intent(context, UpdateService.class); context.startService(intent); + // check for task killers + showTaskKillerHelp(context); + hasStartedUp = true; } @@ -92,19 +93,31 @@ public class StartupReceiver extends BroadcastReceiver { return; // search for task killers. if they exist, show the help! - PackageManager pm = context.getPackageManager(); - List apps = pm.getInstalledPackages(PackageManager.GET_PERMISSIONS); - for(PackageInfo app : apps) { - for(String permission : app.requestedPermissions) { - if(Manifest.permission.RESTART_PACKAGES.equals(permission)) { - DialogUtilities.okDialog(context, context.getString(R.string.task_killer_help), new OnClickListener() { - @Override - public void onClick(DialogInterface arg0, int arg1) { - Preferences.setShouldShowTaskKillerHelp(context, true); + new Thread(new Runnable() { + @Override + public void run() { + PackageManager pm = context.getPackageManager(); + List apps = pm + .getInstalledPackages(PackageManager.GET_PERMISSIONS); + for (PackageInfo app : apps) { + for (String permission : app.requestedPermissions) { + if (Manifest.permission.RESTART_PACKAGES + .equals(permission)) { + DialogUtilities.okDialog(context, context + .getString(R.string.task_killer_help), + new OnClickListener() { + @Override + public void onClick( + DialogInterface arg0, int arg1) { + Preferences + .setShouldShowTaskKillerHelp( + context, true); + } + }); } - }); + } } } - } + }).start(); } }