Merge "Remove PackageManager.getResourcesForApplicationAsUser API"
This commit is contained in:
committed by
Android (Google) Code Review
commit
6b63414557
@@ -24,6 +24,7 @@ import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.UserHandle;
|
||||
import android.text.format.TimeMigrationUtils;
|
||||
import android.util.Slog;
|
||||
|
||||
@@ -34,8 +35,8 @@ class BlobStoreUtils {
|
||||
static Resources getPackageResources(@NonNull Context context,
|
||||
@NonNull String packageName, int userId) {
|
||||
try {
|
||||
return context.getPackageManager()
|
||||
.getResourcesForApplicationAsUser(packageName, userId);
|
||||
return context.createContextAsUser(UserHandle.of(userId), /* flags */ 0)
|
||||
.getPackageManager().getResourcesForApplication(packageName);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Slog.d(TAG, "Unknown package in user " + userId + ": "
|
||||
+ packageName, e);
|
||||
|
||||
Reference in New Issue
Block a user