Merge "Relax Instant Apps Settings whitelist enforcement"

am: c03c63c8bb

Change-Id: I1c14a1b7acb11e3de32e3e31ceccc68c37acf07c
This commit is contained in:
Chad Brubaker
2018-01-02 21:06:38 +00:00
committed by android-build-merger

View File

@@ -1687,18 +1687,9 @@ public class SettingsProvider extends ContentProvider {
}
private List<String> getSettingsNamesLocked(int settingsType, int userId) {
boolean instantApp;
if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
instantApp = false;
} else {
ApplicationInfo ai = getCallingApplicationInfoOrThrow();
instantApp = ai.isInstantApp();
}
if (instantApp) {
return new ArrayList<String>(getInstantAppAccessibleSettings(settingsType));
} else {
return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
}
// Don't enforce the instant app whitelist for now -- its too prone to unintended breakage
// in the current form.
return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
}
private void enforceSettingReadable(String settingName, int settingsType, int userId) {
@@ -1711,8 +1702,10 @@ public class SettingsProvider extends ContentProvider {
}
if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)
&& !getOverlayInstantAppAccessibleSettings(settingsType).contains(settingName)) {
throw new SecurityException("Setting " + settingName + " is not accessible from"
+ " ephemeral package " + getCallingPackage());
// Don't enforce the instant app whitelist for now -- its too prone to unintended
// breakage in the current form.
Slog.w(LOG_TAG, "Instant App " + ai.packageName
+ " trying to access unexposed setting, this will be an error in the future.");
}
}