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

Commit 0cf8b408 authored by Matthew Fritze's avatar Matthew Fritze Committed by android-build-merger
Browse files

Merge "Add isSliceable API to BasePrefController" into pi-dev

am: ef950c24

Change-Id: Idbcc5c9960270b5713478aa5f22d524dc52fba91
parents 33ad1ae8 ef950c24
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -90,6 +90,11 @@ public class AccessibilitySlicePreferenceController extends TogglePreferenceCont
        return getAccessibilityServiceInfo() == null ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
    }

    @Override
    public boolean isSliceable() {
        return true;
    }

    private AccessibilityServiceInfo getAccessibilityServiceInfo() {
        final AccessibilityManager accessibilityManager = mContext.getSystemService(
                AccessibilityManager.class);
+17 −0
Original line number Diff line number Diff line
@@ -229,6 +229,23 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
        return null;
    }

    /**
     * Determines if the controller should be used as a Slice.
     * <p>
     *     Important criteria for a Slice are:
     *     - Must be secure
     *     - Must not be a privacy leak
     *     - Must be understandable as a stand-alone Setting.
     * <p>
     *     This does not guarantee the setting is available. {@link #isAvailable()} should sill be
     *     called.
     *
     * @return {@code true} if the controller should be used externally as a Slice.
     */
    public boolean isSliceable() {
        return false;
    }

    /**
     * Updates non-indexable keys for search provider.
     *
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;

import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.R;
@@ -53,6 +54,11 @@ public class AmbientDisplayAlwaysOnPreferenceController extends TogglePreference
        return isAvailable(mConfig) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public boolean isSliceable() {
        return TextUtils.equals(getPreferenceKey(), "ambient_display_always_on");
    }

    @Override
    public boolean isChecked() {
        return mConfig.alwaysOnEnabled(MY_USER);
+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
import android.text.TextUtils;

import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.R;
@@ -89,6 +90,11 @@ public class AmbientDisplayNotificationsPreferenceController extends
        return mConfig.pulseOnNotificationAvailable() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public boolean isSliceable() {
        return TextUtils.equals(getPreferenceKey(), "ambient_display_notification");
    }

    @Override
    //TODO (b/69808376): Remove result payload
    public ResultPayload getResultPayload() {
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ package com.android.settings.display;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import android.text.TextUtils;

import com.android.settings.DisplaySettings;
import com.android.settings.core.TogglePreferenceController;
@@ -60,6 +61,11 @@ public class AutoBrightnessPreferenceController extends TogglePreferenceControll
                : UNSUPPORTED_ON_DEVICE;
    }

    @Override
    public boolean isSliceable() {
        return TextUtils.equals(getPreferenceKey(), "auto_brightness");
    }

    @Override
    public ResultPayload getResultPayload() {
        // TODO remove result payload
Loading