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

Commit 25995fee authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

New device config to enable location perm re-up

Also expose some test-api's so that tests can set this device config.

Bug: 112390914
Test: Tried to trigger with option not set -> no notification
      atest CtsPermissionTestCases:android.permission.cts.LocationAccessCheckTest
Change-Id: Id48771b62615c2083529a2481585fa8a6ada1e45
parent 489239be
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5698,6 +5698,7 @@ package android.provider {
  public static interface DeviceConfig.Privacy {
    field public static final String NAMESPACE = "privacy";
    field public static final String PROPERTY_LOCATION_ACCESS_CHECK_ENABLED = "enable_location_access_check";
    field public static final String PROPERTY_PERMISSIONS_HUB_ENABLED = "enable_permissions_hub";
  }
+11 −0
Original line number Diff line number Diff line
@@ -1493,6 +1493,16 @@ package android.provider {
    field public static final android.net.Uri CORP_CONTENT_URI;
  }

  public final class DeviceConfig {
    method @RequiresPermission("android.permission.WRITE_DEVICE_CONFIG") public static void resetToDefaults(int, @Nullable String);
    method @RequiresPermission("android.permission.WRITE_DEVICE_CONFIG") public static boolean setProperty(String, String, String, boolean);
  }

  public static interface DeviceConfig.Privacy {
    field public static final String NAMESPACE = "privacy";
    field public static final String PROPERTY_LOCATION_ACCESS_CHECK_ENABLED = "enable_location_access_check";
  }

  public final class MediaStore {
    method @RequiresPermission("android.permission.CLEAR_APP_USER_DATA") public static void deleteContributedMedia(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
    method @RequiresPermission("android.permission.CLEAR_APP_USER_DATA") public static long getContributedMediaSize(android.content.Context, String, android.os.UserHandle) throws java.io.IOException;
@@ -1500,6 +1510,7 @@ package android.provider {

  public final class Settings {
    field public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
    field public static final int RESET_MODE_PACKAGE_DEFAULTS = 1; // 0x1
  }

  public static final class Settings.Global extends android.provider.Settings.NameValueTable {
+16 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.content.ContentResolver;
import android.database.ContentObserver;
@@ -44,6 +45,7 @@ import java.util.concurrent.Executor;
 * @hide
 */
@SystemApi
@TestApi
public final class DeviceConfig {
    /**
     * The content:// style URL for the config table.
@@ -128,13 +130,22 @@ public final class DeviceConfig {
     * @hide
     */
    @SystemApi
    @TestApi
    public interface Privacy {
        String NAMESPACE = "privacy";

        /**
         * Whether to show the Permissions Hub.
         *
         * @hide
         */
        @SystemApi
        String PROPERTY_PERMISSIONS_HUB_ENABLED = "enable_permissions_hub";

        /**
         * Whether to show location access check notifications.
         */
        String PROPERTY_LOCATION_ACCESS_CHECK_ENABLED = "enable_location_access_check";
    }

    /**
@@ -260,6 +271,7 @@ public final class DeviceConfig {
     * @see #resetToDefaults(int, String).
     */
    @SystemApi
    @TestApi
    @RequiresPermission(WRITE_DEVICE_CONFIG)
    public static boolean setProperty(
            String namespace, String name, String value, boolean makeDefault) {
@@ -280,6 +292,7 @@ public final class DeviceConfig {
     * @see #setProperty(String, String, String, boolean)
     */
    @SystemApi
    @TestApi
    @RequiresPermission(WRITE_DEVICE_CONFIG)
    public static void resetToDefaults(@ResetMode int resetMode, @Nullable String namespace) {
        ContentResolver contentResolver = ActivityThread.currentApplication().getContentResolver();
@@ -426,7 +439,10 @@ public final class DeviceConfig {
     * Interface for monitoring to properties.
     * <p>
     * Override {@link #onPropertyChanged(String, String, String)} to handle callbacks for changes.
     *
     * @hide
     */
    @SystemApi
    public interface OnPropertyChangedListener {
        /**
         * Called when a property has changed.
+1 −0
Original line number Diff line number Diff line
@@ -1830,6 +1830,7 @@ public final class Settings {
     * This is the only type of reset available to non-system clients.
     * @hide
     */
    @TestApi
    public static final int RESET_MODE_PACKAGE_DEFAULTS = 1;
    /**