am ecd8f7aa: am 70118662: am cf911d10: Merge "Check for DeviceAdminInfo type before casting" into lmp-dev

* commit 'ecd8f7aaf1cd2c984c4c9408de228676dd3d38d7':
  Check for DeviceAdminInfo type before casting
This commit is contained in:
Zoltan Szatmary-Ban
2014-09-11 17:32:08 +00:00
committed by Android Git Automerger

View File

@@ -126,7 +126,12 @@ public class DeviceAdminSettings extends ListFragment {
@Override @Override
public void onListItemClick(ListView l, View v, int position, long id) { public void onListItemClick(ListView l, View v, int position, long id) {
DeviceAdminInfo dpi = (DeviceAdminInfo) l.getAdapter().getItem(position); Object o = l.getAdapter().getItem(position);
if (!(o instanceof DeviceAdminInfo)) {
// race conditions may cause this
return;
}
DeviceAdminInfo dpi = (DeviceAdminInfo) o;
final Activity activity = getActivity(); final Activity activity = getActivity();
final int userId = getUserId(dpi); final int userId = getUserId(dpi);
if (userId == UserHandle.myUserId() || !isProfileOwner(dpi)) { if (userId == UserHandle.myUserId() || !isProfileOwner(dpi)) {