use of android.app.slice.SliceManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsSliceProvider method grantWhitelistedPackagePermissions.
@VisibleForTesting
static void grantWhitelistedPackagePermissions(Context context, List<Uri> descendants) {
if (descendants == null) {
Log.d(TAG, "No descendants to grant permission with, skipping.");
}
final String[] whitelistPackages = context.getResources().getStringArray(R.array.slice_whitelist_package_names);
if (whitelistPackages == null || whitelistPackages.length == 0) {
Log.d(TAG, "No packages to whitelist, skipping.");
return;
} else {
Log.d(TAG, String.format("Whitelisting %d uris to %d pkgs.", descendants.size(), whitelistPackages.length));
}
final SliceManager sliceManager = context.getSystemService(SliceManager.class);
for (Uri descendant : descendants) {
for (String toPackage : whitelistPackages) {
sliceManager.grantSlicePermission(toPackage, descendant);
}
}
}
use of android.app.slice.SliceManager in project android_packages_apps_Settings by omnirom.
the class SettingsSliceProvider method grantAllowlistedPackagePermissions.
@VisibleForTesting
static void grantAllowlistedPackagePermissions(Context context, List<Uri> descendants) {
if (descendants == null) {
Log.d(TAG, "No descendants to grant permission with, skipping.");
}
final String[] allowlistPackages = context.getResources().getStringArray(R.array.slice_allowlist_package_names);
if (allowlistPackages == null || allowlistPackages.length == 0) {
Log.d(TAG, "No packages to allowlist, skipping.");
return;
} else {
Log.d(TAG, String.format("Allowlisting %d uris to %d pkgs.", descendants.size(), allowlistPackages.length));
}
final SliceManager sliceManager = context.getSystemService(SliceManager.class);
for (Uri descendant : descendants) {
for (String toPackage : allowlistPackages) {
sliceManager.grantSlicePermission(toPackage, descendant);
}
}
}
use of android.app.slice.SliceManager in project robolectric by robolectric.
the class ShadowSliceManagerTest method setUp.
@Before
public void setUp() {
PackageManager packageManager = RuntimeEnvironment.getApplication().getPackageManager();
ShadowApplicationPackageManager shadowPackageManager = (ShadowApplicationPackageManager) shadowOf(packageManager);
shadowPackageManager.setPackagesForUid(PACKAGE_1_UID, PACKAGE_NAME_1);
shadowPackageManager.setPackagesForUid(PACKAGE_2_UID, PACKAGE_NAME_2);
sliceUri1 = Uri.parse("content://a/b");
sliceUri2 = Uri.parse("content://c/d");
sliceManager = ApplicationProvider.getApplicationContext().getSystemService(SliceManager.class);
}
Aggregations