Skip to content

Commit

Permalink
Merge "Allow granting URI permissions to com.android.settings.module_…
Browse files Browse the repository at this point in the history
…licenses." into qt-dev
  • Loading branch information
Andrew Sapperstein authored and Android (Google) Code Review committed Jun 28, 2019
2 parents ea3216d + 93f5ed6 commit 9dd0c56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/java/android/content/pm/PackageParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -8396,6 +8396,7 @@ public static PackageInfo generatePackageInfoFromApex(ApexInfo apexInfo, int fla
PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0,
Collections.emptySet(), state);
pi.applicationInfo.sourceDir = apexFile.getPath();
pi.applicationInfo.publicSourceDir = apexFile.getPath();
if (apexInfo.isFactory) {
pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1032,11 +1032,13 @@ int checkGrantUriPermission(int callingUid, String targetPkg, GrantUri grantUri,
// must always grant permissions on behalf of someone explicit.
final int callingAppId = UserHandle.getAppId(callingUid);
if ((callingAppId == SYSTEM_UID) || (callingAppId == ROOT_UID)) {
if ("com.android.settings.files".equals(grantUri.uri.getAuthority())) {
if ("com.android.settings.files".equals(grantUri.uri.getAuthority())
|| "com.android.settings.module_licenses".equals(grantUri.uri.getAuthority())) {
// Exempted authority for
// 1. cropping user photos and sharing a generated license html
// file in Settings app
// 2. sharing a generated license html file in TvSettings app
// 3. Sharing module license files from Settings app
} else {
Slog.w(TAG, "For security reasons, the system cannot issue a Uri permission"
+ " grant to " + grantUri + "; use startActivityAsCaller() instead");
Expand Down

0 comments on commit 9dd0c56

Please sign in to comment.