mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-24 01:32:16 -05:00
fix permission check
This commit is contained in:
parent
51cf7939d8
commit
9611236bf1
@ -120,33 +120,36 @@ public class OtherHelper {
|
|||||||
public static void checkPackagePermissionForActions(Activity activity, String pkgName,
|
public static void checkPackagePermissionForActions(Activity activity, String pkgName,
|
||||||
String permName, String action, String[] restrictedActions) {
|
String permName, String action, String[] restrictedActions) {
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
// PackageManager pkgManager = activity.getPackageManager();
|
PackageManager pkgManager = activity.getPackageManager();
|
||||||
|
|
||||||
// for (int i = 0; i < restrictedActions.length; i++) {
|
for (int i = 0; i < restrictedActions.length; i++) {
|
||||||
// if (restrictedActions[i].equals(action)) {
|
if (restrictedActions[i].equals(action)) {
|
||||||
// if (pkgName != null
|
|
||||||
// && (pkgManager.checkPermission(permName, pkgName) == PackageManager.PERMISSION_GRANTED || pkgName
|
// TODO: currently always cancels! THis is the old API
|
||||||
// .equals(Constants.PACKAGE_NAME))) {
|
// end activity
|
||||||
// Log.d(Constants.TAG, pkgName + " has permission " + permName + ". Action "
|
activity.setResult(Activity.RESULT_CANCELED, null);
|
||||||
// + action + " was granted!");
|
activity.finish();
|
||||||
// } else {
|
|
||||||
// String error = pkgName + " does NOT have permission " + permName
|
// if (pkgName != null
|
||||||
// + ". Action " + action + " was NOT granted!";
|
// && (pkgManager.checkPermission(permName, pkgName) ==
|
||||||
// Log.e(Constants.TAG, error);
|
// PackageManager.PERMISSION_GRANTED || pkgName
|
||||||
// Toast.makeText(activity, activity.getString(R.string.errorMessage, error),
|
// .equals(Constants.PACKAGE_NAME))) {
|
||||||
// Toast.LENGTH_LONG).show();
|
// Log.d(Constants.TAG, pkgName + " has permission " + permName + ". Action "
|
||||||
//
|
// + action + " was granted!");
|
||||||
// // end activity
|
// } else {
|
||||||
// activity.setResult(Activity.RESULT_CANCELED, null);
|
// String error = pkgName + " does NOT have permission " + permName
|
||||||
// activity.finish();
|
// + ". 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user