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

Commit 61cca062 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Change BOOLEAN_TILE to TOGGLEABLE_TILE"

parents 2305ccf3 489ad0d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43995,7 +43995,7 @@ package android.service.quicksettings {
    field public static final String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
    field public static final String ACTION_QS_TILE_PREFERENCES = "android.service.quicksettings.action.QS_TILE_PREFERENCES";
    field public static final String META_DATA_ACTIVE_TILE = "android.service.quicksettings.ACTIVE_TILE";
    field public static final String META_DATA_BOOLEAN_TILE = "android.service.quicksettings.BOOLEAN_TILE";
    field public static final String META_DATA_TOGGLEABLE_TILE = "android.service.quicksettings.TOGGLEABLE_TILE";
  }
}
+7 −7
Original line number Diff line number Diff line
@@ -126,22 +126,22 @@ public class TileService extends Service {
            = "android.service.quicksettings.ACTIVE_TILE";

    /**
     * Meta-data for a tile to support {@code BooleanState}.
     * Meta-data for a tile to mark is toggleable.
     * <p>
     * BooleanState is for tiles that should support switch tile behavior in accessibility. This is
     * Toggleable tiles support switch tile behavior in accessibility. This is
     * the behavior of most of the framework tiles.
     *
     * To make a TileService support BooleanState, set this meta-data to true on the TileService's
     * manifest declaration.
     * To indicate that a TileService is toggleable, set this meta-data to true on the
     * TileService's manifest declaration.
     * <pre class="prettyprint">
     * {@literal
     * <meta-data android:name="android.service.quicksettings.BOOLEAN_TILE"
     * <meta-data android:name="android.service.quicksettings.TOGGLEABLE_TILE"
     *      android:value="true" />
     * }
     * </pre>
     */
    public static final String META_DATA_BOOLEAN_TILE =
            "android.service.quicksettings.BOOLEAN_TILE";
    public static final String META_DATA_TOGGLEABLE_TILE =
            "android.service.quicksettings.TOGGLEABLE_TILE";

    /**
     * Used to notify SysUI that Listening has be requested.
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener
        mTile = new Tile();
        updateDefaultTileAndIcon();
        mServiceManager = host.getTileServices().getTileWrapper(this);
        if (mServiceManager.isBooleanTile()) {
        if (mServiceManager.isToggleableTile()) {
            // Replace states with BooleanState
            resetStates();
        }
@@ -252,7 +252,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener

    @Override
    public State newTileState() {
        if (mServiceManager != null && mServiceManager.isBooleanTile()) {
        if (mServiceManager != null && mServiceManager.isToggleableTile()) {
            return new BooleanState();
        }
        return new State();
+4 −4
Original line number Diff line number Diff line
@@ -141,16 +141,16 @@ public class TileLifecycleManager extends BroadcastReceiver implements
    /**
     * Determines whether the associated TileService is a Boolean Tile.
     *
     * @return true if {@link TileService#META_DATA_BOOLEAN_TILE} is set to {@code true} for this
     * @return true if {@link TileService#META_DATA_TOGGLEABLE_TILE} is set to {@code true} for this
     *         tile
     * @see TileService#META_DATA_BOOLEAN_TILE
     * @see TileService#META_DATA_TOGGLEABLE_TILE
     */
    public boolean isBooleanTile() {
    public boolean isToggleableTile() {
        try {
            ServiceInfo info = mPackageManagerAdapter.getServiceInfo(mIntent.getComponent(),
                    PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.GET_META_DATA);
            return info.metaData != null
                    && info.metaData.getBoolean(TileService.META_DATA_BOOLEAN_TILE, false);
                    && info.metaData.getBoolean(TileService.META_DATA_TOGGLEABLE_TILE, false);
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
+2 −2
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ public class TileServiceManager {
        return mStateManager.isActiveTile();
    }

    public boolean isBooleanTile() {
        return mStateManager.isBooleanTile();
    public boolean isToggleableTile() {
        return mStateManager.isToggleableTile();
    }

    public void setShowingDialog(boolean dialog) {
Loading