Skip to content

Commit 94e9304

Browse files
committed
Properly catch NameNotFoundException for setApplicationRestrictionsManagingPackage
Bug: 27532565 Change-Id: I930c6f0ec63f31a8bbf4a799e03d273b0f8239a5
1 parent 5130ce1 commit 94e9304

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/src/main/java/com/afwsamples/testdpc/profilepolicy/apprestrictions/AppRestrictionsManagingPackageFragment.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.annotation.TargetApi;
2020
import android.app.admin.DevicePolicyManager;
2121
import android.content.Context;
22+
import android.content.pm.PackageManager.NameNotFoundException;
2223
import android.os.Build;
2324
import android.os.Bundle;
2425

@@ -56,9 +57,7 @@ protected void setSelectedPackage(String pkgName) {
5657
try {
5758
mDpm.setApplicationRestrictionsManagingPackage(
5859
DeviceAdminReceiver.getComponentName(getActivity()), pkgName);
59-
// TODO: Catch NameNotFoundException instead when NYC SDK
60-
// setApplicationRestrictionsManagingPackage starts to throw NameNotFoundException
61-
} catch (Exception nnpe) {
60+
} catch (NameNotFoundException nnpe) {
6261
throw new IllegalArgumentException(nnpe);
6362
}
6463
}

0 commit comments

Comments
 (0)