Utils.getPackageUri() for creating Uris from packageNames

Since this is done a lot, might as well have a reusable method.
This commit is contained in:
Hans-Christoph Steiner
2016-05-25 13:00:00 +02:00
parent ae3ea85355
commit 677db72bb3
3 changed files with 11 additions and 4 deletions

View File

@@ -158,7 +158,7 @@ public class TestUtils {
context.setPackageManager(pm);
pm.install(appId, versionCode, versionName);
Intent installIntent = new Intent(Intent.ACTION_PACKAGE_ADDED);
installIntent.setData(Uri.parse("package:" + appId));
installIntent.setData(Utils.getPackageUri(appId));
new PackageAddedReceiver().onReceive(context, installIntent);
}
@@ -176,7 +176,7 @@ public class TestUtils {
context.setPackageManager(pm);
pm.install(appId, versionCode, versionName);
Intent installIntent = new Intent(Intent.ACTION_PACKAGE_CHANGED);
installIntent.setData(Uri.parse("package:" + appId));
installIntent.setData(Utils.getPackageUri(appId));
new PackageUpgradedReceiver().onReceive(context, installIntent);
}
@@ -189,7 +189,7 @@ public class TestUtils {
context.setPackageManager(pm);
pm.remove(appId);
Intent installIntent = new Intent(Intent.ACTION_PACKAGE_REMOVED);
installIntent.setData(Uri.parse("package:" + appId));
installIntent.setData(Utils.getPackageUri(appId));
new PackageRemovedReceiver().onReceive(context, installIntent);
}