diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-01-27 19:25:48 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-01-28 11:03:09 -0800 |
commit | 8cecf89cec3ea14003482c046eec7d2aba8bb0ad (patch) | |
tree | cd78065de87654bfe7336337bf0ce61a88b4404a /src/com/android/settings/DeviceAdminAdd.java | |
parent | 61daf83ca8bcf1353e0e81316a2b3809ec7397c5 (diff) | |
download | packages_apps_settings-8cecf89cec3ea14003482c046eec7d2aba8bb0ad.zip packages_apps_settings-8cecf89cec3ea14003482c046eec7d2aba8bb0ad.tar.gz packages_apps_settings-8cecf89cec3ea14003482c046eec7d2aba8bb0ad.tar.bz2 |
Update to follow device policy changes.
Diffstat (limited to 'src/com/android/settings/DeviceAdminAdd.java')
-rw-r--r-- | src/com/android/settings/DeviceAdminAdd.java | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/com/android/settings/DeviceAdminAdd.java b/src/com/android/settings/DeviceAdminAdd.java index db4263a..03db9ce 100644 --- a/src/com/android/settings/DeviceAdminAdd.java +++ b/src/com/android/settings/DeviceAdminAdd.java @@ -66,8 +66,9 @@ public class DeviceAdminAdd extends Activity { Button mActionButton; View mSelectLayout; - ArrayList<DeviceAdminInfo> mAvailablePolicies - = new ArrayList<DeviceAdminInfo>(); + + final ArrayList<View> mAddingPolicies = new ArrayList<View>(); + final ArrayList<View> mActivePolicies = new ArrayList<View>(); boolean mAdding; @@ -191,6 +192,13 @@ public class DeviceAdminAdd extends Activity { } } + static void setViewVisibility(ArrayList<View> views, int visibility) { + final int N = views.size(); + for (int i=0; i<N; i++) { + views.get(i).setVisibility(visibility); + } + } + void updateInterface() { mAdminIcon.setImageDrawable(mDeviceAdmin.loadIcon(getPackageManager())); mAdminName.setText(mDeviceAdmin.loadLabel(getPackageManager())); @@ -207,19 +215,37 @@ public class DeviceAdminAdd extends Activity { } else { mAddMsg.setVisibility(View.GONE); } - ArrayList<DeviceAdminInfo.PolicyInfo> policies = mDeviceAdmin.getUsedPolicies(); - for (int i=0; i<policies.size(); i++) { - DeviceAdminInfo.PolicyInfo pi = policies.get(i); - mAdminPolicies.addView(AppSecurityPermissions.getPermissionItemView( - this, getText(pi.label), getText(pi.description), true)); - } if (mDPM.isAdminActive(mDeviceAdmin.getComponent())) { + if (mActivePolicies.size() == 0) { + ArrayList<DeviceAdminInfo.PolicyInfo> policies = mDeviceAdmin.getUsedPolicies(); + for (int i=0; i<policies.size(); i++) { + DeviceAdminInfo.PolicyInfo pi = policies.get(i); + View view = AppSecurityPermissions.getPermissionItemView( + this, getText(pi.label), "", true); + mActivePolicies.add(view); + mAdminPolicies.addView(view); + } + } + setViewVisibility(mActivePolicies, View.VISIBLE); + setViewVisibility(mAddingPolicies, View.GONE); mAdminWarning.setText(getString(R.string.device_admin_status, mDeviceAdmin.getActivityInfo().applicationInfo.loadLabel(getPackageManager()))); mTitle.setText(getText(R.string.active_device_admin_msg)); mActionButton.setText(getText(R.string.remove_device_admin)); mAdding = false; } else { + if (mAddingPolicies.size() == 0) { + ArrayList<DeviceAdminInfo.PolicyInfo> policies = mDeviceAdmin.getUsedPolicies(); + for (int i=0; i<policies.size(); i++) { + DeviceAdminInfo.PolicyInfo pi = policies.get(i); + View view = AppSecurityPermissions.getPermissionItemView( + this, getText(pi.label), getText(pi.description), true); + mAddingPolicies.add(view); + mAdminPolicies.addView(view); + } + } + setViewVisibility(mAddingPolicies, View.VISIBLE); + setViewVisibility(mActivePolicies, View.GONE); mAdminWarning.setText(getString(R.string.device_admin_warning, mDeviceAdmin.getActivityInfo().applicationInfo.loadLabel(getPackageManager()))); mTitle.setText(getText(R.string.add_device_admin_msg)); |