Fix crash in Permission Controller approving bug reports (incident reports were working fine)

Bug: 123955906
Test: atest GtsIncidentConfirmationTestCases
Change-Id: I13eb0679f71c1b6470856fd612bc914b1c61c04c
This commit is contained in:
Joe Onorato
2019-04-30 18:43:48 -07:00
parent 01fdbc12fa
commit 7694146d74

View File

@@ -519,6 +519,13 @@ public class IncidentManager {
android.Manifest.permission.PACKAGE_USAGE_STATS
})
public @Nullable IncidentReport getIncidentReport(Uri uri) {
final String id = uri.getQueryParameter(URI_PARAM_REPORT_ID);
if (id == null) {
// If there's no report id, it's a bug report, so we can't return the incident
// report.
return null;
}
final String pkg = uri.getQueryParameter(URI_PARAM_CALLING_PACKAGE);
if (pkg == null) {
throw new RuntimeException("Invalid URI: No "
@@ -531,13 +538,6 @@ public class IncidentManager {
+ URI_PARAM_RECEIVER_CLASS + " parameter. " + uri);
}
final String id = uri.getQueryParameter(URI_PARAM_REPORT_ID);
if (cls == null) {
// If there's no report id, it's a bug report, so we can't return the incident
// report.
return null;
}
try {
return getCompanionServiceLocked().getIncidentReport(pkg, cls, id);
} catch (RemoteException ex) {