Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29f3cd12 authored by Chad Brubaker's avatar Chad Brubaker Committed by android-build-merger
Browse files

Merge "Relax Instant Apps Settings whitelist enforcement" am: c03c63c8

am: d0c2fe9f

Change-Id: If2e059bddc4f03880323b24cc66059553b63216a
parents 448c1fd1 d0c2fe9f
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -1687,19 +1687,10 @@ 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 {
        // 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) {
        if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
@@ -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.");
        }
    }