Make exception more explicit by including root cause and package name.

By omitting the cause of the exception, we are getting sub-standard
stack traces. I suspect where the root cause is, because it is only
thrown when a `PackageManager.NameNotFoundException` is thrown, but it
would help if that was in the ACRA reports to stop future investigators
from having to track that down.

Also add the name of the package which we searched for in the exception.
Knowing which apk was being uninstalled is not particularly helpful for
debugging, but knowing if it is `null` or `""` is important, because
that means that the `app.packageName` variable is not populated
correctly.
This commit is contained in:
Peter Serwylo 2017-02-15 10:31:41 +11:00
parent af24db2d14
commit ff6a60ae26

View File

@ -993,7 +993,7 @@ public class AppDetails extends AppCompatActivity {
return apk; return apk;
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
throw new IllegalStateException("Couldn't find app while installing"); throw new IllegalStateException("Couldn't find installed apk for " + app.packageName, e);
} }
} }