resolved conflicts for merge of 5d21820a to jb-mr2-dev

Change-Id: If371a4571c5440ce2a0b4339f97893bf78832b31
This commit is contained in:
Alex Klyubin
2013-06-06 15:45:23 -07:00

View File

@@ -116,34 +116,38 @@ public class DeviceAdminAdd extends Activity {
return; return;
} }
// Make sure the given component name is actually a valid device admin. // When activating, make sure the given component name is actually a valid device admin.
List<ResolveInfo> avail = getPackageManager().queryBroadcastReceivers( // No need to check this when deactivating, because it is safe to deactivate an active
new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_ENABLED), // invalid device admin.
PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS); if (!mDPM.isAdminActive(cn)) {
int count = avail == null ? 0 : avail.size(); List<ResolveInfo> avail = getPackageManager().queryBroadcastReceivers(
boolean found = false; new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_ENABLED),
for (int i=0; i<count; i++) { PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
ResolveInfo ri = avail.get(i); int count = avail == null ? 0 : avail.size();
if (ai.packageName.equals(ri.activityInfo.packageName) boolean found = false;
&& ai.name.equals(ri.activityInfo.name)) { for (int i=0; i<count; i++) {
try { ResolveInfo ri = avail.get(i);
// We didn't retrieve the meta data for all possible matches, so if (ai.packageName.equals(ri.activityInfo.packageName)
// need to use the activity info of this specific one that was retrieved. && ai.name.equals(ri.activityInfo.name)) {
ri.activityInfo = ai; try {
DeviceAdminInfo dpi = new DeviceAdminInfo(this, ri); // We didn't retrieve the meta data for all possible matches, so
found = true; // need to use the activity info of this specific one that was retrieved.
} catch (XmlPullParserException e) { ri.activityInfo = ai;
Log.w(TAG, "Bad " + ri.activityInfo, e); DeviceAdminInfo dpi = new DeviceAdminInfo(this, ri);
} catch (IOException e) { found = true;
Log.w(TAG, "Bad " + ri.activityInfo, e); } catch (XmlPullParserException e) {
Log.w(TAG, "Bad " + ri.activityInfo, e);
} catch (IOException e) {
Log.w(TAG, "Bad " + ri.activityInfo, e);
}
break;
} }
break;
} }
} if (!found) {
if (!found) { Log.w(TAG, "Request to add invalid device admin: " + cn);
Log.w(TAG, "Request to add invalid device admin: " + cn); finish();
finish(); return;
return; }
} }
ResolveInfo ri = new ResolveInfo(); ResolveInfo ri = new ResolveInfo();