summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2016-03-22 00:13:38 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-03-22 00:13:38 (GMT)
commit959c57cdbfa0618214bb447e9671727d862f0c0a (patch)
treebb8faa0f12d45db9b9c314dfc0fe9601caa36997
parentf7ac4baf1459752e0ed0b62a61df5048784e1b17 (diff)
parent15fa03702aae07fb325d6be98d8c0cdeb344d20d (diff)
downloadandroid_packages_apps_PackageInstaller-959c57cdbfa0618214bb447e9671727d862f0c0a.zip
android_packages_apps_PackageInstaller-959c57cdbfa0618214bb447e9671727d862f0c0a.tar.gz
android_packages_apps_PackageInstaller-959c57cdbfa0618214bb447e9671727d862f0c0a.tar.bz2
Merge "Don't show app defined permissions in the review UI" into nyc-dev
-rw-r--r--src/com/android/packageinstaller/permission/model/AppPermissionGroup.java4
-rw-r--r--src/com/android/packageinstaller/permission/ui/ReviewPermissionsActivity.java23
2 files changed, 21 insertions, 6 deletions
diff --git a/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java b/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
index 0771a0f..fdb7793 100644
--- a/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
+++ b/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
@@ -162,6 +162,10 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
group.addPermission(permission);
}
+ if (group.getPermissions().isEmpty()) {
+ return null;
+ }
+
return group;
}
diff --git a/src/com/android/packageinstaller/permission/ui/ReviewPermissionsActivity.java b/src/com/android/packageinstaller/permission/ui/ReviewPermissionsActivity.java
index 38080e6..f31d618 100644
--- a/src/com/android/packageinstaller/permission/ui/ReviewPermissionsActivity.java
+++ b/src/com/android/packageinstaller/permission/ui/ReviewPermissionsActivity.java
@@ -120,13 +120,18 @@ public final class ReviewPermissionsActivity extends Activity
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Activity activity = getActivity();
+ if (activity == null) {
+ return;
+ }
+
PackageInfo packageInfo = getArguments().getParcelable(EXTRA_PACKAGE_INFO);
if (packageInfo == null) {
- getActivity().finish();
+ activity.finish();
return;
}
- mAppPermissions = new AppPermissions(getActivity(), packageInfo, null, false,
+ mAppPermissions = new AppPermissions(activity, packageInfo, null, false,
new Runnable() {
@Override
public void run() {
@@ -135,7 +140,7 @@ public final class ReviewPermissionsActivity extends Activity
});
if (mAppPermissions.getPermissionGroups().isEmpty()) {
- getActivity().finish();
+ activity.finish();
return;
}
@@ -148,7 +153,7 @@ public final class ReviewPermissionsActivity extends Activity
}
if (!reviewRequired) {
- getActivity().finish();
+ activity.finish();
}
}
@@ -166,14 +171,18 @@ public final class ReviewPermissionsActivity extends Activity
@Override
public void onClick(View view) {
+ Activity activity = getActivity();
+ if (activity == null) {
+ return;
+ }
if (view == mContinueButton) {
confirmPermissionsReview();
executeCallback(true);
} else if (view == mCancelButton) {
executeCallback(false);
- getActivity().setResult(Activity.RESULT_CANCELED);
+ activity.setResult(Activity.RESULT_CANCELED);
}
- getActivity().finish();
+ activity.finish();
}
@Override
@@ -185,6 +194,8 @@ public final class ReviewPermissionsActivity extends Activity
SwitchPreference switchPreference = (SwitchPreference) preference;
if (switchPreference.isChecked()) {
showWarnRevokeDialog(switchPreference.getKey());
+ } else {
+ return true;
}
}
return false;