diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-06 14:02:35 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-06 14:02:35 +0200 |
commit | 9611236bf1b6c35be68a7bbb4f4dbf20a280b8f6 (patch) | |
tree | b9c1a5b8bddaeb018f88c9ececa667f313ae685d /OpenPGP-Keychain/src/org/sufficientlysecure | |
parent | 51cf7939d8c17a1d42bf335892e77c2512729a4e (diff) | |
download | open-keychain-9611236bf1b6c35be68a7bbb4f4dbf20a280b8f6.tar.gz open-keychain-9611236bf1b6c35be68a7bbb4f4dbf20a280b8f6.tar.bz2 open-keychain-9611236bf1b6c35be68a7bbb4f4dbf20a280b8f6.zip |
fix permission check
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure')
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/OtherHelper.java | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/OtherHelper.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/OtherHelper.java index 5dc561923..8e6d15aac 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/OtherHelper.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/OtherHelper.java @@ -120,33 +120,36 @@ public class OtherHelper { public static void checkPackagePermissionForActions(Activity activity, String pkgName, String permName, String action, String[] restrictedActions) { if (action != null) { -// PackageManager pkgManager = activity.getPackageManager(); - -// for (int i = 0; i < restrictedActions.length; i++) { -// if (restrictedActions[i].equals(action)) { -// if (pkgName != null -// && (pkgManager.checkPermission(permName, pkgName) == PackageManager.PERMISSION_GRANTED || pkgName -// .equals(Constants.PACKAGE_NAME))) { -// Log.d(Constants.TAG, pkgName + " has permission " + permName + ". Action " -// + action + " was granted!"); -// } else { -// String error = pkgName + " does NOT have permission " + permName -// + ". Action " + action + " was NOT granted!"; -// Log.e(Constants.TAG, error); -// Toast.makeText(activity, activity.getString(R.string.errorMessage, error), -// Toast.LENGTH_LONG).show(); -// -// // end activity -// activity.setResult(Activity.RESULT_CANCELED, null); -// activity.finish(); -// } -// } -// } - - // TODO: currently always cancels! THis is the old API - // end activity - activity.setResult(Activity.RESULT_CANCELED, null); - activity.finish(); + PackageManager pkgManager = activity.getPackageManager(); + + for (int i = 0; i < restrictedActions.length; i++) { + if (restrictedActions[i].equals(action)) { + + // TODO: currently always cancels! THis is the old API + // end activity + activity.setResult(Activity.RESULT_CANCELED, null); + activity.finish(); + + // if (pkgName != null + // && (pkgManager.checkPermission(permName, pkgName) == + // PackageManager.PERMISSION_GRANTED || pkgName + // .equals(Constants.PACKAGE_NAME))) { + // Log.d(Constants.TAG, pkgName + " has permission " + permName + ". Action " + // + action + " was granted!"); + // } else { + // String error = pkgName + " does NOT have permission " + permName + // + ". Action " + action + " was NOT granted!"; + // Log.e(Constants.TAG, error); + // Toast.makeText(activity, activity.getString(R.string.errorMessage, error), + // Toast.LENGTH_LONG).show(); + // + // // end activity + // activity.setResult(Activity.RESULT_CANCELED, null); + // activity.finish(); + // } + } + } + } } |